public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113609] New: EQ/NE comparison between avx512 kmask and -1 can be optimized with kxortest with checking CF.
@ 2024-01-26  3:17 liuhongt at gcc dot gnu.org
  2024-01-26  3:37 ` [Bug target/113609] " liuhongt at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: liuhongt at gcc dot gnu.org @ 2024-01-26  3:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113609
           Summary: EQ/NE comparison between avx512 kmask and -1 can be
                    optimized with kxortest with checking CF.
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liuhongt at gcc dot gnu.org
  Target Milestone: ---

It's from PR113576, there's code like 
 35        kmovb   %k0, %edx
 36        cmpb    $-1, %dl
 37        jne     .L21

The original codegen is buggy, but still exposed a optimization issue.
Compare 8/16/32/64-bit kmask to -1 and check equal or not can be optimized with
kortest by check CF.


KORTESTW ¶
TMP[15:0] := DEST[15:0] BITWISE OR SRC[15:0]
IF(TMP[15:0]=0)
    THEN ZF := 1
    ELSE ZF := 0
FI;
IF(TMP[15:0]=FFFFh)
    THEN CF := 1
    ELSE CF := 0
FI;
KORTESTB ¶
TMP[7:0] := DEST[7:0] BITWISE OR SRC[7:0]
IF(TMP[7:0]=0)
    THEN ZF := 1
    ELSE ZF := 0
FI;
IF(TMP[7:0]==FFh)
    THEN CF := 1
    ELSE CF := 0
FI;
KORTESTQ ¶
TMP[63:0] := DEST[63:0] BITWISE OR SRC[63:0]
IF(TMP[63:0]=0)
    THEN ZF := 1
    ELSE ZF := 0
FI;
IF(TMP[63:0]==FFFFFFFF_FFFFFFFFh)
    THEN CF := 1
    ELSE CF := 0
FI;
KORTESTD ¶
TMP[31:0] := DEST[31:0] BITWISE OR SRC[31:0]
IF(TMP[31:0]=0)
    THEN ZF := 1
    ELSE ZF := 0
FI;
IF(TMP[31:0]=FFFFFFFFh)
    THEN CF := 1
    ELSE CF := 0
FI;

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

end of thread, other threads:[~2024-06-03  6:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-26  3:17 [Bug target/113609] New: EQ/NE comparison between avx512 kmask and -1 can be optimized with kxortest with checking CF liuhongt at gcc dot gnu.org
2024-01-26  3:37 ` [Bug target/113609] " liuhongt at gcc dot gnu.org
2024-01-26  7:58 ` ubizjak at gmail dot com
2024-06-03  5:44 ` cvs-commit at gcc dot gnu.org
2024-06-03  6:50 ` liuhongt 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).