Skip to content

Commit b20a92a

Browse files
bjorn3Amanieu
authored andcommitted
Use const {} for the immediate args of _mm*_cmp_*
Rustc_codegen_cranelift requires immediates to already be constant in MIR unlike LLVM which only needs them constant after optimizations.
1 parent 32a8d9f commit b20a92a

File tree

1 file changed

+3
-3
lines changed
  • crates/core_arch/src/x86

1 file changed

+3
-3
lines changed

crates/core_arch/src/x86/avx.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ pub const _CMP_TRUE_US: i32 = 0x1f;
738738
#[stable(feature = "simd_x86", since = "1.27.0")]
739739
pub unsafe fn _mm_cmp_pd<const IMM5: i32>(a: __m128d, b: __m128d) -> __m128d {
740740
static_assert_uimm_bits!(IMM5, 5);
741-
vcmppd(a, b, IMM5 as i8)
741+
vcmppd(a, b, const { IMM5 as i8 })
742742
}
743743

744744
/// Compares packed double-precision (64-bit) floating-point
@@ -768,7 +768,7 @@ pub unsafe fn _mm256_cmp_pd<const IMM5: i32>(a: __m256d, b: __m256d) -> __m256d
768768
#[stable(feature = "simd_x86", since = "1.27.0")]
769769
pub unsafe fn _mm_cmp_ps<const IMM5: i32>(a: __m128, b: __m128) -> __m128 {
770770
static_assert_uimm_bits!(IMM5, 5);
771-
vcmpps(a, b, IMM5 as i8)
771+
vcmpps(a, b, const { IMM5 as i8 })
772772
}
773773

774774
/// Compares packed single-precision (32-bit) floating-point
@@ -783,7 +783,7 @@ pub unsafe fn _mm_cmp_ps<const IMM5: i32>(a: __m128, b: __m128) -> __m128 {
783783
#[stable(feature = "simd_x86", since = "1.27.0")]
784784
pub unsafe fn _mm256_cmp_ps<const IMM5: i32>(a: __m256, b: __m256) -> __m256 {
785785
static_assert_uimm_bits!(IMM5, 5);
786-
vcmpps256(a, b, IMM5 as u8)
786+
vcmpps256(a, b, const { IMM5 as u8 })
787787
}
788788

789789
/// Compares the lower double-precision (64-bit) floating-point element in

0 commit comments

Comments
 (0)