[LLVMbugs] [Bug 14024] New: clang does not set DAZ flag in -ffast-math mode
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Oct 4 11:16:28 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=14024
Bug #: 14024
Summary: clang does not set DAZ flag in -ffast-math mode
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Driver
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: grosser at fim.uni-passau.de
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 9307
--> http://llvm.org/bugs/attachment.cgi?id=9307
Test case
$gcc jacobi_1d.DenormalsAreZero.c -O3
$time ./a.out
real 0m20.164s
$gcc jacobi_1d.DenormalsAreZero.c -O3 -ffast-math
$time ./a.out
real 0m0.357s
$clang jacobi_1d.DenormalsAreZero.c -O3
$time ./a.out
real 0m36.660s
$clang jacobi_1d.DenormalsAreZero.c -O3 -ffast-math
$time ./a.out
real 0m36.431s
As can be seen the gcc produced binary is a lot faster than clang in
-ffast-mode (besides being a little bit faster in general). This is not caused
by better optimizations, but because gcc links in a small function into the
resulting binary, which sets the DAZ register.
>From [1]:
"DAZ tells the CPU to force all Denormals to zero. A Denormal is a number that
is so small that FPU can't renormalize it due to limited exponent ranges.
They're just like normal numbers, but they take considerably longer to process.
Note that not all processors support DAZ."
The test case happens to calculate a lot of these close-to-zero values. Hence,
setting the register has a big impact.
[1] http://softpixel.com/~cwright/programming/simd/sse.php
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list