]> git.lizzy.rs Git - rust.git/blob - tests/codegen/swap-simd-types.rs
Auto merge of #107778 - weihanglo:update-cargo, r=weihanglo
[rust.git] / tests / codegen / swap-simd-types.rs
1 // compile-flags: -O -C target-feature=+avx
2 // only-x86_64
3 // ignore-debug: the debug assertions get in the way
4
5 #![crate_type = "lib"]
6
7 use std::mem::swap;
8
9 // SIMD types are highly-aligned already, so make sure the swap code leaves their
10 // types alone and doesn't pessimize them (such as by swapping them as `usize`s).
11 extern crate core;
12 use core::arch::x86_64::__m256;
13
14 // CHECK-LABEL: @swap_single_m256
15 #[no_mangle]
16 pub fn swap_single_m256(x: &mut __m256, y: &mut __m256) {
17 // CHECK-NOT: alloca
18 // CHECK: load <8 x float>{{.+}}align 32
19 // CHECK: store <8 x float>{{.+}}align 32
20     swap(x, y)
21 }
22
23 // CHECK-LABEL: @swap_m256_slice
24 #[no_mangle]
25 pub fn swap_m256_slice(x: &mut [__m256], y: &mut [__m256]) {
26 // CHECK-NOT: alloca
27 // CHECK: load <8 x float>{{.+}}align 32
28 // CHECK: store <8 x float>{{.+}}align 32
29     if x.len() == y.len() {
30         x.swap_with_slice(y);
31     }
32 }