Page MenuHomeFreeBSD

AArch64: Don't set flush-subnormals-to-zero flag on startup
ClosedPublic

Authored by arichardson on Feb 26 2021, 12:43 PM.

Details

Summary

This flag has been set on startup since 65618fdda0f272a823e6701966421bdca0efa301.
However, This causes some of the math-related tests to fail as they report
zero instead of a tiny number. This fixes at least
/usr/tests/lib/msun/ldexp_test and possibly others.
Additionally, setting this flag prevents printf() from printing subnormal
numbers in decimal form.
See also https://www.openwall.com/lists/musl/2021/02/26/1

PR: 253847

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 37405
Build 34294: arc lint + arc unit

Event Timeline

sys/arm64/arm64/vm_machdep.c
58

I just re-ran the lib/msun tests with this set to zero and this results in one fewer failure. Why is this non-default flag being set?

My original idea was to do as much as possible for armv7. Primarily because it has been working on this platform for a long time. My bad is that I didn't remember that flush-to-zero mode was chosen because the little version of armv7 VFP may need software emulation for rounding to denormal values, so we chose the IEEE 754 incompatible mode.

sys/arm64/arm64/vm_machdep.c
58

Bad is that I'm unable to determine which value of DN should be compatible with IEEE 754 standard. By my reading, IEEE754 allows both variants.

This revision is now accepted and ready to land.Mar 1 2021, 12:13 PM