Prefer std functions in fdlibm when precise results are guaranteed
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox145 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(4 external files)
Use std version for sqrtf, fabs(f), scalb(f), copysign(f), ceil(f), floor(f), trunc(f), nearbyint(f), and rint(f), because they're guaranteed to be precise per https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf, Annex F.
| Assignee | ||
Comment 1•1 year ago
|
||
| Assignee | ||
Comment 2•1 year ago
|
||
| Assignee | ||
Comment 3•1 year ago
|
||
And remove no longer used imports.
Updated•1 year ago
|
| Assignee | ||
Comment 4•1 year ago
|
||
There are some unfortunate complications on Windows:
- Rounding functions on Windows x64 can return the wrong NaN value for some Wasm tests. Probably fixable by adding a wrapper function which handles NaN.
- Try-runs on Windows x86 are broken all over the place (tests abort with Windows error code 0xC0000409). There seems to be an issue when the JIT calls into the runtime and the runtime performs a call to
stdrounding functions. Probably some calling convention or stack alignment issue involving x87 instructions. I don't have a Windows setup right now, so diagnosing and fixing this issue is difficult for me.
Try-run: https://treeherder.mozilla.org/jobs?repo=try&revision=fd508dc771f2f6b1b4e11747a2eb1678c7d5e2fe
| Assignee | ||
Comment 5•1 year ago
|
||
Add force_align_arg_pointer to ensure the stack is aligned to 16 bytes on
Windows x86. Without the extra stack alignment, calls from the JITs abort with
error code 0xC0000409.
And for Wasm additionally ensure NaN values are handled consistently across
different platforms. Tests in "jit-test/tests/wasm/spec/spec/f{32,64}.wast.js"
fail without this change. See also [1].
[1] https://webassembly.github.io/spec/core/exec/numerics.html#nan-propagation
Comment 7•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/0a301cd9de0b
https://hg.mozilla.org/mozilla-central/rev/5a965aa46724
https://hg.mozilla.org/mozilla-central/rev/4938f06c075e
https://hg.mozilla.org/mozilla-central/rev/d2459d918cdf
Updated•1 year ago
|
Description
•