2023-04-05 09:44:20 +01:00
|
|
|
// ignore-wasm32 compiled with panic=abort by default
|
2023-05-06 23:20:58 -04:00
|
|
|
// unit-test: InstSimplify
|
|
|
|
// EMIT_MIR combine_array_len.norm2.InstSimplify.diff
|
2020-04-02 21:09:01 +00:00
|
|
|
|
2017-11-25 11:59:16 -08: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);
|
|
|
|
}
|