aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2002-06-28 23:16:58 +0200
committerStephane Carrez <ciceron@gcc.gnu.org>2002-06-28 23:16:58 +0200
commitae9bd4817709200fb28acc6812def80de28f5a2a (patch)
tree0e12e414ea04f37ee073eb449142ab8e89e77c4b
parent2fe938856a5d2213f00b1458899ac75f1b3f737f (diff)
downloadgcc-ae9bd4817709200fb28acc6812def80de28f5a2a.zip
gcc-ae9bd4817709200fb28acc6812def80de28f5a2a.tar.gz
gcc-ae9bd4817709200fb28acc6812def80de28f5a2a.tar.bz2
m68hc11.md ("*addsi3"): Use 'o' constraint to avoid the auto increment addressing modes.
* config/m68hc11/m68hc11.md ("*addsi3"): Use 'o' constraint to avoid the auto increment addressing modes. ("*subsi3"): Likewise. (split for add/sub on address): For 68HC12 push the value on the stack and do the operation with a pop. From-SVN: r55083
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/m68hc11/m68hc11.md55
2 files changed, 54 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1f8fbd5..033fc4b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2002-06-28 Stephane Carrez <stcarrez@nerim.fr>
+
+ * config/m68hc11/m68hc11.md ("*addsi3"): Use 'o' constraint to
+ avoid the auto increment addressing modes.
+ ("*subsi3"): Likewise.
+ (split for add/sub on address): For 68HC12 push the value on
+ the stack and do the operation with a pop.
+
2002-06-28 Neil Booth <neil@daikokuya.co.uk>
* cpplib.c (_cpp_handle_directive): Move #define-specific
diff --git a/gcc/config/m68hc11/m68hc11.md b/gcc/config/m68hc11/m68hc11.md
index 6cad951..ce32b53a 100644
--- a/gcc/config/m68hc11/m68hc11.md
+++ b/gcc/config/m68hc11/m68hc11.md
@@ -1,6 +1,6 @@
;;- Machine description file for Motorola 68HC11 and 68HC12.
;;- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-;;- Contributed by Stephane Carrez (stcarrez@worldnet.fr)
+;;- Contributed by Stephane Carrez (stcarrez@nerim.fr)
;; This file is part of GNU CC.
@@ -1900,9 +1900,9 @@
}")
(define_insn "*addsi3"
- [(set (match_operand:SI 0 "non_push_operand" "=m,D,!u,?D,D")
+ [(set (match_operand:SI 0 "non_push_operand" "=o,D,!u,?D,D")
(plus:SI (match_operand:SI 1 "non_push_operand" "%0,0,0,0,0")
- (match_operand:SI 2 "general_operand" "ML,i,ML,?D,?miu")))
+ (match_operand:SI 2 "general_operand" "ML,i,ML,?D,?oiu")))
(clobber (match_scratch:HI 3 "=d,X,d,X,X"))]
""
"*
@@ -2500,8 +2500,8 @@
(define_insn "*subsi3"
[(set (match_operand:SI 0 "register_operand" "=D,D,D,D,!u")
- (minus:SI (match_operand:SI 1 "general_operand" "0,mi,0,!u,0")
- (match_operand:SI 2 "general_operand" "mi,D,!u,D,!mui")))
+ (minus:SI (match_operand:SI 1 "general_operand" "0,oi,0,!u,0")
+ (match_operand:SI 2 "general_operand" "oi,D,!u,D,!oui")))
(clobber (match_scratch:HI 3 "=X,X,X,X,d"))]
""
"#")
@@ -3932,19 +3932,55 @@
|| (GET_CODE (operands[2]) == CONST_INT
&& INTVAL (operands[2]) >= -4
&& INTVAL (operands[2]) <= 4)))"
- [(set (match_dup 4) (match_dup 5))
+ [(set (match_dup 9) (match_dup 0))
+ (set (match_dup 4) (match_dup 5))
(set (match_dup 8) (match_dup 7))
+ (set (match_dup 0) (match_dup 1))
(parallel [(set (reg:HI D_REGNUM) (match_dup 0))
(set (match_dup 0) (reg:HI D_REGNUM))])
(set (reg:HI D_REGNUM) (match_op_dup 3 [(reg:HI D_REGNUM) (match_dup 6)]))
(parallel [(set (reg:HI D_REGNUM) (match_dup 0))
(set (match_dup 0) (reg:HI D_REGNUM))])]
"
+ operands[9] = operands[0];
+ /* For 68HC12, push the value on the stack and do the operation
+ with a pop. */
+ if (TARGET_M6812
+ && m68hc11_non_shift_operator (operands[3], HImode)
+ && (H_REG_P (operands[2])
+ || (m68hc11_small_indexed_indirect_p (operands[2], HImode)
+ && reg_mentioned_p (operands[0], operands[2]))))
+ {
+ operands[4] = gen_rtx (MEM, HImode,
+ gen_rtx (PRE_DEC, HImode,
+ gen_rtx (REG, HImode, HARD_SP_REGNUM)));
+ operands[6] = gen_rtx (MEM, HImode,
+ gen_rtx (POST_INC, HImode,
+ gen_rtx (REG, HImode, HARD_SP_REGNUM)));
+ operands[5] = operands[2];
+ operands[8] = operands[7] = operands[0];
+ }
/* Save the operand2 in a temporary location and use it. */
- if ((H_REG_P (operands[2])
- || reg_mentioned_p (operands[0], operands[2]))
- && !(SP_REG_P (operands[2]) && GET_CODE (operands[3]) == PLUS))
+ else if ((H_REG_P (operands[2])
+ || reg_mentioned_p (operands[0], operands[2]))
+ && !(SP_REG_P (operands[2]) && GET_CODE (operands[3]) == PLUS))
{
+ if (GET_CODE (operands[3]) == MINUS
+ && reg_mentioned_p (operands[0], operands[2]))
+ {
+ operands[9] = gen_rtx (MEM, HImode,
+ gen_rtx (PRE_DEC, HImode,
+ gen_rtx (REG, HImode, HARD_SP_REGNUM)));
+ operands[1] = gen_rtx (MEM, HImode,
+ gen_rtx (POST_INC, HImode,
+ gen_rtx (REG, HImode, HARD_SP_REGNUM)));
+ operands[8] = gen_rtx (REG, HImode, SOFT_TMP_REGNUM);
+ operands[4] = operands[7] = operands[0];
+ operands[6] = operands[8];
+ operands[5] = operands[2];
+ }
+ else
+ {
operands[4] = gen_rtx (REG, HImode, SOFT_TMP_REGNUM);
operands[6] = operands[4];
if (!H_REG_P (operands[2]))
@@ -3958,6 +3994,7 @@
operands[5] = operands[2];
operands[8] = operands[7] = operands[0];
}
+ }
}
else
{