mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Add regression test for closure loop vectorization
This commit is contained in:
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user