Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit d8c1393

Browse files
committed
Avoid mir_operand_get_const_val for simd_shuffle and cmpps and cmppd
1 parent aab17cc commit d8c1393

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/intrinsics/llvm_x86.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,12 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
7474
};
7575
let x = codegen_operand(fx, x);
7676
let y = codegen_operand(fx, y);
77-
let kind = crate::constant::mir_operand_get_const_val(fx, kind)
78-
.expect("llvm.x86.sse2.cmp.* kind not const");
77+
let kind = match kind {
78+
Operand::Constant(const_) => {
79+
crate::constant::eval_mir_constant(fx, const_).unwrap().0
80+
}
81+
Operand::Copy(_) | Operand::Move(_) => unreachable!("{kind:?}"),
82+
};
7983

8084
let flt_cc = match kind
8185
.try_to_bits(Size::from_bytes(1))

src/intrinsics/simd.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,12 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
168168

169169
let indexes = {
170170
use rustc_middle::mir::interpret::*;
171-
let idx_const = crate::constant::mir_operand_get_const_val(fx, idx)
172-
.expect("simd_shuffle idx not const");
171+
let idx_const = match idx {
172+
Operand::Constant(const_) => {
173+
crate::constant::eval_mir_constant(fx, const_).unwrap().0
174+
}
175+
Operand::Copy(_) | Operand::Move(_) => unreachable!("{idx:?}"),
176+
};
173177

174178
let idx_bytes = match idx_const {
175179
ConstValue::ByRef { alloc, offset } => {

0 commit comments

Comments
 (0)