This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/18154] Inefficient max/min code for PowerPC
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 30 Jan 2016 18:57:38 +0000
- Subject: [Bug target/18154] Inefficient max/min code for PowerPC
- Auto-submitted: auto-generated
- References: <bug-18154-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18154
--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
I noticed while looking at an unrelated bug that when targeting power7 or
power8 Clang makes use of the isel instruction and emits the following:
min: # @min
cmpw 3, 4
isel 3, 3, 4, 0
blr
Gcc also has the capability of using isel but it's disabled by default even
when targeting power8 and must be explicitly enabled via -misel. With it, GCC
emits the following branchless code:
min:
cmpw 7,3,4
isel 3,3,4,28
extsw 3,3
blr
Since the instruction exists for just this purpose (eliminating branches),
would it make sense to enable it by default? (I suppose one concern with it
might be that it's not being very extensively tested.)