rust/tests/mir-opt/instsimplify/combine_array_len.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
314 B
Rust
Raw Normal View History

// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2023-05-06 22:20:58 -05:00
//@ unit-test: InstSimplify
2020-04-02 16:09:01 -05:00
2023-10-16 14:19:51 -05:00
// EMIT_MIR combine_array_len.norm2.InstSimplify.diff
fn norm2(x: [f32; 2]) -> f32 {
2023-10-16 14:19:51 -05:00
// CHECK-LABEL: fn norm2(
// CHECK-NOT: Len(
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);
}