Add regression test for closure loop vectorization
This commit is contained in:
parent
d5525a7300
commit
2bda6713c7
1 changed files with 28 additions and 0 deletions
28
tests/assembly-llvm/slp-vectorize-closure.rs
Normal file
28
tests/assembly-llvm/slp-vectorize-closure.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
//! Loop inside closure correctly compiled to assembly using SSE instructions.
|
||||
//! Regression test for <https://github.com/rust-lang/rust/issues/120189>.
|
||||
//! also see <https://godbolt.org/z/W1Yc4s3xo>
|
||||
//@ assembly-output: emit-asm
|
||||
//@ compile-flags: -Copt-level=3
|
||||
//@ only-x86_64
|
||||
// to test SSE instructions
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK-LABEL: for_in_closure
|
||||
// CHECK: {{paddb|psubb}}
|
||||
#[inline(never)]
|
||||
#[no_mangle]
|
||||
pub fn for_in_closure() {
|
||||
let mut v = [[0u8; 4]; 60];
|
||||
|
||||
let mut closure = || {
|
||||
for item in &mut v {
|
||||
item[0] += 1;
|
||||
item[1] += 1;
|
||||
item[2] += 1;
|
||||
item[3] += 1;
|
||||
}
|
||||
};
|
||||
|
||||
closure();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue