This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
multiple problems with SSE / cmpunordps, QNaNs and -ffast-math
- From: tbp <tbptbp at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 11 Dec 2004 11:48:27 +0100
- Subject: multiple problems with SSE / cmpunordps, QNaNs and -ffast-math
- Reply-to: tbp <tbptbp at gmail dot com>
I know that the fast-math flag implies finite-math-only but howerver
you take it something is wrong in what is best described by this:
#include <xmmintrin.h>
// $? should be 15, but with -ffast-math -> $? = 0
// if you don't get an ICE first
int main() {
__m128
a = _mm_set1_ps(1.f/0.f),
b = _mm_set1_ps(0),
c = _mm_mul_ps(a,b),
comp = _mm_cmpunord_ps(c,c);
return _mm_movemask_ps(comp);
}
[all of that on cygwin with ie -march=k8 or -march=pentium4]
With -ffast-math, the cmpunordps is simply not emited at all: 3.3.3
(cygwin special), 4.0.0 20041205 (and that's not related to the
comparison being against the same vector).
That's when you don't get an ICE along the way: ICEd on 3.4.1
20040625, 3.5.0 20040620, 4.0.0 20041017
I had no ancient or more regular builds to check against.
Anyway, if you follow the logic that i'm not supposed to generate any
NaN and therefore not allowed to check for them, a warning would be in
order when the cmpunordps is supressed (could have saved me some time
:)).
I sincerely hope that's an oversight, i would really hate to have to
abandon fast-math to be abble to check for quiet NaNs on SSE (where i
control pretty much every aspects).
tbp.
PS: recents gcc really rock at scheduling SSE, it's a real pleasure; a
cheerful thank you is more than deserved.