diff options
| author | bors <bors@rust-lang.org> | 2023-07-23 07:28:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-07-23 07:28:47 +0000 |
| commit | 0c9d1a353e117fc7644fefb6c820476b1ff34271 (patch) | |
| tree | d5cc4f8f0bbfae65d776880374519df12393f27e /tests/codegen | |
| parent | 16cddb38d99f30f73085b4b1ab03ed19e7a7aad6 (diff) | |
| parent | 8a3b7463ed657ddc3d705c44028f1fe7915edb60 (diff) | |
Auto merge of #2990 - RalfJung:rustup, r=RalfJung
Rustup
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) +} |
