summaryrefslogtreecommitdiffstats
path: root/gcc/config/crx/crx.md
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/crx/crx.md')
-rw-r--r--gcc/config/crx/crx.md79
1 files changed, 27 insertions, 52 deletions
diff --git a/gcc/config/crx/crx.md b/gcc/config/crx/crx.md
index b9655544ffc..229e345d32f 100644
--- a/gcc/config/crx/crx.md
+++ b/gcc/config/crx/crx.md
@@ -63,6 +63,10 @@
(ior (match_code "symbol_ref")
(match_operand 0 "register_operand")))
+(define_predicate "cc_reg_operand"
+ (and (match_code "reg")
+ (match_test "REGNO (op) == CC_REGNUM")))
+
(define_predicate "nosp_reg_operand"
(and (match_operand 0 "register_operand")
(match_test "REGNO (op) != SP_REGNUM")))
@@ -107,8 +111,6 @@
(define_code_iterator mima_oprnd [smax umax smin umin])
(define_code_attr mimaIsa [(smax "maxs") (umax "maxu") (smin "mins") (umin "minu")])
-(define_code_iterator any_cond [eq ne gt gtu lt ltu ge geu le leu])
-
;; Addition Instructions
(define_insn "adddi3"
@@ -522,9 +524,21 @@
;; Compare and Branch Instructions
+(define_insn "cbranchcc4"
+ [(set (pc)
+ (if_then_else (match_operator 0 "ordered_comparison_operator"
+ [(match_operand:CC 1 "cc_reg_operand" "r")
+ (match_operand 2 "cst4_operand" "L")])
+ (label_ref (match_operand 3 ""))
+ (pc)))]
+ ""
+ "b%d0\t%l3"
+ [(set_attr "length" "6")]
+)
+
(define_insn "cbranch<mode>4"
[(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
+ (if_then_else (match_operator 0 "ordered_comparison_operator"
[(match_operand:CRXIM 1 "register_operand" "r")
(match_operand:CRXIM 2 "reg_or_cst4_operand" "rL")])
(label_ref (match_operand 3 "" ""))
@@ -535,18 +549,18 @@
[(set_attr "length" "6")]
)
-;; Compare Instructions
-(define_expand "cmp<mode>"
+;; Scond Instructions
+
+(define_expand "cstore<mode>4"
[(set (reg:CC CC_REGNUM)
- (compare:CC (match_operand:CRXIM 0 "register_operand" "")
- (match_operand:CRXIM 1 "nonmemory_operand" "")))]
+ (compare:CC (match_operand:CRXIM 2 "register_operand" "")
+ (match_operand:CRXIM 3 "nonmemory_operand" "")))
+ (set (match_operand:SI 0 "register_operand")
+ (match_operator:SI 1 "ordered_comparison_operator"
+ [(reg:CC CC_REGNUM) (const_int 0)]))]
+ ""
""
- {
- crx_compare_op0 = operands[0];
- crx_compare_op1 = operands[1];
- DONE;
- }
)
(define_insn "cmp<mode>_internal"
@@ -558,48 +572,9 @@
[(set_attr "length" "2,<lImmArith>")]
)
-;; Conditional Branch Instructions
-
-(define_expand "b<code>"
- [(set (pc)
- (if_then_else (any_cond (reg:CC CC_REGNUM)
- (const_int 0))
- (label_ref (match_operand 0 ""))
- (pc)))]
- ""
- {
- crx_expand_branch (<CODE>, operands[0]);
- DONE;
- }
-)
-
-(define_insn "bCOND_internal"
- [(set (pc)
- (if_then_else (match_operator 0 "comparison_operator"
- [(reg:CC CC_REGNUM)
- (const_int 0)])
- (label_ref (match_operand 1 ""))
- (pc)))]
- ""
- "b%d0\t%l1"
- [(set_attr "length" "6")]
-)
-
-;; Scond Instructions
-
-(define_expand "s<code>"
- [(set (match_operand:SI 0 "register_operand")
- (any_cond:SI (reg:CC CC_REGNUM) (const_int 0)))]
- ""
- {
- crx_expand_scond (<CODE>, operands[0]);
- DONE;
- }
-)
-
(define_insn "sCOND_internal"
[(set (match_operand:SI 0 "register_operand" "=r")
- (match_operator:SI 1 "comparison_operator"
+ (match_operator:SI 1 "ordered_comparison_operator"
[(reg:CC CC_REGNUM) (const_int 0)]))]
""
"s%d1\t%0"
OpenPOWER on IntegriCloud