https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59739
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- >From PR 108635 (via PR 45115), a C++20 testcase where we should be able to optimize into one call of `operator<=>`: #include <compare> struct S { std::weak_ordering operator<=>(const S&) const __attribute__((const)); }; int compare3way(S& a, S& b) { return (a < b) ? -1 : (a > b) ? 1 : 0; }