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:
shua 2024-11-20 22:38:19 +01:00
parent 6a3db1e59a
commit a98acff0b9
No known key found for this signature in database
6 changed files with 156 additions and 2 deletions

View file

@ -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),
}
}