From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_codegen_cranelift/src/common.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_codegen_cranelift/src/common.rs') diff --git a/compiler/rustc_codegen_cranelift/src/common.rs b/compiler/rustc_codegen_cranelift/src/common.rs index 589594465..2dcd42fbd 100644 --- a/compiler/rustc_codegen_cranelift/src/common.rs +++ b/compiler/rustc_codegen_cranelift/src/common.rs @@ -162,11 +162,20 @@ pub(crate) fn codegen_icmp_imm( } } } else { - let rhs = i64::try_from(rhs).expect("codegen_icmp_imm rhs out of range for <128bit int"); + let rhs = rhs as i64; // Truncates on purpose in case rhs is actually an unsigned value fx.bcx.ins().icmp_imm(intcc, lhs, rhs) } } +pub(crate) fn type_zero_value(bcx: &mut FunctionBuilder<'_>, ty: Type) -> Value { + if ty == types::I128 { + let zero = bcx.ins().iconst(types::I64, 0); + bcx.ins().iconcat(zero, zero) + } else { + bcx.ins().iconst(ty, 0) + } +} + pub(crate) fn type_min_max_value( bcx: &mut FunctionBuilder<'_>, ty: Type, -- cgit v1.2.3