diff options
| author | Ralf Jung <post@ralfj.de> | 2023-07-23 09:27:28 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-07-23 09:27:28 +0200 |
| commit | 8a3b7463ed657ddc3d705c44028f1fe7915edb60 (patch) | |
| tree | d5cc4f8f0bbfae65d776880374519df12393f27e /tests/codegen | |
| parent | 46ddf460afb6b277700f1bac9a3e26b34dc2ed62 (diff) | |
| parent | cec34a43b1b14f4e39363f3b283d7ac4f593ee81 (diff) | |
| download | rust-8a3b7463ed657ddc3d705c44028f1fe7915edb60.tar.gz rust-8a3b7463ed657ddc3d705c44028f1fe7915edb60.zip | |
Merge from rustc
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/target-feature-inline-closure.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/codegen/target-feature-inline-closure.rs b/tests/codegen/target-feature-inline-closure.rs new file mode 100644 index 00000000000..d075706173f --- /dev/null +++ b/tests/codegen/target-feature-inline-closure.rs @@ -0,0 +1,33 @@ +// only-x86_64 +// compile-flags: -Copt-level=3 + +#![crate_type = "lib"] +#![feature(target_feature_11)] + +#[cfg(target_arch = "x86_64")] +use std::arch::x86_64::*; + +// CHECK-LABEL: @with_avx +#[no_mangle] +#[cfg(target_arch = "x86_64")] +#[target_feature(enable = "avx")] +fn with_avx(x: __m256) -> __m256 { + // CHECK: fadd + let add = { + #[inline(always)] + |x, y| unsafe { _mm256_add_ps(x, y) } + }; + add(x, x) +} + +// CHECK-LABEL: @without_avx +#[no_mangle] +#[cfg(target_arch = "x86_64")] +unsafe fn without_avx(x: __m256) -> __m256 { + // CHECK-NOT: fadd + let add = { + #[inline(always)] + |x, y| unsafe { _mm256_add_ps(x, y) } + }; + add(x, x) +} |
