public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] middle-end: Call negate_rtx instead of simplify_gen_unary expanding rotate shift [PR113033]
@ 2023-12-18 13:42 Xi Ruoyao
  2023-12-18 15:39 ` Jeff Law
  0 siblings, 1 reply; 7+ messages in thread
From: Xi Ruoyao @ 2023-12-18 13:42 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek, chenglulu, i, xuchenghua, c, Xi Ruoyao

With simplify_gen_unary we end up with a not fully expanded RTX like

    (set (reg:SI 90) (and:SI (neg:SI (reg:SI 80)) (const_int 63)))

Then it will cause an ICE with unrecognizable insn.

gcc/ChangeLog:

	PR middle-end/113033
	* expmed.cc (expand_shift_1): When expanding rotate shift, call
	negate_rtx instead of simplify_gen_unary (NEG, ...).
---

Bootstrapped and regtested on x86_64-linux-gnu and
loongarch64-linux-gnu.  Ok for trunk?

 gcc/expmed.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/expmed.cc b/gcc/expmed.cc
index 05331dd5d82..f9e416b9549 100644
--- a/gcc/expmed.cc
+++ b/gcc/expmed.cc
@@ -2634,9 +2634,7 @@ expand_shift_1 (enum tree_code code, machine_mode mode, rtx shifted,
 		  (mode, GET_MODE_BITSIZE (scalar_mode) - INTVAL (op1));
 	      else
 		{
-		  other_amount
-		    = simplify_gen_unary (NEG, GET_MODE (op1),
-					  op1, GET_MODE (op1));
+		  other_amount = negate_rtx (GET_MODE (op1), op1);
 		  HOST_WIDE_INT mask = GET_MODE_PRECISION (scalar_mode) - 1;
 		  other_amount
 		    = simplify_gen_binary (AND, GET_MODE (op1), other_amount,
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-18 20:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-18 13:42 [PATCH] middle-end: Call negate_rtx instead of simplify_gen_unary expanding rotate shift [PR113033] Xi Ruoyao
2023-12-18 15:39 ` Jeff Law
2023-12-18 16:48   ` Xi Ruoyao
2023-12-18 17:45     ` Jakub Jelinek
2023-12-18 20:01       ` Xi Ruoyao
2023-12-18 20:15         ` Jakub Jelinek
2023-12-18 20:18           ` Xi Ruoyao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).