[Bug tree-optimization/80874] gcc does not emit cmov for minmax
denis.campredon at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu May 25 09:32:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80874
--- Comment #1 from denis.campredon at gmail dot com ---
Sorry, minmax3 should not produce the same asm, since minmax return a pair of
const reference.
But still the code is less than optimal.
One part it is because gcc might be because gcc is not able to optimize the two
functions the same way:
---------------
struct pair {
const int &x, y;
};
pair minmax(int x) {
return {x, x};
}
const std::pair<const int&, const int&> minmax2(int x) {
return std::minmax(x, x);
}
--------------
More information about the Gcc-bugs
mailing list