diff mbox series

[2/2] VAX: Unify push operation selection

Message ID alpine.LFD.2.21.2012111631470.2104409@eddie.linux-mips.org
State Accepted
Headers show
Series VAX: Push operation fixes | expand

Commit Message

Maciej W. Rozycki Dec. 12, 2020, 12:05 p.m. UTC
Avoid the possibility of code discrepancies like one fixed with the 
previous change and improve the structure of code by selecting between 
push and non-push operations in a single place in `vax_output_int_move'.

The PUSHAB/MOVAB address moves are never actually produced from this 
code as the SImode invocation of this function is guarded with the 
`nonsymbolic_operand' predicate, but let's not mess up with this code 
too much on this occasion and keep the piece in place.

	* config/vax/vax.c (vax_output_int_move): Unify push operation 
	selection.
---
 gcc/config/vax/vax.c |   19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

gcc-vax-int-move-push-p.diff

Comments

Jeff Law Dec. 13, 2020, 4:35 p.m. UTC | #1
On 12/12/20 5:05 AM, Maciej W. Rozycki wrote:
> Avoid the possibility of code discrepancies like one fixed with the 
> previous change and improve the structure of code by selecting between 
> push and non-push operations in a single place in `vax_output_int_move'.
>
> The PUSHAB/MOVAB address moves are never actually produced from this 
> code as the SImode invocation of this function is guarded with the 
> `nonsymbolic_operand' predicate, but let's not mess up with this code 
> too much on this occasion and keep the piece in place.
>
> 	* config/vax/vax.c (vax_output_int_move): Unify push operation 
> 	selection.
OK
Jeff
diff mbox series

Patch

Index: gcc/gcc/config/vax/vax.c
===================================================================
--- gcc.orig/gcc/config/vax/vax.c
+++ gcc/gcc/config/vax/vax.c
@@ -1235,6 +1235,7 @@  vax_output_int_move (rtx insn ATTRIBUTE_
 {
   rtx hi[3], lo[3];
   const char *pattern_hi, *pattern_lo;
+  bool push_p;
 
   switch (mode)
     {
@@ -1345,19 +1346,13 @@  vax_output_int_move (rtx insn ATTRIBUTE_
       return "movq %1,%0";
 
     case E_SImode:
+      push_p = push_operand (operands[0], SImode);
+
       if (symbolic_operand (operands[1], SImode))
-	{
-	  if (push_operand (operands[0], SImode))
-	    return "pushab %a1";
-	  return "movab %a1,%0";
-	}
+	return push_p ? "pushab %a1" : "movab %a1,%0";
 
       if (operands[1] == const0_rtx)
-	{
-	  if (push_operand (operands[0], SImode))
-	    return "pushl %1";
-	  return "clrl %0";
-	}
+	return push_p ? "pushl %1" : "clrl %0";
 
       if (CONST_INT_P (operands[1])
 	  && (unsigned HOST_WIDE_INT) INTVAL (operands[1]) >= 64)
@@ -1383,9 +1378,7 @@  vax_output_int_move (rtx insn ATTRIBUTE_
 	  if (i >= -0x8000 && i < 0)
 	    return "cvtwl %1,%0";
 	}
-      if (push_operand (operands[0], SImode))
-	return "pushl %1";
-      return "movl %1,%0";
+      return push_p ? "pushl %1" : "movl %1,%0";
 
     case E_HImode:
       if (CONST_INT_P (operands[1]))