[Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison
npiggin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Mar 29 23:02:57 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393
Bug ID: 94393
Summary: Powerpc suboptimal 64-bit constant comparison
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: npiggin at gmail dot com
Target Milestone: ---
--- test case ----
void test1(unsigned long a)
{
if (a > 0xc000000000000000ULL)
printf("yes\n");
}
void test2(unsigned long a)
{
if (a >= 0xc000000000000000ULL)
printf("yes\n");
}
------------------
The first (important part) compiles to
li 9,-1
rldicr 9,9,0,1
cmpld 0,3,9
blelr 0
The second to
lis 9,0xbfff
ori 9,9,0xffff
sldi 9,9,32
oris 9,9,0xffff
ori 9,9,0xffff
cmpld 0,3,9
blelr 0
The second could use the same 2-insn constant as the first, but with bltlr.
More information about the Gcc-bugs
mailing list