mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Merge remote-tracking branch 'origin/main' into remove-nat
This commit is contained in:
commit
aabd95404f
104 changed files with 1031 additions and 651 deletions
|
@ -1640,6 +1640,7 @@ impl<'a> LowLevelCall<'a> {
|
|||
match arg_type {
|
||||
F32 => self.load_args_and_call_zig(backend, &bitcode::NUM_ROUND_F32[width]),
|
||||
F64 => self.load_args_and_call_zig(backend, &bitcode::NUM_ROUND_F64[width]),
|
||||
Decimal => self.load_args_and_call_zig(backend, &bitcode::DEC_ROUND[width]),
|
||||
_ => internal_error!("Invalid argument type for round: {:?}", arg_type),
|
||||
}
|
||||
}
|
||||
|
@ -1647,6 +1648,14 @@ impl<'a> LowLevelCall<'a> {
|
|||
self.load_args(backend);
|
||||
let arg_type = CodeGenNumType::for_symbol(backend, self.arguments[0]);
|
||||
let ret_type = CodeGenNumType::from(self.ret_layout);
|
||||
|
||||
let width = match ret_type {
|
||||
CodeGenNumType::I32 => IntWidth::I32,
|
||||
CodeGenNumType::I64 => IntWidth::I64,
|
||||
CodeGenNumType::I128 => todo!("{:?} for I128", self.lowlevel),
|
||||
_ => internal_error!("Invalid return type for round: {:?}", ret_type),
|
||||
};
|
||||
|
||||
match (arg_type, self.lowlevel) {
|
||||
(F32, NumCeiling) => {
|
||||
backend.code_builder.f32_ceil();
|
||||
|
@ -1654,14 +1663,21 @@ impl<'a> LowLevelCall<'a> {
|
|||
(F64, NumCeiling) => {
|
||||
backend.code_builder.f64_ceil();
|
||||
}
|
||||
(Decimal, NumCeiling) => {
|
||||
return self.load_args_and_call_zig(backend, &bitcode::DEC_CEILING[width]);
|
||||
}
|
||||
(F32, NumFloor) => {
|
||||
backend.code_builder.f32_floor();
|
||||
}
|
||||
(F64, NumFloor) => {
|
||||
backend.code_builder.f64_floor();
|
||||
}
|
||||
(Decimal, NumFloor) => {
|
||||
return self.load_args_and_call_zig(backend, &bitcode::DEC_FLOOR[width]);
|
||||
}
|
||||
_ => internal_error!("Invalid argument type for ceiling: {:?}", arg_type),
|
||||
}
|
||||
|
||||
match (ret_type, arg_type) {
|
||||
// TODO: unsigned truncation
|
||||
(I32, F32) => backend.code_builder.i32_trunc_s_f32(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue