Skip to content

Commit 374f5a8

Browse files
scottmcmworkingjubilee
authored andcommitted
Test from_fn autovectorizes
1 parent 472230d commit 374f5a8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/codegen/autovectorize-f32x4.rs

+10
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,13 @@ pub fn auto_vectorize_loop(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
3030
}
3131
c
3232
}
33+
34+
// CHECK-LABEL: @auto_vectorize_array_from_fn
35+
#[no_mangle]
36+
pub fn auto_vectorize_array_from_fn(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
37+
// CHECK: load <4 x float>
38+
// CHECK: load <4 x float>
39+
// CHECK: fadd <4 x float>
40+
// CHECK: store <4 x float>
41+
std::array::from_fn(|i| a[i] + b[i])
42+
}

0 commit comments

Comments
 (0)