rust/tests/mir-opt/combine_array_len.rs

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

14 lines
260 B
Rust
Raw Normal View History

// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2023-05-07 11:20:58 +08:00
// unit-test: InstSimplify
// EMIT_MIR combine_array_len.norm2.InstSimplify.diff
2020-04-03 05:09:01 +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);
}