https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122286
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
```
__attribute__((optimize("-ffinite-math-only","-fno-signaling-nans",
"-fno-trapping-math")))
int cmp_double_asc(double a, double b) {
return (a < b) ? -1 : (a > b ? 1 : 0);
}
int cmp_double_asc_2(double a, double b) {
return (a < b) ? -1 : (a > b ? 1 : 0);
}
__attribute__((optimize("-ffinite-math-only","-fno-signaling-nans",
"-fno-trapping-math")))
int cmp_double_asc_branchless(double a, double b) {
return (a < b) - (a > b);
}
```