From 374f5a8091f5dadff364cda8b19f8806e268e984 Mon Sep 17 00:00:00 2001 From: ScottMcMurray Date: Tue, 30 May 2023 20:38:07 -0700 Subject: [PATCH] Test from_fn autovectorizes --- tests/codegen/autovectorize-f32x4.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/codegen/autovectorize-f32x4.rs b/tests/codegen/autovectorize-f32x4.rs index 474ff1c4e91..54392be707f 100644 --- a/tests/codegen/autovectorize-f32x4.rs +++ b/tests/codegen/autovectorize-f32x4.rs @@ -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]) +}