[PATCH] D69979: clang: Guess at some platform FTZ/DAZ default settings
Sanjay Patel via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 18 07:07:46 PST 2019
spatel added a comment.
In D69979#1749198 <https://reviews.llvm.org/D69979#1749198>, @arsenm wrote:
> I just posted the test I wrote here: https://github.com/arsenm/subnormal_test
Thanks. I tried compiling with gcc (can't trust clang since it doesn't honor #pragma STDC FENV_ACCESS ON?).
And running that on a Ubuntu 17.10 x86-64 system, it's behaving as I would expect. If you compile without -ffast-math, it asserts:
With denormals disabled
a.out: subnormal_test.cpp:33: void fp32_denorm_test(): Assertion `std::fpclassify(subnormal) == FP_SUBNORMAL' failed.
And if you compile with -ffast-math, it asserts:
In default FP mode
a.out: subnormal_test.cpp:33: void fp32_denorm_test(): Assertion `std::fpclassify(subnormal) == FP_SUBNORMAL' failed.
This is what I see compiling Craig's csr tester:
$ cc -O2 csr.c && ./a.out
1f80
$ cc -O2 csr.c -ffast-math && ./a.out
9fc0
FZ is bit 15 (0x8000) and DAZ is bit 6 (0x0040), so they are clear in default (IEEE) mode and set with -ffast-math.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69979/new/
https://reviews.llvm.org/D69979
More information about the cfe-commits
mailing list