https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93176
Bug ID: 93176
Summary: PPC: inefficient 64-bit constant consecutive ones
Product: gcc
Version: 8.3.0
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: ---
All 64-bit constants containing a sequence of ones can be constructed with 2
instructions (li/lis + rldicl). gcc creates up to 5 instructions.
Input:
unsigned long long onesLI()
{
return 0x00FFFFFFFFFFFF00ULL; // expected: li 3,0xFF00 ; rldicl 3,3,0,8
}
unsigned long long onesLIS()
{
return 0x00FFFFFFFF000000ULL; // expected: lis 3,0xFF00 ; rldicl 3,3,0,8
}
unsigned long long onesHI()
{
return 0x00FFFF0000000000ULL; // expected: lis 3,0xFFFF ; rldicl 3,3,8,8
}
Command line:
gcc -O2 -maix64 -save-temps const.C
Output:
._Z6onesLIv:
LFB..2:
lis 3,0xff
ori 3,3,0xffff
sldi 3,3,32
oris 3,3,0xffff
ori 3,3,0xff00
blr
._Z7onesLISv:
LFB..3:
lis 3,0xff
ori 3,3,0xffff
sldi 3,3,32
oris 3,3,0xff00
blr
._Z6onesHIv:
LFB..4:
lis 3,0xff
ori 3,3,0xff00
sldi 3,3,32
blr