aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2004-02-18 22:12:59 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2004-02-18 22:12:59 +0000
commit8981ecd360e0980aa2f16fa37c4be9d9da1fff21 (patch)
treed4030985d9c2416412f28e8e10ee1ec46b9f3ab5
parent07ee3b586d70c3596f1cf284b7154024ed27aeb6 (diff)
downloadgcc-8981ecd360e0980aa2f16fa37c4be9d9da1fff21.zip
gcc-8981ecd360e0980aa2f16fa37c4be9d9da1fff21.tar.gz
gcc-8981ecd360e0980aa2f16fa37c4be9d9da1fff21.tar.bz2
h8300-protos.h: Add a prototype for h8300_expand_branch.
* config/h8300/h8300-protos.h: Add a prototype for h8300_expand_branch. * config/h8300/h8300.c (h8300_expand_branch): New. * config/h8300/h8300.md (ble, bleu, bge, bgeu, blt, bltu, bgt, bgtu, beq, bne): Call h8300_expand_branch(). From-SVN: r78052
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/h8300/h8300-protos.h1
-rw-r--r--gcc/config/h8300/h8300.c14
-rw-r--r--gcc/config/h8300/h8300.md80
4 files changed, 43 insertions, 60 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e0af65a..8face63 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2004-02-18 Kazu Hirata <kazu@cs.umass.edu>
+ * config/h8300/h8300-protos.h: Add a prototype for
+ h8300_expand_branch.
+ * config/h8300/h8300.c (h8300_expand_branch): New.
+ * config/h8300/h8300.md (ble, bleu, bge, bgeu, blt, bltu, bgt,
+ bgtu, beq, bne): Call h8300_expand_branch().
+
+2004-02-18 Kazu Hirata <kazu@cs.umass.edu>
+
* config/h8300/h8300-protos.h: Add prototypes for
h8300_hard_regno_nregs and h8300_hard_regno_mode_ok.
* config/h8300/h8300.c (h8300_hard_regno_nregs): New.
diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h
index 4f03f98..7ad2df8 100644
--- a/gcc/config/h8300/h8300-protos.h
+++ b/gcc/config/h8300/h8300-protos.h
@@ -45,6 +45,7 @@ extern const char *output_logical_op (enum machine_mode, rtx *);
extern unsigned int compute_logical_op_length (enum machine_mode,
rtx *);
extern int compute_logical_op_cc (enum machine_mode, rtx *);
+extern void h8300_expand_branch (enum rtx_code, rtx);
extern void expand_a_shift (enum machine_mode, int, rtx[]);
extern int h8300_shift_needs_scratch_p (int, enum machine_mode);
extern int expand_a_rotate (rtx[]);
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index b34ddd3..ad50955 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -2675,6 +2675,20 @@ compute_logical_op_cc (enum machine_mode mode, rtx *operands)
return cc;
}
+/* Expand a conditional branch. */
+
+void
+h8300_expand_branch (enum rtx_code code, rtx label)
+{
+ rtx tmp;
+
+ tmp = gen_rtx_fmt_ee (code, VOIDmode, cc0_rtx, const0_rtx);
+ tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp,
+ gen_rtx_LABEL_REF (VOIDmode, label),
+ pc_rtx);
+ emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp));
+}
+
/* Shifts.
We devote a fair bit of code to getting efficient shifts since we
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index dd77e327..25462cf 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -1566,94 +1566,54 @@
;; Conditional jump instructions
(define_expand "ble"
- [(set (pc)
- (if_then_else (le (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
+ [(match_operand 0 "" "")]
""
- "")
+ "h8300_expand_branch (LE, operands[0]); DONE;")
(define_expand "bleu"
- [(set (pc)
- (if_then_else (leu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
+ [(match_operand 0 "" "")]
""
- "")
+ "h8300_expand_branch (LEU, operands[0]); DONE;")
(define_expand "bge"
- [(set (pc)
- (if_then_else (ge (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
+ [(match_operand 0 "" "")]
""
- "")
+ "h8300_expand_branch (GE, operands[0]); DONE;")
(define_expand "bgeu"
- [(set (pc)
- (if_then_else (geu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
+ [(match_operand 0 "" "")]
""
- "")
+ "h8300_expand_branch (GEU, operands[0]); DONE;")
(define_expand "blt"
- [(set (pc)
- (if_then_else (lt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
+ [(match_operand 0 "" "")]
""
- "")
+ "h8300_expand_branch (LT, operands[0]); DONE;")
(define_expand "bltu"
- [(set (pc)
- (if_then_else (ltu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
+ [(match_operand 0 "" "")]
""
- "")
+ "h8300_expand_branch (LTU, operands[0]); DONE;")
(define_expand "bgt"
- [(set (pc)
- (if_then_else (gt (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
+ [(match_operand 0 "" "")]
""
- "")
+ "h8300_expand_branch (GT, operands[0]); DONE;")
(define_expand "bgtu"
- [(set (pc)
- (if_then_else (gtu (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
+ [(match_operand 0 "" "")]
""
- "")
+ "h8300_expand_branch (GTU, operands[0]); DONE;")
(define_expand "beq"
- [(set (pc)
- (if_then_else (eq (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
+ [(match_operand 0 "" "")]
""
- "")
+ "h8300_expand_branch (EQ, operands[0]); DONE;")
(define_expand "bne"
- [(set (pc)
- (if_then_else (ne (cc0)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
+ [(match_operand 0 "" "")]
""
- "")
+ "h8300_expand_branch (NE, operands[0]); DONE;")
(define_insn "branch_true"
[(set (pc)