From 85bc031ea462f57640bea340e47fa495a429b686 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 15 Jan 1993 19:10:32 -0700 Subject: [PATCH] pa.h (LEGITIMIZE_ADDRESS): Handle (plus (mult (X) (Y)) (Z)) when Y is 2, 4, or 8 specially. * pa.h LEGITIMIZE_ADDRESS): Handle (plus (mult (X) (Y)) (Z)) when Y is 2, 4, or 8 specially. From-SVN: r3256 --- gcc/config/pa/pa.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 9fe8c4f036d..14257e50ebb 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1254,7 +1254,16 @@ extern union tree_node *current_function_decl; (In the rare case of an FP register used in an integer MODE, we depend on secondary reloads and the final output pass to clean things up.) - Also change REG+(X*Y) into REG. (With X*Y in an extra pseudo). */ + + It is also beneficial to handle (plus (mult (X) (Y)) (Z)) in a special + manner if Y is 2, 4, or 8. (allows more shadd insns and shifted indexed + adressing modes to be used). + + Put X and Z into registers. Then put the entire expression into + a register. + + Other REG+(X*Y) addresses are placed into a register with the + X*Y subexpression placed in a register of its own. */ #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \ { if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG \ @@ -1271,6 +1280,21 @@ extern union tree_node *current_function_decl; X = plus_constant (ptr_reg, offset & mask); \ goto WIN; \ } \ + if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT \ + && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \ + && shadd_constant_p (INTVAL (XEXP (XEXP (X, 0), 1)))) \ + { \ + int val = INTVAL (XEXP (XEXP (X, 0), 1)); \ + rtx reg1, reg2; \ + reg1 = force_reg (SImode, force_operand (XEXP (X, 1), 0));\ + reg2 = force_reg (SImode, \ + force_operand (XEXP (XEXP (X, 0), 0), 0));\ + (X) = force_reg (SImode, \ + gen_rtx (PLUS, SImode, \ + gen_rtx (MULT, SImode, reg2, \ + GEN_INT (val)), \ + reg1)); \ + } \ if (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == MULT) \ (X) = force_operand (gen_rtx (PLUS, SImode, XEXP (X, 1), \ force_operand (XEXP (X, 0), 0)), 0);\ -- 2.30.2