2022-08-02 19:44:25 -05:00
|
|
|
// unit-test: InstCombine
|
2020-07-27 14:22:43 -05:00
|
|
|
// EMIT_MIR combine_array_len.norm2.InstCombine.diff
|
2020-04-02 16:09:01 -05:00
|
|
|
|
2017-11-25 13:59:16 -06:00
|
|
|
fn norm2(x: [f32; 2]) -> f32 {
|
|
|
|
let a = x[0];
|
|
|
|
let b = x[1];
|
|
|
|
a*a + b*b
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(norm2([3.0, 4.0]), 5.0*5.0);
|
|
|
|
}
|