|
| 1 | +// only-x86_64 |
| 2 | +// assembly-output: emit-asm |
| 3 | +// make sure the feature is not enabled at compile-time |
| 4 | +// compile-flags: -C target-feature=-sse4.1 -C llvm-args=-x86-asm-syntax=intel |
| 5 | + |
| 6 | +#![feature(target_feature_11)] |
| 7 | +#![crate_type = "rlib"] |
| 8 | + |
| 9 | +use std::arch::x86_64::{__m128, _mm_blend_ps}; |
| 10 | + |
| 11 | +#[no_mangle] |
| 12 | +pub unsafe fn sse41_blend_nofeature(x: __m128, y: __m128) -> __m128 { |
| 13 | + let f = { |
| 14 | + // check that _mm_blend_ps is not being inlined into the closure |
| 15 | + // CHECK-LABEL: {{sse41_blend_nofeature.*closure.*:}} |
| 16 | + // CHECK-NOT: blendps |
| 17 | + // CHECK: {{call .*_mm_blend_ps.*}} |
| 18 | + // CHECK-NOT: blendps |
| 19 | + // CHECK: ret |
| 20 | + #[inline(never)] |x, y| _mm_blend_ps(x, y, 0b0101) |
| 21 | + }; |
| 22 | + f(x, y) |
| 23 | +} |
| 24 | + |
| 25 | +#[target_feature(enable = "sse4.1")] |
| 26 | +pub fn sse41_blend_noinline(x: __m128, y: __m128) -> __m128 { |
| 27 | + let f = { |
| 28 | + // check that _mm_blend_ps is being inlined into the closure |
| 29 | + // CHECK-LABEL: {{sse41_blend_noinline.*closure.*:}} |
| 30 | + // CHECK-NOT: _mm_blend_ps |
| 31 | + // CHECK: blendps |
| 32 | + // CHECK-NOT: _mm_blend_ps |
| 33 | + // CHECK: ret |
| 34 | + #[inline(never)] |x, y| unsafe { |
| 35 | + _mm_blend_ps(x, y, 0b0101) |
| 36 | + } |
| 37 | + }; |
| 38 | + f(x, y) |
| 39 | +} |
| 40 | + |
| 41 | +#[no_mangle] |
| 42 | +#[target_feature(enable = "sse4.1")] |
| 43 | +pub fn sse41_blend_doinline(x: __m128, y: __m128) -> __m128 { |
| 44 | + // check that the closure and _mm_blend_ps are being inlined into the function |
| 45 | + // CHECK-LABEL: sse41_blend_doinline: |
| 46 | + // CHECK-NOT: {{sse41_blend_doinline.*closure.*}} |
| 47 | + // CHECK-NOT: _mm_blend_ps |
| 48 | + // CHECK: blendps |
| 49 | + // CHECK-NOT: {{sse41_blend_doinline.*closure.*}} |
| 50 | + // CHECK-NOT: _mm_blend_ps |
| 51 | + // CHECK: ret |
| 52 | + let f = { |
| 53 | + #[inline] |x, y| unsafe { |
| 54 | + _mm_blend_ps(x, y, 0b0101) |
| 55 | + } |
| 56 | + }; |
| 57 | + f(x, y) |
| 58 | +} |
0 commit comments