mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
13 lines
222 B
Rust
13 lines
222 B
Rust
// 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);
|
|
}
|