summaryrefslogtreecommitdiffstats
path: root/tests/assembly
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /tests/assembly
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/assembly')
-rw-r--r--tests/assembly/closure-inherit-target-feature.rs58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/assembly/closure-inherit-target-feature.rs b/tests/assembly/closure-inherit-target-feature.rs
new file mode 100644
index 000000000..65728a155
--- /dev/null
+++ b/tests/assembly/closure-inherit-target-feature.rs
@@ -0,0 +1,58 @@
+// only-x86_64
+// assembly-output: emit-asm
+// make sure the feature is not enabled at compile-time
+// compile-flags: -C opt-level=3 -C target-feature=-sse4.1 -C llvm-args=-x86-asm-syntax=intel
+
+#![feature(target_feature_11)]
+#![crate_type = "rlib"]
+
+use std::arch::x86_64::{__m128, _mm_blend_ps};
+
+#[no_mangle]
+pub unsafe fn sse41_blend_nofeature(x: __m128, y: __m128) -> __m128 {
+ let f = {
+ // check that _mm_blend_ps is not being inlined into the closure
+ // CHECK-LABEL: {{sse41_blend_nofeature.*closure.*:}}
+ // CHECK-NOT: blendps
+ // CHECK: {{call .*_mm_blend_ps.*}}
+ // CHECK-NOT: blendps
+ // CHECK: ret
+ #[inline(never)] |x, y| _mm_blend_ps(x, y, 0b0101)
+ };
+ f(x, y)
+}
+
+#[target_feature(enable = "sse4.1")]
+pub fn sse41_blend_noinline(x: __m128, y: __m128) -> __m128 {
+ let f = {
+ // check that _mm_blend_ps is being inlined into the closure
+ // CHECK-LABEL: {{sse41_blend_noinline.*closure.*:}}
+ // CHECK-NOT: _mm_blend_ps
+ // CHECK: blendps
+ // CHECK-NOT: _mm_blend_ps
+ // CHECK: ret
+ #[inline(never)] |x, y| unsafe {
+ _mm_blend_ps(x, y, 0b0101)
+ }
+ };
+ f(x, y)
+}
+
+#[no_mangle]
+#[target_feature(enable = "sse4.1")]
+pub fn sse41_blend_doinline(x: __m128, y: __m128) -> __m128 {
+ // check that the closure and _mm_blend_ps are being inlined into the function
+ // CHECK-LABEL: sse41_blend_doinline:
+ // CHECK-NOT: {{sse41_blend_doinline.*closure.*}}
+ // CHECK-NOT: _mm_blend_ps
+ // CHECK: blendps
+ // CHECK-NOT: {{sse41_blend_doinline.*closure.*}}
+ // CHECK-NOT: _mm_blend_ps
+ // CHECK: ret
+ let f = {
+ #[inline] |x, y| unsafe {
+ _mm_blend_ps(x, y, 0b0101)
+ }
+ };
+ f(x, y)
+}