2023-06-08 07:18:34 +00:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2024-07-27 06:36:17 +00:00
|
|
|
//@ test-mir-pass: InstSimplify-after-simplifycfg
|
2020-04-02 21:09:01 +00:00
|
|
|
|
2024-07-27 06:36:17 +00:00
|
|
|
// EMIT_MIR combine_array_len.norm2.InstSimplify-after-simplifycfg.diff
|
2017-11-25 19:59:16 +00:00
|
|
|
fn norm2(x: [f32; 2]) -> f32 {
|
2023-10-16 19:19:51 +00:00
|
|
|
// CHECK-LABEL: fn norm2(
|
|
|
|
// CHECK-NOT: Len(
|
2017-11-25 19:59:16 +00:00
|
|
|
let a = x[0];
|
|
|
|
let b = x[1];
|
2024-06-03 00:18:33 +00:00
|
|
|
a * a + b * b
|
2017-11-25 19:59:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2024-06-03 00:18:33 +00:00
|
|
|
assert_eq!(norm2([3.0, 4.0]), 5.0 * 5.0);
|
2017-11-25 19:59:16 +00:00
|
|
|
}
|