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

            Bug ID: 93012
           Summary: PPC: inefficient 64-bit constant generation (upper =
                    lower)
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.seifert at de dot ibm.com
  Target Milestone: ---

unsigned long long msk66()
{
   return 0x6666666666666666ULL;
}

gcc -maix64 -O2 const.C -save-temps

Output:
._Z5msk66v:
LFB..0:
        lis 3,0x6666
        ori 3,3,0x6666
        sldi 3,3,32
        oris 3,3,0x6666
        ori 3,3,0x6666
        blr

Any 64-bit constant that has matching upper 32-bit and lower 32-bit can be
created using 3 instructions construct 32-bit lower part and then use rldimi to
duplicate into upper part of register.

Sample:
        lis 3, 26214
        ori 3, 3, 26214
        rldimi 3, 3, 32, 0

Reply via email to