We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d5525a7 commit 2bda671Copy full SHA for 2bda671
tests/assembly-llvm/slp-vectorize-closure.rs
@@ -0,0 +1,28 @@
1
+//! Loop inside closure correctly compiled to assembly using SSE instructions.
2
+//! Regression test for <https://github.com/rust-lang/rust/issues/120189>.
3
+//! also see <https://godbolt.org/z/W1Yc4s3xo>
4
+//@ assembly-output: emit-asm
5
+//@ compile-flags: -Copt-level=3
6
+//@ only-x86_64
7
+// to test SSE instructions
8
+
9
+#![crate_type = "lib"]
10
11
+// CHECK-LABEL: for_in_closure
12
+// CHECK: {{paddb|psubb}}
13
+#[inline(never)]
14
+#[no_mangle]
15
+pub fn for_in_closure() {
16
+ let mut v = [[0u8; 4]; 60];
17
18
+ let mut closure = || {
19
+ for item in &mut v {
20
+ item[0] += 1;
21
+ item[1] += 1;
22
+ item[2] += 1;
23
+ item[3] += 1;
24
+ }
25
+ };
26
27
+ closure();
28
+}
0 commit comments