Skip to content

Commit bb77860

Browse files
committedFeb 5, 2023
Add another autovectorization codegen test using array zip-map
1 parent 5bc328f commit bb77860

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
 

‎tests/codegen/autovectorize-f32x4.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// compile-flags: -C opt-level=3
1+
// compile-flags: -C opt-level=3 -Z merge-functions=disabled
22
// only-x86_64
33
#![crate_type = "lib"]
4+
#![feature(array_zip)]
45

56
// CHECK-LABEL: @auto_vectorize_direct
67
#[no_mangle]
@@ -30,3 +31,13 @@ pub fn auto_vectorize_loop(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
3031
}
3132
c
3233
}
34+
35+
// CHECK-LABEL: @auto_vectorize_array_zip_map
36+
#[no_mangle]
37+
pub fn auto_vectorize_array_zip_map(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
38+
// CHECK: load <4 x float>
39+
// CHECK: load <4 x float>
40+
// CHECK: fadd <4 x float>
41+
// CHECK: store <4 x float>
42+
a.zip(b).map(|(a, b)| a + b)
43+
}

0 commit comments

Comments
 (0)