aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2003-03-25 01:17:01 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2003-03-25 01:17:01 +0000
commitbeb14cfeb60559d0c87b64511048334aa4053354 (patch)
tree2ae15a892c37f2683fc8985550ed51c6a8b724bc
parent9469fe1512e7a4e7ef5f8ff07fb3e9829453e1b5 (diff)
downloadgcc-beb14cfeb60559d0c87b64511048334aa4053354.zip
gcc-beb14cfeb60559d0c87b64511048334aa4053354.tar.gz
gcc-beb14cfeb60559d0c87b64511048334aa4053354.tar.bz2
h8300.md (a peephole2): Extend to support loads in QImode and HImode.
* config/h8300/h8300.md (a peephole2): Extend to support loads in QImode and HImode. From-SVN: r64836
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/h8300/h8300.md50
2 files changed, 39 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2dca24b..7c6d4ee 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-24 Kazu Hirata <kazu@cs.umass.edu>
+
+ * config/h8300/h8300.md (a peephole2): Extend to support loads
+ in QImode and HImode.
+
2003-03-24 Stephane Carrez <stcarrez@nerim.fr>
* config/m68hc11/t-m68hc11-gas (LIB1ASMFUNCS): Add _call_far and
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index 43bca10..b9a6094 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -3775,6 +3775,17 @@
? gen_rtx_GE (VOIDmode, cc0_rtx, const0_rtx)
: gen_rtx_LT (VOIDmode, cc0_rtx, const0_rtx));")
+;; The next three peephole2's will try to transform
+;;
+;; mov.b A,r0l (or mov.l A,er0)
+;; and.l #CST,er0
+;;
+;; into
+;;
+;; sub.l er0
+;; mov.b A,r0l
+;; and.b #CST,r0l (if CST is not 255)
+
(define_peephole2
[(set (match_operand:QI 0 "register_operand" "")
(match_operand:QI 1 "general_operand" ""))
@@ -3807,24 +3818,31 @@
operands[3] = gen_lowpart (QImode, operands[1]);")
(define_peephole2
- [(set (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "general_operand" ""))
- (set (match_dup 0)
- (and:SI (match_dup 0)
- (match_operand:SI 2 "const_int_qi_operand" "")))]
+ [(set (match_operand 0 "register_operand" "")
+ (match_operand 1 "general_operand" ""))
+ (set (match_operand:SI 2 "register_operand" "")
+ (and:SI (match_dup 2)
+ (match_operand:SI 3 "const_int_qi_operand" "")))]
"(TARGET_H8300H || TARGET_H8300S)
- && !reg_overlap_mentioned_p (operands[0], operands[1])
- && !(GET_CODE (operands[1]) == MEM && MEM_VOLATILE_P (operands[1]))"
- [(set (match_dup 0)
+ && (GET_MODE (operands[0]) == QImode
+ || GET_MODE (operands[0]) == HImode
+ || GET_MODE (operands[0]) == SImode)
+ && GET_MODE (operands[0]) == GET_MODE (operands[1])
+ && REGNO (operands[0]) == REGNO (operands[2])
+ && !reg_overlap_mentioned_p (operands[2], operands[1])
+ && !(GET_MODE (operands[1]) != QImode
+ && GET_CODE (operands[1]) == MEM
+ && MEM_VOLATILE_P (operands[1]))"
+ [(set (match_dup 2)
(const_int 0))
- (set (strict_low_part (match_dup 3))
- (match_dup 4))
- (set (match_dup 0)
- (and:SI (match_dup 0)
- (match_dup 5)))]
- "operands[3] = gen_lowpart (QImode, operands[0]);
- operands[4] = gen_lowpart (QImode, operands[1]);
- operands[5] = GEN_INT (~0xff | INTVAL (operands[2]));")
+ (set (strict_low_part (match_dup 4))
+ (match_dup 5))
+ (set (match_dup 2)
+ (and:SI (match_dup 2)
+ (match_dup 6)))]
+ "operands[4] = gen_lowpart (QImode, operands[0]);
+ operands[5] = gen_lowpart (QImode, operands[1]);
+ operands[6] = GEN_INT (~0xff | INTVAL (operands[3]));")
(define_peephole2
[(set (match_operand:SI 0 "register_operand" "")