public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106113] New: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result.
@ 2022-06-28 10:05 lingling.kong7 at gmail dot com
  2022-06-28 13:32 ` [Bug target/106113] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: lingling.kong7 at gmail dot com @ 2022-06-28 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106113
           Summary: wrong codegen for _mm_[u]comineq_{ss,sd} and need to
                    return PF result.
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lingling.kong7 at gmail dot com
  Target Milestone: ---

https://gcc.godbolt.org/z/svoqvKs55

for _mm_ucomineq_ss,
according to the instruction description,

Operation
(V)UCOMISS (all versions)
RESULT := UnorderedCompare(DEST[31:0] <> SRC[31:0]) {
(* Set EFLAGS *) CASE (RESULT) OF
UNORDERED: ZF,PF,CF := 111;
GREATER_THAN: ZF,PF,CF := 000;
LESS_THAN: ZF,PF,CF := 001;
EQUAL: ZF,PF,CF := 100;
ESAC;
OF, AF, SF := 0; }

result need to set PF = 1, 

but now generate code for `_mm_ucomineq_ss` is
# gcc -O3 -mavx512f
        xorl    %eax, %eax
        vucomiss        %xmm1, %xmm0
        setne   %al
        ret
it ignore PF result, the codegen in llvm for this is correct.

We also could refer to the codegen in gcc for '_mm_comi_round_ss(__A, __B, 4,
_MM_FROUND_NO_EXC); '

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

* [Bug target/106113] wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result.
  2022-06-28 10:05 [Bug target/106113] New: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result lingling.kong7 at gmail dot com
@ 2022-06-28 13:32 ` jakub at gcc dot gnu.org
  2022-06-28 13:33 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 13:32 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Has the definition of these intrinsics changed over time?
Because e.g. clang up to 3.8.1 also matches gcc behavior of testing LTGT for
the *neq* and UNEQ for *eq* intrinsics.
Note, changing all UNEQ to EQ and LTGT to NE in the COMI section of
i386-builtin.def doesn't do the trick.

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

* [Bug target/106113] wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result.
  2022-06-28 10:05 [Bug target/106113] New: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result lingling.kong7 at gmail dot com
  2022-06-28 13:32 ` [Bug target/106113] " jakub at gcc dot gnu.org
@ 2022-06-28 13:33 ` jakub at gcc dot gnu.org
  2022-06-30  2:16 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, for -ffast-math we certainly should keep generating what we have been as
NaN as operand is not valid in that case.

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

* [Bug target/106113] wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result.
  2022-06-28 10:05 [Bug target/106113] New: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result lingling.kong7 at gmail dot com
  2022-06-28 13:32 ` [Bug target/106113] " jakub at gcc dot gnu.org
  2022-06-28 13:33 ` jakub at gcc dot gnu.org
@ 2022-06-30  2:16 ` hjl.tools at gmail dot com
  2022-06-30  2:26 ` lingling.kong7 at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2022-06-30  2:16 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-06-30
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |hjl.tools at gmail dot com

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

* [Bug target/106113] wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result.
  2022-06-28 10:05 [Bug target/106113] New: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result lingling.kong7 at gmail dot com
                   ` (2 preceding siblings ...)
  2022-06-30  2:16 ` hjl.tools at gmail dot com
@ 2022-06-30  2:26 ` lingling.kong7 at gmail dot com
  2022-07-15  2:31 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: lingling.kong7 at gmail dot com @ 2022-06-30  2:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from kong lingling <lingling.kong7 at gmail dot com> ---
(In reply to Jakub Jelinek from comment #1)
> Has the definition of these intrinsics changed over time?
  Yes, intrinsic `_mm_comieq_ss ` old operation is `RETURN ( a[31:0] == b[31:0]
) ? 1 : 0`, and new operation update is `RETURN ( a[31:0] != NaN AND b[31:0] !=
NaN AND a[31:0] == b[31:0] ) ? 1 : 0`.
> Because e.g. clang up to 3.8.1 also matches gcc behavior of testing LTGT for
> the *neq* and UNEQ for *eq* intrinsics.
> Note, changing all UNEQ to EQ and LTGT to NE in the COMI section of
> i386-builtin.def doesn't do the trick.

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

* [Bug target/106113] wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result.
  2022-06-28 10:05 [Bug target/106113] New: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result lingling.kong7 at gmail dot com
                   ` (3 preceding siblings ...)
  2022-06-30  2:26 ` lingling.kong7 at gmail dot com
@ 2022-07-15  2:31 ` cvs-commit at gcc dot gnu.org
  2022-07-26  6:00 ` lingling.kong7 at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-15  2:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kong Lingling <konglin1@gcc.gnu.org>:

https://gcc.gnu.org/g:ae69e6f61b93dcb5b1e7ef609431f100c1b9b2e5

commit r13-1702-gae69e6f61b93dcb5b1e7ef609431f100c1b9b2e5
Author: konglin1 <lingling.kong@intel.com>
Date:   Fri Jul 15 10:29:27 2022 +0800

    i386: Fix _mm_[u]comixx_{ss,sd} codegen and add PF result. [PR106113]

    gcc/ChangeLog:

            PR target/106113
            * config/i386/i386-builtin.def (BDESC): Fix [u]comi{ss,sd}
            comparison due to intrinsics changed over time.
            * config/i386/i386-expand.cc (ix86_ssecom_setcc):
            Add unordered check and mode for sse comi codegen.
            (ix86_expand_sse_comi): Add unordered check and check a different
            CCmode.
            (ix86_expand_sse_comi_round):Extract unordered check and mode part
            in ix86_ssecom_setcc.

    gcc/testsuite/ChangeLog:

            PR target/106113
            * gcc.target/i386/avx-vcomisd-pr106113-2.c: New test.
            * gcc.target/i386/avx-vcomiss-pr106113-2.c: Ditto.
            * gcc.target/i386/avx-vucomisd-pr106113-2.c: Ditto.
            * gcc.target/i386/avx-vucomiss-pr106113-2.c: Ditto.
            * gcc.target/i386/sse-comiss-pr106113-1.c: Ditto.
            * gcc.target/i386/sse-comiss-pr106113-2.c: Ditto.
            * gcc.target/i386/sse-ucomiss-pr106113-1.c: Ditto.
            * gcc.target/i386/sse-ucomiss-pr106113-2.c: Ditto.
            * gcc.target/i386/sse2-comisd-pr106113-1.c: Ditto.
            * gcc.target/i386/sse2-comisd-pr106113-2.c: Ditto.
            * gcc.target/i386/sse2-ucomisd-pr106113-1.c: Ditto.
            * gcc.target/i386/sse2-ucomisd-pr106113-2.c: Ditto.

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

* [Bug target/106113] wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result.
  2022-06-28 10:05 [Bug target/106113] New: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result lingling.kong7 at gmail dot com
                   ` (4 preceding siblings ...)
  2022-07-15  2:31 ` cvs-commit at gcc dot gnu.org
@ 2022-07-26  6:00 ` lingling.kong7 at gmail dot com
  2022-07-26  6:01 ` lingling.kong7 at gmail dot com
  2022-10-22  2:21 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: lingling.kong7 at gmail dot com @ 2022-07-26  6:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from kong lingling <lingling.kong7 at gmail dot com> ---
Fixed in GCC13.

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

* [Bug target/106113] wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result.
  2022-06-28 10:05 [Bug target/106113] New: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result lingling.kong7 at gmail dot com
                   ` (5 preceding siblings ...)
  2022-07-26  6:00 ` lingling.kong7 at gmail dot com
@ 2022-07-26  6:01 ` lingling.kong7 at gmail dot com
  2022-10-22  2:21 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: lingling.kong7 at gmail dot com @ 2022-07-26  6:01 UTC (permalink / raw)
  To: gcc-bugs

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

kong lingling <lingling.kong7 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from kong lingling <lingling.kong7 at gmail dot com> ---
Fixed in GCC13.

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

* [Bug target/106113] wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result.
  2022-06-28 10:05 [Bug target/106113] New: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result lingling.kong7 at gmail dot com
                   ` (6 preceding siblings ...)
  2022-07-26  6:01 ` lingling.kong7 at gmail dot com
@ 2022-10-22  2:21 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-22  2:21 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

end of thread, other threads:[~2022-10-22  2:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28 10:05 [Bug target/106113] New: wrong codegen for _mm_[u]comineq_{ss,sd} and need to return PF result lingling.kong7 at gmail dot com
2022-06-28 13:32 ` [Bug target/106113] " jakub at gcc dot gnu.org
2022-06-28 13:33 ` jakub at gcc dot gnu.org
2022-06-30  2:16 ` hjl.tools at gmail dot com
2022-06-30  2:26 ` lingling.kong7 at gmail dot com
2022-07-15  2:31 ` cvs-commit at gcc dot gnu.org
2022-07-26  6:00 ` lingling.kong7 at gmail dot com
2022-07-26  6:01 ` lingling.kong7 at gmail dot com
2022-10-22  2:21 ` pinskia at gcc dot gnu.org

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