Skip to content

Commit

Permalink
Add another autovectorization codegen test using array zip-map
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmcm committed Feb 5, 2023
1 parent 5bc328f commit bb77860
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/codegen/autovectorize-f32x4.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// compile-flags: -C opt-level=3
// compile-flags: -C opt-level=3 -Z merge-functions=disabled
// only-x86_64
#![crate_type = "lib"]
#![feature(array_zip)]

// CHECK-LABEL: @auto_vectorize_direct
#[no_mangle]
Expand Down Expand Up @@ -30,3 +31,13 @@ pub fn auto_vectorize_loop(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
}
c
}

// CHECK-LABEL: @auto_vectorize_array_zip_map
#[no_mangle]
pub fn auto_vectorize_array_zip_map(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
// CHECK: load <4 x float>
// CHECK: load <4 x float>
// CHECK: fadd <4 x float>
// CHECK: store <4 x float>
a.zip(b).map(|(a, b)| a + b)
}

0 comments on commit bb77860

Please sign in to comment.