[v1] rtl: builtins: Fix builtins feclearexcept and feraiseexcept operand check [PR94193]

Message ID 20220126150554.ksua3vlbqv6ficsg@workbox
State Committed
Commit 8bcf835e0a4e3334e1c60f314ae6917ba648bdde
Headers
Series [v1] rtl: builtins: Fix builtins feclearexcept and feraiseexcept operand check [PR94193] |

Commit Message

Raoni Fassina Firmino Jan. 26, 2022, 3:05 p.m. UTC
  Tested on top of master (e0b8716f53ed6455e9f18931940141692793068d)
using --enable-checking=yes,rtl, on the following plataforms with no
regression:
  - powerpc64le-linux-gnu (Power 9)
  - powerpc64le-linux-gnu (Power 8)
  - powerpc64-linux-gnu (Power 9, with 32 and 64 bits tests)

I did not include a testcase because I could not figure out one that
works without --enable-checking=rtl yet.

---- 8< ----

Commit 4343f5e25679 ("rtl: builtins: (not just) rs6000: Add builtins
for fegetround, feclearexcept and feraiseexcept [PR94193]") broke gcc
bootstra when building with --enable-checking=rtl[1].

The function expand_builtin_feclear_feraise_except was failing to
proper validate op0 predicate before emit_insn leading to the mismatch
type failure.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2022-January/589186.html

2022-01-26  Raoni Fassina Firmino  <raoni@linux.ibm.com>

gcc/
	PR target/94193
	* builtins.cc (expand_builtin_feclear_feraise_except): Add op0
	predicate check.

Signed-off-by: Raoni Fassina Firmino <raoni@linux.ibm.com>
---
 gcc/builtins.cc | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Segher Boessenkool Jan. 26, 2022, 3:33 p.m. UTC | #1
On Wed, Jan 26, 2022 at 12:05:54PM -0300, Raoni Fassina Firmino wrote:
> Commit 4343f5e25679 ("rtl: builtins: (not just) rs6000: Add builtins
> for fegetround, feclearexcept and feraiseexcept [PR94193]") broke gcc
> bootstra when building with --enable-checking=rtl[1].
> 
> The function expand_builtin_feclear_feraise_except was failing to
> proper validate op0 predicate before emit_insn leading to the mismatch
> type failure.

> gcc/
> 	PR target/94193
> 	* builtins.cc (expand_builtin_feclear_feraise_except): Add op0
> 	predicate check.

Perfect, and pushed.  Thank you!


Segher
  

Patch

diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index e84208035dab..d784a57c2b81 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -2598,6 +2598,9 @@  expand_builtin_feclear_feraise_except (tree exp, rtx target,
   if (icode == CODE_FOR_nothing)
     return NULL_RTX;
 
+  if (!(*insn_data[icode].operand[1].predicate) (op0, GET_MODE (op0)))
+    return NULL_RTX;
+
   if (target == 0
       || GET_MODE (target) != target_mode
       || !(*insn_data[icode].operand[0].predicate) (target, target_mode))