Fix abi for checked multiplication

This commit is contained in:
bjorn3 2023-02-18 18:32:37 +01:00
parent 4991d08bc6
commit bb933d26dc
3 changed files with 3 additions and 1 deletions

View File

@ -58,6 +58,7 @@ fn main() {
assert_eq!(0b0000000000000000000000000010000000000000000000000000000000000000_0000000000000000000000000000000000001000000000000000000010000000u128.trailing_zeros(), 7);
assert_eq!(core::intrinsics::saturating_sub(0, -170141183460469231731687303715884105728i128), 170141183460469231731687303715884105727i128);
std::hint::black_box(std::hint::black_box(7571400400375753350092698930310845914i128) * 10);
assert!(0i128.checked_div(2i128).is_some());
assert!(0u128.checked_div(2u128).is_some());
assert_eq!(1u128 + 2, 3);

View File

@ -46,7 +46,7 @@ pub(crate) fn maybe_codegen<'tcx>(
let lhs = lhs.load_scalar(fx);
let rhs = rhs.load_scalar(fx);
let oflow_ptr = oflow.to_ptr().get_addr(fx);
let res = fx.lib_call(
let res = fx.lib_call_unadjusted(
"__muloti4",
vec![
AbiParam::new(types::I128),

View File

@ -39,6 +39,7 @@ pub(crate) fn $register(builder: &mut cranelift_jit::JITBuilder) {
// integers
fn __multi3(a: i128, b: i128) -> i128;
fn __muloti4(n: i128, d: i128, oflow: &mut i32) -> i128;
fn __udivti3(n: u128, d: u128) -> u128;
fn __divti3(n: i128, d: i128) -> i128;
fn __umodti3(n: u128, d: u128) -> u128;