public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jens.seifert at de dot ibm.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/103743] New: PPC: Inefficient equality compare for large 64-bit constants having only 16-bit relevant bits in high part
Date: Thu, 16 Dec 2021 06:46:20 +0000	[thread overview]
Message-ID: <bug-103743-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2021-12-16  6:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16  6:46 jens.seifert at de dot ibm.com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103743-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).