Test from_fn autovectorizes

This commit is contained in:
ScottMcMurray 2023-05-30 20:38:07 -07:00 committed by Jubilee Young
parent 472230d192
commit 374f5a8091

View File

@ -30,3 +30,13 @@
}
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])
}