https://llvm.org/bugs/show_bug.cgi?id=31065
Bug ID: 31065
Summary: [ppc] ISEL instruction should take advantage r0=0 if
it is the first src operand
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: PowerPC
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Compile the source code with options -m64 -O2
bool foo(int a, int b)
{
return a > b;
}
bool bar(int a, int b)
{
return a < b;
}
I got
_Z3fooii: # @_Z3fooii
.Lfunc_begin0:
# BB#0: # %entry
li 5, 0 // unnecessary
cmpw 0, 3, 4
li 12, 1
isel 3, 12, 5, 1 // isel 3, 0, 12, 0
blr
_Z3barii: # @_Z3barii
.Lfunc_begin1:
# BB#0: # %entry
li 5, 0 // unnecessary
cmpw 0, 3, 4
li 12, 1
isel 3, 12, 5, 0 // isel 3, 0, 12, 1
blr
For ISEL instruction, if r0 is the first source operand, it is treated as 0. So
we can change the generated instructions as in comments, then "li 5, 0" can be
removed.
There are more complex cases that involves composition of several comparisons
and cross BBs.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs