Rollup merge of #149815 - is57primenumber:add-slp-vectorize-test, r=chenyukang
Add regression test for #120189 This PR adds regression tests for rust-lang/rust#120189. I added tests to verify vectorization of loops inside closures.
This commit is contained in:
commit
eb0f57507c
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