-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
enhancementNew feature or requestNew feature or request
Description
We're currently using libm to implement the missing compiler builtins for f32 and f64 primitives. The libm crate implements these builtins in Rust. While it provides a very workable springboard to get started quickly, it leaves a lot to be desired with fast math.
The N64 CPU supports many of these operations natively through the floating point unit, COP1. Here's a table summarizing the builtin to FPU instruction relationships:
| builtin | FPU instruction |
|---|---|
fabs |
abs.d |
fabsf |
abs.s |
ceil |
ceil.l.d, cvt.d.l |
ceilf |
ceil.w.s, cvt.s.w |
floor |
floor.l.d, cvt.d.l |
floorf |
floor.w.s, cvt.s.w |
round |
round.l.d, cvt.d.l |
roundf |
round.w.s, cvt.s.w |
sqrt |
sqrt.d |
sqrtf |
sqrt.s |
trunc |
trunc.l.d, cvt.d.l |
truncf |
trunc.w.s, cvt.s.w |
Another alternative is using LLVM intrinsics from rustc. (How?)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request