More testing; clean up

This commit is contained in:
Joshua Hoeflich 2021-08-14 18:23:49 -05:00
parent 744fefc3a1
commit 59f07377fe
2 changed files with 7 additions and 27 deletions

View file

@ -4741,32 +4741,8 @@ fn run_low_level<'a, 'ctx, 'env>(
// TODO: Obviously, this is completely wrong! Fix me!
NumBytesToU16 => {
debug_assert_eq!(args.len(), 1);
let (arg, arg_layout) = load_symbol_and_layout(scope, &args[0]);
match arg_layout {
Layout::Builtin(arg_builtin) => {
use roc_mono::layout::Builtin::*;
match arg_builtin {
Usize | Int128 | Int64 | Int32 | Int16 | Int8 => {
build_int_unary_op(env, arg.into_int_value(), arg_builtin, op)
}
Float128 | Float64 | Float32 | Float16 => {
build_float_unary_op(env, arg.into_float_value(), op)
}
_ => {
unreachable!("Compiler bug: tried to run numeric operation {:?} on invalid builtin layout: ({:?})", op, arg_layout);
}
}
}
_ => {
unreachable!(
"Compiler bug: tried to run numeric operation {:?} on invalid layout: {:?}",
op, arg_layout
);
}
}
let arg = load_symbol(scope, &args[0]);
call_bitcode_fn(env, &[arg.into()], bitcode::NUM_BYTES_TO_U16)
}
NumCompare => {
use inkwell::FloatPredicate;
@ -6061,7 +6037,6 @@ 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);
}