https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77928
Bug ID: 77928 Summary: Add __builtin_iseqsig Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: jsm28 at gcc dot gnu.org Target Milestone: --- TS 18661-1 defines a type-generic floating-point comparison macro iseqsig, that compares its arguments for equality but generates the "invalid" exception (and sets errno) if either argument is NaN, unlike ==. GCC should have a corresponding __builtin_iseqsig that does the comparison and raises "invalid" as needed (but without setting errno, so it could only be used to implement the standard macro if -fno-math-errno). As with existing type-generic comparison functions the logic in fold_builtin_unordered_cmp is needed to convert the arguments to a common type. This operation is equivalent to (x <= y) && (x >= y) (with arguments only evaluated once, of course), though some architectures may have more efficient ways of doing such a comparison (and if the architecture lacks support for exceptions, simple == can be used). However, various architectures have bugs where the <= comparison fails to raise the exception it should for NaN arguments (bug 52451, bug 58684, bug 77918).