Fixed: Actually calling llvm we generate

This commit is contained in:
Joshua Hoeflich 2021-08-14 18:20:11 -05:00
parent ce8f947522
commit 744fefc3a1
4 changed files with 5 additions and 4 deletions

View File

@ -25,9 +25,9 @@ pub fn asin(num: f64) callconv(.C) f64 {
/// TODO: Obviously, this should not be an alias for arcsin(x);
/// fix me!
pub fn bytesToU16C(num: f64) callconv(.C) f64 {
return @call(.{ .modifier = always_inline }, bytesToU16, .{num});
return num + 1;
}
fn bytesToU16(num: f64) f64 {
return math.asin(num);
return num + 1;
}

View File

@ -1096,7 +1096,7 @@ fn num_bytes_to_u16(symbol: Symbol, var_store: &mut VarStore) -> Def {
let ret_float_var = var_store.fresh();
let body = RunLowLevel {
op: LowLevel::NumAsin,
op: LowLevel::NumBytesToU16,
args: vec![(arg_float_var, Var(Symbol::ARG_1))],
ret_var: ret_float_var,
};

View File

@ -6061,6 +6061,7 @@ fn build_float_unary_op<'a, 'ctx, 'env>(
NumAtan => call_bitcode_fn(env, &[arg.into()], bitcode::NUM_ATAN),
NumAcos => call_bitcode_fn(env, &[arg.into()], bitcode::NUM_ACOS),
NumAsin => call_bitcode_fn(env, &[arg.into()], bitcode::NUM_ASIN),
NumBytesToU16 => call_bitcode_fn(env, &[arg.into()], bitcode::NUM_BYTES_TO_U16),
_ => {
unreachable!("Unrecognized int unary operation: {:?}", op);
}

View File

@ -1623,6 +1623,6 @@ mod gen_num {
#[test]
fn num_bytes_to_u16_ascii() {
assert_evals_to!("Num.bytesToU16 0", 0.0, f64);
assert_evals_to!("Num.bytesToU16 1", 2.0, f64);
}
}