aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/stormy16
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2009-05-12 09:43:48 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2009-05-12 09:43:48 +0000
commitf90b7a5a7913cc7239cce42f6ca328b9a741b387 (patch)
tree06c940a96a184a178bfadd53e04213225655a68d /gcc/config/stormy16
parentb7a0af68063c79655c561750e9863799bf846cae (diff)
downloadgcc-f90b7a5a7913cc7239cce42f6ca328b9a741b387.zip
gcc-f90b7a5a7913cc7239cce42f6ca328b9a741b387.tar.gz
gcc-f90b7a5a7913cc7239cce42f6ca328b9a741b387.tar.bz2
Merge cond-optab branch.
From-SVN: r147425
Diffstat (limited to 'gcc/config/stormy16')
-rw-r--r--gcc/config/stormy16/stormy16-protos.h2
-rw-r--r--gcc/config/stormy16/stormy16.c34
-rw-r--r--gcc/config/stormy16/stormy16.h7
-rw-r--r--gcc/config/stormy16/stormy16.md105
4 files changed, 41 insertions, 107 deletions
diff --git a/gcc/config/stormy16/stormy16-protos.h b/gcc/config/stormy16/stormy16-protos.h
index 58cff8a..bde411b 100644
--- a/gcc/config/stormy16/stormy16-protos.h
+++ b/gcc/config/stormy16/stormy16-protos.h
@@ -48,7 +48,7 @@ extern rtx xstormy16_function_value (const_tree, const_tree);
#endif
#ifdef RTX_CODE
-extern void xstormy16_emit_cbranch (enum rtx_code, rtx);
+extern void xstormy16_emit_cbranch (enum rtx_code, rtx, rtx, rtx);
extern char *xstormy16_output_cbranch_hi (rtx, const char *, int, rtx);
extern char *xstormy16_output_cbranch_si (rtx, const char *, int, rtx);
extern int xstormy16_mode_dependent_address_p (rtx);
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index eefc58f..4d04cae 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -61,11 +61,6 @@ static bool xstormy16_rtx_costs (rtx, int, int, int *, bool);
static int xstormy16_address_cost (rtx, bool);
static bool xstormy16_return_in_memory (const_tree, const_tree);
-/* Define the information needed to generate branch and scc insns. This is
- stored from the compare operation. */
-struct rtx_def * xstormy16_compare_op0;
-struct rtx_def * xstormy16_compare_op1;
-
static GTY(()) section *bss100_section;
/* Compute a (partial) cost for rtx X. Return true if the complete
@@ -139,10 +134,8 @@ xstormy16_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
/* Emit a branch of kind CODE to location LOC. */
void
-xstormy16_emit_cbranch (enum rtx_code code, rtx loc)
+xstormy16_emit_cbranch (enum rtx_code code, rtx op0, rtx op1, rtx loc)
{
- rtx op0 = xstormy16_compare_op0;
- rtx op1 = xstormy16_compare_op1;
rtx condition_rtx, loc_ref, branch, cy_clobber;
rtvec vec;
enum machine_mode mode;
@@ -159,10 +152,10 @@ xstormy16_emit_cbranch (enum rtx_code code, rtx loc)
if (gt_p)
lab = gen_label_rtx ();
- xstormy16_emit_cbranch (unsigned_p ? LTU : LT, gt_p ? lab : loc);
+ xstormy16_emit_cbranch (unsigned_p ? LTU : LT, op0, op1, gt_p ? lab : loc);
/* This should be generated as a comparison against the temporary
created by the previous insn, but reload can't handle that. */
- xstormy16_emit_cbranch (gt_p ? NE : EQ, loc);
+ xstormy16_emit_cbranch (gt_p ? NE : EQ, op0, op1, loc);
if (gt_p)
emit_label (lab);
return;
@@ -171,6 +164,7 @@ xstormy16_emit_cbranch (enum rtx_code code, rtx loc)
&& (code == NE || code == EQ)
&& op1 != const0_rtx)
{
+ rtx op0_word, op1_word;
rtx lab = NULL_RTX;
int num_words = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
int i;
@@ -180,17 +174,17 @@ xstormy16_emit_cbranch (enum rtx_code code, rtx loc)
for (i = 0; i < num_words - 1; i++)
{
- xstormy16_compare_op0 = simplify_gen_subreg (word_mode, op0, mode,
- i * UNITS_PER_WORD);
- xstormy16_compare_op1 = simplify_gen_subreg (word_mode, op1, mode,
- i * UNITS_PER_WORD);
- xstormy16_emit_cbranch (NE, code == EQ ? lab : loc);
+ op0_word = simplify_gen_subreg (word_mode, op0, mode,
+ i * UNITS_PER_WORD);
+ op1_word = simplify_gen_subreg (word_mode, op1, mode,
+ i * UNITS_PER_WORD);
+ xstormy16_emit_cbranch (NE, op0_word, op1_word, code == EQ ? lab : loc);
}
- xstormy16_compare_op0 = simplify_gen_subreg (word_mode, op0, mode,
- i * UNITS_PER_WORD);
- xstormy16_compare_op1 = simplify_gen_subreg (word_mode, op1, mode,
- i * UNITS_PER_WORD);
- xstormy16_emit_cbranch (code, loc);
+ op0_word = simplify_gen_subreg (word_mode, op0, mode,
+ i * UNITS_PER_WORD);
+ op1_word = simplify_gen_subreg (word_mode, op1, mode,
+ i * UNITS_PER_WORD);
+ xstormy16_emit_cbranch (code, op0_word, op1_word, loc);
if (code == EQ)
emit_label (lab);
diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h
index 675b94d..d626edf 100644
--- a/gcc/config/stormy16/stormy16.h
+++ b/gcc/config/stormy16/stormy16.h
@@ -801,11 +801,4 @@ do { \
is responsible for updating the value of MORE (typically by (MORE)--). */
/* #define MD_SCHED_VARIABLE_ISSUE (FILE, VERBOSE, INSN, MORE) */
-
-/* Define the information needed to generate branch and scc insns. This is
- stored from the compare operation. Note that we can't use "rtx" here
- since it hasn't been defined! */
-
-extern struct rtx_def *xstormy16_compare_op0, *xstormy16_compare_op1;
-
/* End of xstormy16.h */
diff --git a/gcc/config/stormy16/stormy16.md b/gcc/config/stormy16/stormy16.md
index 43e4548..9c86d43 100644
--- a/gcc/config/stormy16/stormy16.md
+++ b/gcc/config/stormy16/stormy16.md
@@ -736,40 +736,7 @@
operands[0], operands[2], operands[3]);"
[(set_attr "length" "6,10")
(set_attr "psw_operand" "clobber,clobber")])
-
-;; ::::::::::::::::::::
-;; ::
-;; :: Comparisons
-;; ::
-;; ::::::::::::::::::::
-
-;; Note, we store the operands in the comparison insns, and use them later
-;; when generating the branch or scc operation.
-
-;; First the routines called by the machine independent part of the compiler
-(define_expand "cmphi"
- [(set (cc0)
- (compare (match_operand:HI 0 "register_operand" "")
- (match_operand:HI 1 "nonmemory_operand" "")))]
- ""
- {
- xstormy16_compare_op0 = operands[0];
- xstormy16_compare_op1 = operands[1];
- DONE;
- })
-; There are no real SImode comparisons, but some can be emulated
-; by performing a SImode subtract and looking at the condition flags.
-(define_expand "cmpsi"
- [(set (cc0)
- (compare (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "nonmemory_operand" "")))]
- ""
- {
- xstormy16_compare_op0 = operands[0];
- xstormy16_compare_op1 = operands[1];
- DONE;
- })
;; ::::::::::::::::::::
;; ::
@@ -777,55 +744,35 @@
;; ::
;; ::::::::::::::::::::
-(define_expand "beq"
- [(use (match_operand 0 "" ""))]
- ""
- { xstormy16_emit_cbranch (EQ, operands[0]); DONE; })
-
-(define_expand "bne"
- [(use (match_operand 0 "" ""))]
- ""
- { xstormy16_emit_cbranch (NE, operands[0]); DONE; })
-
-(define_expand "bge"
- [(use (match_operand 0 "" ""))]
- ""
- { xstormy16_emit_cbranch (GE, operands[0]); DONE; })
-
-(define_expand "bgt"
- [(use (match_operand 0 "" ""))]
- ""
- { xstormy16_emit_cbranch (GT, operands[0]); DONE; })
-
-(define_expand "ble"
- [(use (match_operand 0 "" ""))]
- ""
- { xstormy16_emit_cbranch (LE, operands[0]); DONE; })
-
-(define_expand "blt"
- [(use (match_operand 0 "" ""))]
- ""
- { xstormy16_emit_cbranch (LT, operands[0]); DONE; })
-
-(define_expand "bgeu"
- [(use (match_operand 0 "" ""))]
- ""
- { xstormy16_emit_cbranch (GEU, operands[0]); DONE; })
-
-(define_expand "bgtu"
- [(use (match_operand 0 "" ""))]
- ""
- { xstormy16_emit_cbranch (GTU, operands[0]); DONE; })
-
-(define_expand "bleu"
- [(use (match_operand 0 "" ""))]
+(define_expand "cbranchhi4"
+ [(set (pc)
+ (if_then_else (match_operator 0 "comparison_operator"
+ [(match_operand:HI 1 "register_operand" "")
+ (match_operand:HI 2 "nonmemory_operand" "")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY_REG))]
""
- { xstormy16_emit_cbranch (LEU, operands[0]); DONE; })
+ {
+ xstormy16_emit_cbranch (GET_CODE (operands[0]), operands[1], operands[2],
+ operands[3]);
+ DONE;
+})
-(define_expand "bltu"
- [(use (match_operand 0 "" ""))]
+(define_expand "cbranchsi4"
+ [(set (pc)
+ (if_then_else (match_operator 0 "comparison_operator"
+ [(match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "nonmemory_operand" "")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY_REG))]
""
- { xstormy16_emit_cbranch (LTU, operands[0]); DONE; })
+ {
+ xstormy16_emit_cbranch (GET_CODE (operands[0]), operands[1], operands[2],
+ operands[3]);
+ DONE;
+})
(define_insn "cbranchhi"
[(set (pc)