https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82692
--- Comment #13 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Segher Boessenkool from comment #12) > But why only do this for FLOAT_MODE_P? Either the logic here isn't > correct, or cc_modes_compatible isn't the correct hook (we'll need > a new hook then?), or determining ordered/unordered by CC mode does > not work (does not fit into how RTL works). Non-FP compares can select different mode depending on their operands (e.g. CCmode to CCZmode when one operand is zero) without secondary effects. But when reversing the condition from UNGE -> LT, SELECT_CC_MODE will return trapping mode (LT), whereas original, non-reversed mode (UNGE) was non-trapping. Please see how targets depend mode of their FP compares on the condition code. The solution here is to keep the original comparison mode for FP compares (as was proposed in the first version of the patch): when qNaN is encountered at this point, an exception has to be generated, no matter how the condition was changed.