diff --git a/cranelift/codegen/meta/src/isa/x86/encodings.rs b/cranelift/codegen/meta/src/isa/x86/encodings.rs index d507abc0f5..afceebff31 100644 --- a/cranelift/codegen/meta/src/isa/x86/encodings.rs +++ b/cranelift/codegen/meta/src/isa/x86/encodings.rs @@ -1635,6 +1635,7 @@ fn define_simd( let usub_sat = shared.by_name("usub_sat"); let vconst = shared.by_name("vconst"); let vselect = shared.by_name("vselect"); + let x86_cvtt2si = x86.by_name("x86_cvtt2si"); let x86_insertps = x86.by_name("x86_insertps"); let x86_movlhps = x86.by_name("x86_movlhps"); let x86_movsd = x86.by_name("x86_movsd"); @@ -1902,6 +1903,13 @@ fn define_simd( rec_evex_reg_rm_128.opcodes(&VCVTUDQ2PS), Some(use_avx512vl_simd), // TODO need an OR predicate to join with AVX512F ); + + e.enc_both_inferred( + x86_cvtt2si + .bind(vector(I32, sse_vector_size)) + .bind(vector(F32, sse_vector_size)), + rec_furm.opcodes(&CVTTPS2DQ), + ); } // SIMD vconst for special cases (all zeroes, all ones) diff --git a/cranelift/codegen/meta/src/isa/x86/opcodes.rs b/cranelift/codegen/meta/src/isa/x86/opcodes.rs index d2391fe2ee..c38be80702 100644 --- a/cranelift/codegen/meta/src/isa/x86/opcodes.rs +++ b/cranelift/codegen/meta/src/isa/x86/opcodes.rs @@ -103,6 +103,10 @@ pub static CVTSI2SS: [u8; 3] = [0xf3, 0x0f, 0x2a]; /// float-point value. pub static CVTSS2SD: [u8; 3] = [0xf3, 0x0f, 0x5a]; +/// Convert four packed single-precision floating-point values from xmm2/mem to four packed signed +/// doubleword values in xmm1 using truncation (SSE2). +pub static CVTTPS2DQ: [u8; 3] = [0xf3, 0x0f, 0x5b]; + /// Convert with truncation scalar double-precision floating-point value to signed /// integer. pub static CVTTSD2SI: [u8; 3] = [0xf2, 0x0f, 0x2c];