diff mbox series

rs6000: Don't use operands[] for temporaries in define_expand

Message ID 2bf9d32c557d8ed305915c00c0850027dab2f640.1604706592.git.segher@kernel.crashing.org
State New
Headers show
Series rs6000: Don't use operands[] for temporaries in define_expand | expand

Commit Message

Segher Boessenkool Nov. 7, 2020, 12:02 a.m. UTC
In ac001f5ce604 Alan fixed my thinko using operands that do not refer
to anything mentioned in the RTL pattern.  Instead, it just uses fresh
new local rtxes for those.

This patch takes that a tiny bit further: it uses local rtx for all
temporaries used in the expanders.  As a bonus that simplifies the code
a tiny bit as well.


2020-11-06  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/rs6000/rs6000.md (@tablejump<mode>_normal): Don't abuse
	operands[].
	(@tablejump<mode>_nospec): Ditto.

---
 gcc/config/rs6000/rs6000.md | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index acbf130..5e5ad9f 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -12732,14 +12732,11 @@  (define_expand "@tablejump<mode>_normal"
    (use (match_operand:P 1))]
   "rs6000_speculate_indirect_jumps"
 {
-  rtx off;
-  operands[0] = force_reg (SImode, operands[0]);
-  if (<MODE>mode == SImode)
-    off = operands[0];
-  else
+  rtx off = force_reg (SImode, operands[0]);
+  if (<MODE>mode != SImode)
     {
+      rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, off);
       off = gen_reg_rtx (Pmode);
-      rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, operands[0]);
       emit_move_insn (off, src);
     }
 
@@ -12757,14 +12754,11 @@  (define_expand "@tablejump<mode>_nospec"
    (use (match_operand:CC 2))]
   "!rs6000_speculate_indirect_jumps"
 {
-  rtx off;
-  operands[0] = force_reg (SImode, operands[0]);
-  if (<MODE>mode == SImode)
-    off = operands[0];
-  else
+  rtx off = force_reg (SImode, operands[0]);
+  if (<MODE>mode != SImode)
     {
+      rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, off);
       off = gen_reg_rtx (Pmode);
-      rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, operands[0]);
       emit_move_insn (off, src);
     }