This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/18154] Inefficient max/min code for PowerPC


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.)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]