public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/98612] New: _mm_comieq_sd has wrong semantics
@ 2021-01-09 14:46 guillaume.piolat at gmail dot com
  2021-01-09 14:47 ` [Bug libstdc++/98612] " guillaume.piolat at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: guillaume.piolat at gmail dot com @ 2021-01-09 14:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98612

            Bug ID: 98612
           Summary: _mm_comieq_sd has wrong semantics
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: guillaume.piolat at gmail dot com
  Target Milestone: ---

Created attachment 49926
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49926&action=edit
Behaviour with 3 compilers

_mm_comieq_sd has different NaN semantics for different people.

# The Unordered team
- GCC will return 1 for a comparison that involved NaN.
- this maps to the underlying instruction

# The Ordered team
- Intel intrinsics guide says: 

     RETURN ( a[63:0] == b[63:0] ) ? 1 : 0

  which indicates an ordered comparison.

- ICC and clang return 0 for a NaN comparison (see image attachments)


As the x86 "intrinsics" are meant as a portable API (vs "builtins"), I would
suggest it is expected that the same result than clang and ICC is returned.

GCC has the same problem for other intrinsics that don't actually map to the
instruction semantics, such as:

sse2:
  - _mm_comieq_sd
  - _mm_comile_sd
  - _mm_comilt_sd
  - _mm_comineq_sd (instruction is an ordered comparison, but intrinsics is an
unordered comparison)

sse:
  - _mm_comieq_ss
  - _mm_comile_ss
  - _mm_comilt_ss
  - _mm_comineq_ss

I don't know for later instruction sets.

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

end of thread, other threads:[~2023-03-24 11:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09 14:46 [Bug libstdc++/98612] New: _mm_comieq_sd has wrong semantics guillaume.piolat at gmail dot com
2021-01-09 14:47 ` [Bug libstdc++/98612] " guillaume.piolat at gmail dot com
2021-01-11  6:05 ` [Bug target/98612] " crazylht at gmail dot com
2021-01-11  6:45 ` crazylht at gmail dot com
2021-01-11  8:36 ` rguenth at gcc dot gnu.org
2021-01-11 12:54 ` guillaume.piolat at gmail dot com
2021-01-12  3:18 ` cvs-commit at gcc dot gnu.org
2021-01-19  3:15 ` crazylht at gmail dot com
2021-01-19  7:28 ` ubizjak at gmail dot com
2023-03-24 11:20 ` andysem at mail dot ru

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).