public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103743] New: PPC: Inefficient equality compare for large 64-bit constants having only 16-bit relevant bits in high part
@ 2021-12-16  6:46 jens.seifert at de dot ibm.com
  2021-12-16  6:49 ` [Bug target/103743] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jens.seifert at de dot ibm.com @ 2021-12-16  6:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103743
           Summary: PPC: Inefficient equality compare for large 64-bit
                    constants having only 16-bit relevant bits in high
                    part
           Product: gcc
           Version: 8.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.seifert at de dot ibm.com
  Target Milestone: ---

int overflow();
int negOverflow(long long in)
{
   if (in == 0x8000000000000000LL)
   {
      return overflow();
   }
   return 0;
}

Generates:
negOverflow(long long):
        .quad   .L.negOverflow(long long),.TOC.@tocbase,0
.L.negOverflow(long long):
        li 9,-1
        rldicr 9,9,0,0
        cmpd 0,3,9
        beq 0,.L10
        li 3,0
        blr
.L10:
        mflr 0
        std 0,16(1)
        stdu 1,-112(1)
        bl overflow()
        nop
        addi 1,1,112
        ld 0,16(1)
        mtlr 0
        blr
        .long 0
        .byte 0,9,0,1,128,0,0,0

Instead of:
        li 9,-1
        rldicr 9,9,0,0
        cmpd 0,3,9

Expected output:
        rotldi 3,3,1
        cmpdi 0,3,1

This should be only applied if constant fits into 16-bit and if those 16-bit
are in the first 32-bit.

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

end of thread, other threads:[~2023-01-09  5:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16  6:46 [Bug target/103743] New: PPC: Inefficient equality compare for large 64-bit constants having only 16-bit relevant bits in high part jens.seifert at de dot ibm.com
2021-12-16  6:49 ` [Bug target/103743] " pinskia at gcc dot gnu.org
2021-12-16 15:06 ` bergner at gcc dot gnu.org
2021-12-16 22:14 ` pthaugen at gcc dot gnu.org
2022-03-15  2:06 ` guojiufu at gcc dot gnu.org
2022-03-15  7:32 ` guojiufu at gcc dot gnu.org
2022-03-16  9:48 ` guojiufu at gcc dot gnu.org
2022-05-16  1:59 ` guojiufu at gcc dot gnu.org
2022-12-20  3:59 ` cvs-commit at gcc dot gnu.org
2023-01-09  5:29 ` guojiufu 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).