https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98683
--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> --- Maybe TARGET_CANONICALIZE_COMPARISON would help here? x86 had a similar issue with ficom x87 insn where float RTX was always the first operand, but the compare was with the float extend of the second one.