Use new abi for 128bit int to float cast intrinsics on Windows

This commit is contained in:
bjorn3 2023-02-06 16:58:05 +00:00
parent cdf4f4287a
commit e58bb2acbd
2 changed files with 23 additions and 7 deletions

View File

@ -64,12 +64,28 @@ pub(crate) fn clif_int_or_float_cast(
},
);
return fx.lib_call(
&name,
vec![AbiParam::new(types::I128)],
vec![AbiParam::new(to_ty)],
&[from],
)[0];
if fx.tcx.sess.target.is_like_windows {
let arg_place = CPlace::new_stack_slot(
fx,
fx.layout_of(if from_signed { fx.tcx.types.i128 } else { fx.tcx.types.u128 }),
);
let arg_ptr = arg_place.to_ptr();
arg_ptr.store(fx, from, MemFlags::trusted());
let args = [arg_ptr.get_addr(fx)];
return fx.lib_call(
&name,
vec![AbiParam::new(fx.pointer_type)],
vec![AbiParam::new(to_ty)],
&args,
)[0];
} else {
return fx.lib_call(
&name,
vec![AbiParam::new(types::I128)],
vec![AbiParam::new(to_ty)],
&[from],
)[0];
}
}
// int-like -> float

View File

@ -188,7 +188,7 @@ fn init(&self, sess: &Session) {
}
fn target_features(&self, _sess: &Session, _allow_unstable: bool) -> Vec<rustc_span::Symbol> {
vec![]
vec![Symbol::intern("llvm14-builtins-abi")]
}
fn print_version(&self) {