aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog20
-rw-r--r--gcc/config/cris/cris.c16
-rw-r--r--gcc/config/cris/cris.h2
-rw-r--r--gcc/config/cris/cris.md99
4 files changed, 81 insertions, 56 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5c57777..2d5e777 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,23 @@
+2003-03-11 Hans-Peter Nilsson <hp@axis.com>
+
+ * config/cris/cris.md: Remove lingering EGCS reference.
+ ("*extopqihi_side_biap"): For HI operation, match
+ cris_additive_operand_extend_operator, not
+ cris_operand_extend_operator. Adjust condition.
+ ("*extopqihi_side", "*extopqihi"): Ditto.
+ ("*extopqisi_side_biap"): Correct operand numbers in condition.
+ ("*extophisi_side_biap", "*extopqisi_swap_side_biap"): Ditto.
+ ("*extophisi_swap_side_biap", "*extopqisi_swap"): Ditto.
+ ("*extophisi_swap"): Ditto.
+ ("*extopqihi_swap_side_biap"): For HI operation, match a simple
+ PLUS, not cris_operand_extend_operator. Adjust condition and
+ output template.
+ ("*extopqihi_swap_side", "*extopqihi_swap"): Ditto.
+ * config/cris/cris.h (PREDICATE_CODES): Add
+ cris_additive_operand_extend_operator.
+ * config/cris/cris.c (cris_additive_operand_extend_operator):
+ New predicate.
+
2003-03-11 Hartmut Penner <hpenner@de.ibm.com>
* df.c (read_modify_subreg_p): Change from static to global.
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 7e28e5b..ed3bc9e 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -337,6 +337,22 @@ cris_operand_extend_operator (x, mode)
&& (code == PLUS || code == MINUS || code == UMIN));
}
+/* Check if MODE is same as mode for X, and X is PLUS or MINUS. */
+
+int
+cris_additive_operand_extend_operator (x, mode)
+ rtx x;
+ enum machine_mode mode;
+{
+ enum rtx_code code = GET_CODE (x);
+
+ if (mode == VOIDmode)
+ mode = GET_MODE (x);
+
+ return (GET_MODE (x) == mode
+ && (code == PLUS || code == MINUS));
+}
+
/* Check to see if MODE is same as mode for X, and X is SIGN_EXTEND or
ZERO_EXTEND. */
diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h
index 13bff9c..98a27a64 100644
--- a/gcc/config/cris/cris.h
+++ b/gcc/config/cris/cris.h
@@ -1643,6 +1643,8 @@ call_ ## FUNC (void) \
{PLUS, IOR, AND, UMIN}}, \
{"cris_operand_extend_operator", \
{PLUS, MINUS, UMIN}}, \
+ {"cris_additive_operand_extend_operator", \
+ {PLUS, MINUS}}, \
{"cris_extend_operator", \
{ZERO_EXTEND, SIGN_EXTEND}}, \
{"cris_plus_or_bound_operator", \
diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md
index 1683192..2ec2502 100644
--- a/gcc/config/cris/cris.md
+++ b/gcc/config/cris/cris.md
@@ -1,5 +1,5 @@
;; GCC machine description for CRIS cpu cores.
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
;; Contributed by Axis Communications.
;; This file is part of GCC.
@@ -34,7 +34,7 @@
;; gcc-2.7.2 (and problably not on gcc-2.8.1), relating to that when a
;; constant is substituted into an operand, the actual mode must be
;; deduced from the pattern. There is reasonable hope that that has been
-;; fixed in egcs post 1.1.1, so FIXME: try again.
+;; fixed, so FIXME: try again.
;; You will notice that three-operand alternatives ("=r", "r", "!To")
;; are marked with a "!" constraint modifier to avoid being reloaded
@@ -1886,7 +1886,7 @@
(define_insn "*extopqihi_side_biap"
[(set (match_operand:HI 0 "register_operand" "=r,r")
(match_operator:HI
- 6 "cris_operand_extend_operator"
+ 6 "cris_additive_operand_extend_operator"
[(match_operand:HI 1 "register_operand" "0,0")
(match_operator:HI
7 "cris_extend_operator"
@@ -1898,8 +1898,7 @@
(plus:SI (mult:SI (match_dup 2)
(match_dup 3))
(match_dup 4)))]
- "(GET_CODE (operands[5]) != UMIN || GET_CODE (operands[7]) == ZERO_EXTEND)
- && cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
+ "cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
"@
#
%x6%e7.%m7 [%5=%4+%2%T3],%0")
@@ -1921,7 +1920,7 @@
(plus:SI (mult:SI (match_dup 2)
(match_dup 3))
(match_dup 4)))]
- "(GET_CODE (operands[5]) != UMIN || GET_CODE (operands[7]) == ZERO_EXTEND)
+ "(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[7]) == ZERO_EXTEND)
&& cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
"@
#
@@ -1944,7 +1943,7 @@
(plus:SI (mult:SI (match_dup 2)
(match_dup 3))
(match_dup 4)))]
- "(GET_CODE (operands[5]) != UMIN || GET_CODE (operands[7]) == ZERO_EXTEND)
+ "(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[7]) == ZERO_EXTEND)
&& cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
"@
#
@@ -1959,7 +1958,7 @@
(define_insn "*extopqihi_side"
[(set (match_operand:HI 0 "register_operand" "=r,r,r")
(match_operator:HI
- 5 "cris_operand_extend_operator"
+ 5 "cris_additive_operand_extend_operator"
[(match_operand:HI 1 "register_operand" "0,0,0")
(match_operator:HI
6 "cris_extend_operator"
@@ -1970,8 +1969,7 @@
(set (match_operand:SI 4 "register_operand" "=*2,r,r")
(plus:SI (match_dup 2)
(match_dup 3)))]
- "(GET_CODE (operands[5]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
- && cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
+ "cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
"*
{
if (which_alternative == 0
@@ -2053,28 +2051,25 @@
;; QImode to HImode
;; FIXME: GCC should widen.
-;; FIXME: These could have anonymous mode for operand 0.
(define_insn "*extopqihi_swap_side_biap"
[(set (match_operand:HI 0 "register_operand" "=r,r")
- (match_operator:HI
- 7 "cris_plus_or_bound_operator"
- [(match_operator:HI
- 6 "cris_extend_operator"
- [(mem:QI (plus:SI
- (mult:SI (match_operand:SI 2 "register_operand" "r,r")
- (match_operand:SI 3 "const_int_operand" "n,n"))
- (match_operand:SI 4 "register_operand" "r,r")))])
- (match_operand:HI 1 "register_operand" "0,0")]))
+ (plus:HI
+ (match_operator:HI
+ 6 "cris_extend_operator"
+ [(mem:QI (plus:SI
+ (mult:SI (match_operand:SI 2 "register_operand" "r,r")
+ (match_operand:SI 3 "const_int_operand" "n,n"))
+ (match_operand:SI 4 "register_operand" "r,r")))])
+ (match_operand:HI 1 "register_operand" "0,0")))
(set (match_operand:SI 5 "register_operand" "=*4,r")
(plus:SI (mult:SI (match_dup 2)
(match_dup 3))
(match_dup 4)))]
- "(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
- && cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
+ "cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
"@
#
- %x7%e6.%m6 [%5=%4+%2%T3],%0")
+ add%e6.b [%5=%4+%2%T3],%0")
;; QImode to SImode
@@ -2093,7 +2088,7 @@
(plus:SI (mult:SI (match_dup 2)
(match_dup 3))
(match_dup 4)))]
- "(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
+ "(GET_CODE (operands[7]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
&& cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
"@
#
@@ -2115,7 +2110,7 @@
(plus:SI (mult:SI (match_dup 2)
(match_dup 3))
(match_dup 4)))]
- "(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
+ "(GET_CODE (operands[7]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
&& cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
"@
#
@@ -2129,19 +2124,17 @@
(define_insn "*extopqihi_swap_side"
[(set (match_operand:HI 0 "register_operand" "=r,r,r")
- (match_operator:HI
- 6 "cris_plus_or_bound_operator"
- [(match_operator:HI
- 5 "cris_extend_operator"
- [(mem:QI (plus:SI
- (match_operand:SI 2 "cris_bdap_operand" "%r,r,r")
- (match_operand:SI 3 "cris_bdap_operand" "r>Ri,r,>Ri")))])
- (match_operand:HI 1 "register_operand" "0,0,0")]))
+ (plus:HI
+ (match_operator:HI
+ 5 "cris_extend_operator"
+ [(mem:QI (plus:SI
+ (match_operand:SI 2 "cris_bdap_operand" "%r,r,r")
+ (match_operand:SI 3 "cris_bdap_operand" "r>Ri,r,>Ri")))])
+ (match_operand:HI 1 "register_operand" "0,0,0")))
(set (match_operand:SI 4 "register_operand" "=*2,r,r")
(plus:SI (match_dup 2)
(match_dup 3)))]
- "(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[5]) == ZERO_EXTEND)
- && cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
+ "cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
"*
{
if (which_alternative == 0
@@ -2151,7 +2144,7 @@
|| CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'N')
|| CONST_OK_FOR_LETTER_P (INTVAL (operands[3]), 'J')))
return \"#\";
- return \"%x6%e5.%m5 [%4=%2%S3],%0\";
+ return \"add%e5.b [%4=%2%S3],%0\";
}")
;; QImode to SImode
@@ -2221,13 +2214,12 @@
(define_insn "*extopqihi"
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
(match_operator:HI
- 3 "cris_operand_extend_operator"
+ 3 "cris_additive_operand_extend_operator"
[(match_operand:HI 1 "register_operand" "0,0,0,r")
(match_operator:HI
4 "cris_extend_operator"
[(match_operand:QI 2 "nonimmediate_operand" "r,Q>,m,!To")])]))]
- "(GET_CODE (operands[3]) != UMIN || GET_CODE (operands[4]) == ZERO_EXTEND)
- && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
+ "GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
&& (operands[1] != frame_pointer_rtx || GET_CODE (operands[3]) != PLUS)"
"@
%x3%e4.%m4 %2,%0
@@ -2285,20 +2277,17 @@
(define_insn "*extopqihi_swap"
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
- (match_operator:HI
- 4 "cris_plus_or_bound_operator"
- [(match_operator:HI
- 3 "cris_extend_operator"
- [(match_operand:QI 2 "nonimmediate_operand" "r,Q>,m,!To")])
- (match_operand:HI 1 "register_operand" "0,0,0,r")]))]
- "(GET_CODE (operands[3]) != UMIN || GET_CODE (operands[4]) == ZERO_EXTEND)
- && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
- && operands[1] != frame_pointer_rtx"
+ (plus:HI
+ (match_operator:HI
+ 3 "cris_extend_operator"
+ [(match_operand:QI 2 "nonimmediate_operand" "r,Q>,m,!To")])
+ (match_operand:HI 1 "register_operand" "0,0,0,r")))]
+ "operands[1] != frame_pointer_rtx"
"@
- %x4%e3.%m3 %2,%0
- %x4%e3.%m3 %2,%0
- %x4%e3.%m3 %2,%0
- %x4%e3.%m3 %2,%1,%0"
+ add%e3.b %2,%0
+ add%e3.b %2,%0
+ add%e3.b %2,%0
+ add%e3.b %2,%1,%0"
[(set_attr "slottable" "yes,yes,no,no")
(set_attr "cc" "clobber")])
@@ -2312,8 +2301,7 @@
3 "cris_extend_operator"
[(match_operand:QI 2 "nonimmediate_operand" "r,Q>,m,!To")])
(match_operand:SI 1 "register_operand" "0,0,0,r")]))]
- "(GET_CODE (operands[3]) != UMIN || GET_CODE (operands[4]) == ZERO_EXTEND)
- && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
+ "(GET_CODE (operands[4]) != UMIN || GET_CODE (operands[3]) == ZERO_EXTEND)
&& operands[1] != frame_pointer_rtx"
"@
%x4%e3.%m3 %2,%0
@@ -2332,8 +2320,7 @@
3 "cris_extend_operator"
[(match_operand:HI 2 "nonimmediate_operand" "r,Q>,m,!To")])
(match_operand:SI 1 "register_operand" "0,0,0,r")]))]
- "(GET_CODE (operands[3]) != UMIN || GET_CODE (operands[4]) == ZERO_EXTEND)
- && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
+ "(GET_CODE (operands[4]) != UMIN || GET_CODE (operands[3]) == ZERO_EXTEND)
&& operands[1] != frame_pointer_rtx"
"@
%x4%e3.%m3 %2,%0