Remove all usages of iconst.i128
Support was removed from Cranelift
This commit is contained in:
parent
6768d0dd72
commit
16a2641444
@ -149,7 +149,7 @@ pub(crate) fn clif_int_or_float_cast(
|
||||
}
|
||||
|
||||
let is_not_nan = fx.bcx.ins().fcmp(FloatCC::Equal, from, from);
|
||||
let zero = fx.bcx.ins().iconst(to_ty, 0);
|
||||
let zero = type_zero_value(&mut fx.bcx, to_ty);
|
||||
fx.bcx.ins().select(is_not_nan, val, zero)
|
||||
} else if from_ty.is_float() && to_ty.is_float() {
|
||||
// float -> float
|
||||
|
@ -167,6 +167,15 @@ pub(crate) fn codegen_icmp_imm(
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -278,8 +278,14 @@ pub(crate) fn codegen_get_discriminant<'tcx>(
|
||||
fx.bcx.ins().iadd(tagged_discr, delta)
|
||||
};
|
||||
|
||||
let untagged_variant =
|
||||
fx.bcx.ins().iconst(cast_to, i64::from(untagged_variant.as_u32()));
|
||||
let untagged_variant = if cast_to == types::I128 {
|
||||
let zero = fx.bcx.ins().iconst(types::I64, 0);
|
||||
let untagged_variant =
|
||||
fx.bcx.ins().iconst(types::I64, i64::from(untagged_variant.as_u32()));
|
||||
fx.bcx.ins().iconcat(untagged_variant, zero)
|
||||
} else {
|
||||
fx.bcx.ins().iconst(cast_to, i64::from(untagged_variant.as_u32()))
|
||||
};
|
||||
let discr = fx.bcx.ins().select(is_niche, tagged_discr, untagged_variant);
|
||||
let res = CValue::by_val(discr, dest_layout);
|
||||
dest.write_cvalue(fx, res);
|
||||
|
@ -713,7 +713,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
|
||||
let res_type =
|
||||
Type::int_with_byte_size(u16::try_from(expected_bytes).unwrap()).unwrap();
|
||||
let mut res = fx.bcx.ins().iconst(res_type, 0);
|
||||
let mut res = type_zero_value(&mut fx.bcx, res_type);
|
||||
|
||||
let lanes = match fx.tcx.sess.target.endian {
|
||||
Endian::Big => Box::new(0..lane_count) as Box<dyn Iterator<Item = u64>>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user