https://gcc.gnu.org/g:61bb3adee51d749d131af5582c79d1c5a432eec9
commit 61bb3adee51d749d131af5582c79d1c5a432eec9 Author: Michael Meissner <meiss...@linux.ibm.com> Date: Thu May 22 15:49:49 2025 -0400 Update ChangeLog.* Diff: --- gcc/ChangeLog.bugs | 89 +++++++++++------------------------------------------- 1 file changed, 18 insertions(+), 71 deletions(-) diff --git a/gcc/ChangeLog.bugs b/gcc/ChangeLog.bugs index 0134634d76f9..f9eeb7439c96 100644 --- a/gcc/ChangeLog.bugs +++ b/gcc/ChangeLog.bugs @@ -1,4 +1,4 @@ -==================== Branch work206-bugs, patch #112 ==================== +==================== Branch work206-bugs, patch #113 ==================== Fix PR 118541, do not generate unordered fp cmoves for IEEE compares. @@ -35,87 +35,34 @@ GCC currently generates the following code: This is because ifcvt.c optimizes the conditional floating point move to use the XSCMPGTDP instruction. -However, the XSCMPGTDP instruction will generate an interrupt if one of the -arguments is a signalling NaN and signalling NaNs can generate an interrupt. -The IEEE comparison functions (isgreater, etc.) require that the comparison not -raise an interrupt. +However, the XSCMPGTDP instruction traps if one of the arguments is a signaling +NaN. This patch disables generating XSCMP{EQ,GT,GE}{DP,QP} instructions unless +-ffinite-math-only is in effect so that we do not get a trap. -The root cause of this is we allow floating point comparisons to be reversed -(i.e. LT will be reversed to UNGE). Before power9, this was ok because we only -generated the FCMPU or XSCMPUDP instructions. - -But with power9, we can generate the XSCMPEQDP, XSCMPGTDP, or XSCMPGEDP -instructions. This code now does not convert an unordered compare into an -ordered compare. Instead, it does the opposite comparison and swaps the -arguments. I.e. it converts: - - r = (a < b) ? c : d; - -into: - - r = (b >= a) ? c : d; - -For the following code: - - double - ordered_compare (double a, double b, double c, double d) - { - return __builtin_isgreater (a, b) ? c : d; - } - - /* Verify normal > does generate xscmpgtdp. */ - - double - normal_compare (double a, double b, double c, double d) - { - return a > b ? c : d; - } - -with the following patch, GCC generates the following for power9, power10, and -power11: - - ordered_compare: - fcmpu 0,1,2 - fmr 1,4 - bnglr 0 - fmr 1,3 - blr - - normal_compare: - xscmpgtdp 1,1,2 - xxsel 1,4,3,1 - blr - -I have built bootstrap compilers on big endian power9 systems and little endian -power9/power10 systems and there were no regressions. Can I check this patch -into the GCC trunk, and after a waiting period, can I check this into the active -older branches? - -2025-05-21 Michael Meissner <meiss...@linux.ibm.com> +2025-05-22 Michael Meissner <meiss...@linux.ibm.com> gcc/ PR target/118541 - * config/rs6000/predicates.md (invert_fpmask_comparison_operator): - Delete. - (fpmask_reverse_args_comparison_operator): New predicate. - * config/rs6000/rs6000-proto.h (rs6000_fpmask_reverse_args): New - declaration. - * config/rs6000/rs6000.cc (rs6000_fpmask_reverse_args): New function. - * config/rs6000/rs6000.h (REVERSIBLE_CC_MODE): Do not allow floating - point comparisons to be reversed unless -ffinite-math-only is used. - * config/rs6000/rs6000.md (mov<SFDF:mode><SFDF2:mode>cc_p9): Add - comment. - (mov<SFDF:mode><SFDF2:mode>cc_invert_p9): Reverse the argument order for - the comparison, and use an unordered comparison, instead of ordered - comparison. + * config/rs6000/rs6000.md (mov<SFDF:mode><SFDF2:mode>cc_p9): Disable + generating XSCMP{EQ,GT,GE}{DP,QP} unless -ffinite-math-only is in + effect. + (mov<SFDF:mode><SFDF2:mode>cc_invert_p9): Likewise. + (fpmask<mode>, SFDF iterator): Likewise. + (xxsel<mode>, SFDF iterator): Likewise. + (mov<mode>cc, IEEE128 iterator): Likewise. + (mov<mode>cc_p10): Likewise. (mov<mode>cc_invert_p10): Likewise. + (fpmask<mode>, IEEE128 iterator): Likewise. + (xxsel<mode>, IEEE128 iterator): Likewise. gcc/testsuite/ PR target/118541 - * gcc.target/powerpc/pr118541.c: New test. + * gcc.target/powerpc/float128-cmove.c: Change optimization flag to + -Ofast instead of -O2. +==================== Branch work206-bugs, patch #112 was reverted ==================== ==================== Branch work206-bugs, patch #111 was reverted ==================== ==================== Branch work206-bugs, patch #110 was reverted ====================