Avoid mir_operand_get_const_val for simd_shuffle and cmpps and cmppd

This commit is contained in:
bjorn3 2023-09-14 18:34:31 +00:00
parent aab17ccd19
commit d8c1393557
2 changed files with 12 additions and 4 deletions

View File

@ -74,8 +74,12 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
}; };
let x = codegen_operand(fx, x); let x = codegen_operand(fx, x);
let y = codegen_operand(fx, y); let y = codegen_operand(fx, y);
let kind = crate::constant::mir_operand_get_const_val(fx, kind) let kind = match kind {
.expect("llvm.x86.sse2.cmp.* kind not const"); Operand::Constant(const_) => {
crate::constant::eval_mir_constant(fx, const_).unwrap().0
}
Operand::Copy(_) | Operand::Move(_) => unreachable!("{kind:?}"),
};
let flt_cc = match kind let flt_cc = match kind
.try_to_bits(Size::from_bytes(1)) .try_to_bits(Size::from_bytes(1))

View File

@ -168,8 +168,12 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
let indexes = { let indexes = {
use rustc_middle::mir::interpret::*; use rustc_middle::mir::interpret::*;
let idx_const = crate::constant::mir_operand_get_const_val(fx, idx) let idx_const = match idx {
.expect("simd_shuffle idx not const"); Operand::Constant(const_) => {
crate::constant::eval_mir_constant(fx, const_).unwrap().0
}
Operand::Copy(_) | Operand::Move(_) => unreachable!("{idx:?}"),
};
let idx_bytes = match idx_const { let idx_bytes = match idx_const {
ConstValue::ByRef { alloc, offset } => { ConstValue::ByRef { alloc, offset } => {