blob: 08c5f1a1fc553fdceef9b7935903836a2e873fc9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
// ignore-wasm32 compiled with panic=abort by default
// unit-test: InstCombine
// EMIT_MIR combine_array_len.norm2.InstCombine.diff
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);
}
|