public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/98522] New: _mm_cvttps_pi32 and _mm_cvtps_pi32 raise spurious FP exceptions
@ 2021-01-05  2:54 foom at fuhm dot net
  2021-01-05 10:07 ` [Bug target/98522] " ubizjak at gmail dot com
  2021-01-06  9:47 ` ubizjak at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: foom at fuhm dot net @ 2021-01-05  2:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98522
           Summary: _mm_cvttps_pi32 and _mm_cvtps_pi32 raise spurious FP
                    exceptions
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: foom at fuhm dot net
  Target Milestone: ---

This is a regression due to the MMX in SSE work in GCC10. As far as I can tell,
it affects only these two functions.

Example test, which should return 0, but instead throws SIGFPE:

#pragma stdc fenv_access

#define _GNU_SOURCE
#include <emmintrin.h>
#include <fenv.h>

__attribute__((noinline)) __m64 test(__m128 a) {
  return _mm_cvtt_ps2pi(a);
}

int main() {
  feenableexcept(FE_INVALID);
  __m128 x = (__m128)(__m128i){0x0000000000000000LL, 0x7fffffffffffffffLL};
  volatile __m64 y = test(x);
}


In GCC 10 and trunk, the function test is compiled to:
        cvttps2dq       xmm0, xmm0
        ret
which will convert the upper 64 bits as well as the lower 64 bits -- and
therefore raises FP exceptions accordingly. But, it ought to be ignoring the
upper 64bits.

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

* [Bug target/98522] _mm_cvttps_pi32 and _mm_cvtps_pi32 raise spurious FP exceptions
  2021-01-05  2:54 [Bug target/98522] New: _mm_cvttps_pi32 and _mm_cvtps_pi32 raise spurious FP exceptions foom at fuhm dot net
@ 2021-01-05 10:07 ` ubizjak at gmail dot com
  2021-01-06  9:47 ` ubizjak at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ubizjak at gmail dot com @ 2021-01-05 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-01-05
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |ubizjak at gmail dot com

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
Created attachment 49881
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49881&action=edit
Proposed patch

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

* [Bug target/98522] _mm_cvttps_pi32 and _mm_cvtps_pi32 raise spurious FP exceptions
  2021-01-05  2:54 [Bug target/98522] New: _mm_cvttps_pi32 and _mm_cvtps_pi32 raise spurious FP exceptions foom at fuhm dot net
  2021-01-05 10:07 ` [Bug target/98522] " ubizjak at gmail dot com
@ 2021-01-06  9:47 ` ubizjak at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ubizjak at gmail dot com @ 2021-01-06  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
Fixed for gcc-10.3.

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

end of thread, other threads:[~2021-01-06  9:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05  2:54 [Bug target/98522] New: _mm_cvttps_pi32 and _mm_cvtps_pi32 raise spurious FP exceptions foom at fuhm dot net
2021-01-05 10:07 ` [Bug target/98522] " ubizjak at gmail dot com
2021-01-06  9:47 ` ubizjak at gmail dot com

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