https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91323
Uroš Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |joseph at codesourcery dot com, | |rguenth at gcc dot gnu.org --- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Ilya Leoshkevich from comment #0) > I'm implementing signaling comparisons on S/390 and I'm trying to figure out > whether or not LTGT is supposed to be signaling. > I've decided to check what Intel does, and ran into what appears to be a bug. > > Consider the following functions: > > int f1(float a, float b) { return a < b || a > b; } > int f2(float a, float b) { return __builtin_isless(a, b) || > __builtin_isgreater(a, b); } > int f3(float a, float b) { return __builtin_islessgreater(a, b); } > > gcc creates LTGT rtx for f1 and UNEQ for f2 and f3. > However, for all 3 variants it then emits UCOMISS instruction. > I would expect f1 to be compiled to COMISS, since I believe that comparison > operators in C are supposed to be signaling. Based on the above observation, LTGT should trap, since either LT or GT traps. It also means that __builtin_islessgreater is confusingly named.