mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
gen-dev: impl Num.neg for Dec,F32,F64
Dec negation was implemented across gen-dev, gen-llvm, gen-wasm as a call to the compiled zig function `bitcode::DEC_NEGATE`. f32 and f64 negation were implemented already for gen-llvm, gen-wasm. for gen-dev x86_64, float negation is implemented by flipping the sign bit, which means `xorps` for f32, and `xorpd` for f64 for gen-dev aarch64, there is conveniently a `fneg` instruction
This commit is contained in:
parent
6a3db1e59a
commit
a98acff0b9
6 changed files with 156 additions and 2 deletions
|
@ -1624,6 +1624,7 @@ impl<'a> LowLevelCall<'a> {
|
|||
}
|
||||
F32 => backend.code_builder.f32_neg(),
|
||||
F64 => backend.code_builder.f64_neg(),
|
||||
Decimal => self.load_args_and_call_zig(backend, bitcode::DEC_NEGATE),
|
||||
_ => todo!("{:?} for {:?}", self.lowlevel, self.ret_layout),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue