This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[cond-optab] Convert fr30
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 26 Mar 2009 04:35:48 -0400
- Subject: [cond-optab] Convert fr30
This just replaces bCC patterns with a single cbranchsi4 pattern.
2009-03-23 Paolo Bonzini <bonzini@gnu.org>
* config/fr30/fr30.md (cmp<mode>, bCC): Delete.
(cbranchsi4): New.
* config/fr30/fr30.c (fr30_compare_op0, fr30_compare_op1): Delete
* config/fr30/fr30.h (fr30_compare_op0, fr30_compare_op1): Delete.
Index: gcc/config/fr30/fr30.c
===================================================================
--- gcc/config/fr30/fr30.c (branch cond-optab)
+++ gcc/config/fr30/fr30.c (working copy)
@@ -48,12 +48,6 @@
/*}}}*/
/*{{{ Function Prologues & Epilogues */
-/* Define the information needed to generate branch and scc insns. This is
- stored from the compare operation. */
-
-struct rtx_def * fr30_compare_op0;
-struct rtx_def * fr30_compare_op1;
-
/* The FR30 stack looks like this:
Before call After call
Index: gcc/config/fr30/fr30.h
===================================================================
--- gcc/config/fr30/fr30.h (branch cond-optab)
+++ gcc/config/fr30/fr30.h (working copy)
@@ -1119,16 +1119,6 @@ fprintf (STREAM, "\t.word .L%d\n", VALUE
#endif
/*}}}*/
-/*{{{ Exported variables */
-
-/* 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 * fr30_compare_op0;
-extern struct rtx_def * fr30_compare_op1;
-
-/*}}}*/
/* Local Variables: */
/* folded-file: t */
Index: gcc/config/fr30/fr30.md
===================================================================
--- gcc/config/fr30/fr30.md (branch cond-optab)
+++ gcc/config/fr30/fr30.md (working copy)
@@ -916,23 +916,7 @@
;;}}}
;;{{{ 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 "cmpsi"
- [(set (reg:CC 16)
- (compare:CC (match_operand:SI 0 "register_operand" "")
- (match_operand:SI 1 "nonmemory_operand" "")))]
- ""
- "{
- fr30_compare_op0 = operands[0];
- fr30_compare_op1 = operands[1];
- DONE;
- }"
-)
-
-;; Now, the actual comparisons, generated by the branch and/or scc operations
+;; The actual comparisons, generated by the cbranch and/or cstore expanders
(define_insn "*cmpsi_internal"
[(set (reg:CC 16)
@@ -951,165 +935,19 @@
;; Define_expands called by the machine independent part of the compiler
;; to allocate a new comparison register
-(define_expand "beq"
- [(set (reg:CC 16)
- (compare:CC (match_dup 1)
- (match_dup 2)))
- (set (pc)
- (if_then_else (eq:CC (reg:CC 16)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "{
- operands[1] = fr30_compare_op0;
- operands[2] = fr30_compare_op1;
- }"
-)
-
-(define_expand "bne"
- [(set (reg:CC 16)
- (compare:CC (match_dup 1)
- (match_dup 2)))
- (set (pc)
- (if_then_else (ne:CC (reg:CC 16)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "{
- operands[1] = fr30_compare_op0;
- operands[2] = fr30_compare_op1;
- }"
-)
-
-(define_expand "blt"
- [(set (reg:CC 16)
- (compare:CC (match_dup 1)
- (match_dup 2)))
- (set (pc)
- (if_then_else (lt:CC (reg:CC 16)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "{
- operands[1] = fr30_compare_op0;
- operands[2] = fr30_compare_op1;
- }"
-)
-
-(define_expand "ble"
- [(set (reg:CC 16)
- (compare:CC (match_dup 1)
- (match_dup 2)))
- (set (pc)
- (if_then_else (le:CC (reg:CC 16)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "{
- operands[1] = fr30_compare_op0;
- operands[2] = fr30_compare_op1;
- }"
-)
-
-(define_expand "bgt"
+(define_expand "cbranchsi4"
[(set (reg:CC 16)
- (compare:CC (match_dup 1)
- (match_dup 2)))
+ (compare:CC (match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "nonmemory_operand" "")))
(set (pc)
- (if_then_else (gt:CC (reg:CC 16)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
+ (if_then_else (match_operator:CC 0 "ordered_comparison_operator"
+ [(reg:CC 16) (const_int 0)])
+ (label_ref (match_operand 3 "" ""))
(pc)))]
""
- "{
- operands[1] = fr30_compare_op0;
- operands[2] = fr30_compare_op1;
- }"
-)
-
-(define_expand "bge"
- [(set (reg:CC 16)
- (compare:CC (match_dup 1)
- (match_dup 2)))
- (set (pc)
- (if_then_else (ge:CC (reg:CC 16)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "{
- operands[1] = fr30_compare_op0;
- operands[2] = fr30_compare_op1;
- }"
-)
-
-(define_expand "bltu"
- [(set (reg:CC 16)
- (compare:CC (match_dup 1)
- (match_dup 2)))
- (set (pc)
- (if_then_else (ltu:CC (reg:CC 16)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "{
- operands[1] = fr30_compare_op0;
- operands[2] = fr30_compare_op1;
- }"
-)
-
-(define_expand "bleu"
- [(set (reg:CC 16)
- (compare:CC (match_dup 1)
- (match_dup 2)))
- (set (pc)
- (if_then_else (leu:CC (reg:CC 16)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "{
- operands[1] = fr30_compare_op0;
- operands[2] = fr30_compare_op1;
- }"
-)
-
-(define_expand "bgtu"
- [(set (reg:CC 16)
- (compare:CC (match_dup 1)
- (match_dup 2)))
- (set (pc)
- (if_then_else (gtu:CC (reg:CC 16)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
""
- "{
- operands[1] = fr30_compare_op0;
- operands[2] = fr30_compare_op1;
- }"
)
-(define_expand "bgeu"
- [(set (reg:CC 16)
- (compare:CC (match_dup 1)
- (match_dup 2)))
- (set (pc)
- (if_then_else (geu:CC (reg:CC 16)
- (const_int 0))
- (label_ref (match_operand 0 "" ""))
- (pc)))]
- ""
- "{
- operands[1] = fr30_compare_op0;
- operands[2] = fr30_compare_op1;
- }"
-)
;; Actual branches. We must allow for the (label_ref) and the (pc) to be
;; swapped. If they are swapped, it reverses the sense of the branch.