0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-11-25 12:12:19 +01:00
rust/tests/assembly/libs/issue-115339-zip-arrays.rs

26 lines
611 B
Rust
Raw Permalink Normal View History

//@ assembly-output: emit-asm
2023-09-02 13:37:00 +02:00
// # zen3 previously exhibited odd vectorization
//@ compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -O
//@ only-x86_64
//@ ignore-sgx
2023-09-02 13:37:00 +02:00
use std::iter;
// previously this produced a long chain of
// 56: vpextrb $6, %xmm0, %ecx
// 57: orb %cl, 22(%rsi)
// 58: vpextrb $7, %xmm0, %ecx
// 59: orb %cl, 23(%rsi)
// [...]
// CHECK-LABEL: zip_arrays:
#[no_mangle]
pub fn zip_arrays(mut a: [u8; 32], b: [u8; 32]) -> [u8; 32] {
// CHECK-NOT: vpextrb
// CHECK-NOT: orb %cl
// CHECK: vorps
iter::zip(&mut a, b).for_each(|(a, b)| *a |= b);
// CHECK: retq
a
}