public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* multiple problems with SSE / cmpunordps, QNaNs and -ffast-math
@ 2004-12-11 10:49 tbp
  2004-12-11 11:08 ` tbp
  0 siblings, 1 reply; 3+ messages in thread
From: tbp @ 2004-12-11 10:49 UTC (permalink / raw)
  To: gcc

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: multiple problems with SSE / cmpunordps, QNaNs and -ffast-math
  2004-12-11 10:49 multiple problems with SSE / cmpunordps, QNaNs and -ffast-math tbp
@ 2004-12-11 11:08 ` tbp
  2004-12-12 17:34   ` tbp
  0 siblings, 1 reply; 3+ messages in thread
From: tbp @ 2004-12-11 11:08 UTC (permalink / raw)
  To: gcc

I should get some cofffee before posting.

_mm_cmpord_ps / _mm_cmpunord_ss are immune to this problem at least on
gcc 4.0.0  20041205.

_mm_cmpunord_ss triggers even more ICE:
gcc -O2 -Wall -march=pentium4 -ffast-math sse.cpp && ./a.exe; echo $?
sse.cpp: In function `int main()':
sse.cpp:7: warning: division by zero in `1.0e+0 / 0.'
sse.cpp:13: internal compiler error: in simplify_ternary_operation, at 
   simplify-rtx.c:2321

Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls
--without-included-gettext --enable-libgcj --with-system-zlib
--enable-interpreter --enable-threads=posix --enable-java-gc=boehm
--enable-sjlj-exceptions --disable-version-specific-runtime-libs
--disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)

etc... really fishy.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: multiple problems with SSE / cmpunordps, QNaNs and -ffast-math
  2004-12-11 11:08 ` tbp
@ 2004-12-12 17:34   ` tbp
  0 siblings, 0 replies; 3+ messages in thread
From: tbp @ 2004-12-12 17:34 UTC (permalink / raw)
  To: gcc

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18944

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-12 17:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-11 10:49 multiple problems with SSE / cmpunordps, QNaNs and -ffast-math tbp
2004-12-11 11:08 ` tbp
2004-12-12 17:34   ` tbp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).