[Bug target/85740] Non-optimal determining maximum in a loop

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Aug 21 20:19:33 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85740

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |target

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So GCC heurstics for figuring out a[i] > m if it is likely or unlikely is
always going to be "wrong". My bet if the test vector was always incrementing,
the version without the __builtin_expect would be faster.

x86_64 has a loop cache which is why the version without the __builtin_expect
seems faster.


More information about the Gcc-bugs mailing list