Skip to content

Commit

Permalink
Test from_fn autovectorizes
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmcm authored and workingjubilee committed May 31, 2023
1 parent 472230d commit 374f5a8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/codegen/autovectorize-f32x4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,13 @@ pub fn auto_vectorize_loop(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
}
c
}

// CHECK-LABEL: @auto_vectorize_array_from_fn
#[no_mangle]
pub fn auto_vectorize_array_from_fn(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>
std::array::from_fn(|i| a[i] + b[i])
}

0 comments on commit 374f5a8

Please sign in to comment.