We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8e98537 commit 934345bCopy full SHA for 934345b
src/test/codegen/autovectorize-f32x4.rs
@@ -0,0 +1,31 @@
1
+// compile-flags: -C opt-level=3
2
+// only-x86_64
3
+#![crate_type = "lib"]
4
+
5
+// CHECK-LABEL: @auto_vectorize_direct
6
+#[no_mangle]
7
+pub fn auto_vectorize_direct(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
8
+// CHECK: load <4 x float>
9
10
+// CHECK: fadd <4 x float>
11
+// CHECK: store <4 x float>
12
+ [
13
+ a[0] + b[0],
14
+ a[1] + b[1],
15
+ a[2] + b[2],
16
+ a[3] + b[3],
17
+ ]
18
+}
19
20
+// CHECK-LABEL: @auto_vectorize_loop
21
+pub fn auto_vectorize_loop(a: [f32; 4], b: [f32; 4]) -> [f32; 4] {
22
23
24
25
26
+ let mut c = [0.0; 4];
27
+ for i in 0..4 {
28
+ c[i] = a[i] + b[i];
29
+ }
30
+ c
31
0 commit comments