Index: gcc/gcc/config/h8300/h8300.md |
diff --git a/gcc/gcc/config/h8300/h8300.md b/gcc/gcc/config/h8300/h8300.md |
index 61f876c83996b9a33c8b0768927d062064f22692..5efe2cb97b48ba796573d6955bce6dcbc4c02e3c 100644 |
--- a/gcc/gcc/config/h8300/h8300.md |
+++ b/gcc/gcc/config/h8300/h8300.md |
@@ -1,6 +1,6 @@ |
;; GCC machine description for Renesas H8/300 |
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
-;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
+;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 |
;; Free Software Foundation, Inc. |
;; Contributed by Steve Chamberlain (sac@cygnus.com), |
@@ -153,7 +153,7 @@ |
(define_attr "can_delay" "no,yes" |
(cond [(eq_attr "type" "branch,bitbranch,call") |
(const_string "no") |
- (ne (symbol_ref "get_attr_length (insn)") (const_int 2)) |
+ (geu (symbol_ref "get_attr_length (insn)") (const_int 2)) |
(const_string "no")] |
(const_string "yes"))) |
@@ -961,28 +961,33 @@ |
;; ---------------------------------------------------------------------- |
(define_insn "" |
- [(set (cc0) (zero_extract:HI (match_operand:QI 0 "bit_memory_operand" "r,U") |
- (const_int 1) |
- (match_operand 1 "const_int_operand" "n,n")))] |
+ [(set (cc0) (compare |
+ (zero_extract:QI (match_operand:QI 0 "bit_memory_operand" "r,U") |
+ (const_int 1) |
+ (match_operand 1 "const_int_operand" "n,n")) |
+ (const_int 0)))] |
"TARGET_H8300" |
"btst %Z1,%Y0" |
[(set_attr "length" "2,4") |
(set_attr "cc" "set_zn,set_zn")]) |
(define_insn "" |
- [(set (cc0) (zero_extract:HI (match_operand:HI 0 "register_operand" "r") |
- (const_int 1) |
- (match_operand 1 "const_int_operand" "n")))] |
+ [(set (cc0) (compare |
+ (zero_extract:HI (match_operand:HI 0 "register_operand" "r") |
+ (const_int 1) |
+ (match_operand 1 "const_int_operand" "n")) |
+ (const_int 0)))] |
"TARGET_H8300" |
"btst %Z1,%Y0" |
[(set_attr "length" "2") |
(set_attr "cc" "set_zn")]) |
(define_insn_and_split "*tst_extzv_1_n" |
- [(set (cc0) |
- (zero_extract:SI (match_operand:QI 0 "general_operand_src" "r,U,mn>") |
- (const_int 1) |
- (match_operand 1 "const_int_operand" "n,n,n"))) |
+ [(set (cc0) (compare |
+ (zero_extract:SI (match_operand:QI 0 "general_operand_src" "r,U,mn>") |
+ (const_int 1) |
+ (match_operand 1 "const_int_operand" "n,n,n")) |
+ (const_int 0))) |
(clobber (match_scratch:QI 2 "=X,X,&r"))] |
"(TARGET_H8300H || TARGET_H8300S)" |
"@ |
@@ -993,18 +998,20 @@ |
&& !OK_FOR_U (operands[0])" |
[(set (match_dup 2) |
(match_dup 0)) |
- (parallel [(set (cc0) (zero_extract:SI (match_dup 2) |
- (const_int 1) |
- (match_dup 1))) |
+ (parallel [(set (cc0) (compare (zero_extract:SI (match_dup 2) |
+ (const_int 1) |
+ (match_dup 1)) |
+ (const_int 0))) |
(clobber (scratch:QI))])] |
"" |
[(set_attr "length" "2,8,10") |
(set_attr "cc" "set_zn,set_zn,set_zn")]) |
(define_insn "" |
- [(set (cc0) (zero_extract:SI (match_operand:SI 0 "register_operand" "r") |
- (const_int 1) |
- (match_operand 1 "const_int_operand" "n")))] |
+ [(set (cc0) (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "r") |
+ (const_int 1) |
+ (match_operand 1 "const_int_operand" "n")) |
+ (const_int 0)))] |
"(TARGET_H8300H || TARGET_H8300S) |
&& INTVAL (operands[1]) <= 15" |
"btst %Z1,%Y0" |
@@ -1012,10 +1019,10 @@ |
(set_attr "cc" "set_zn")]) |
(define_insn_and_split "*tstsi_upper_bit" |
- [(set (cc0) |
- (zero_extract:SI (match_operand:SI 0 "register_operand" "r") |
- (const_int 1) |
- (match_operand 1 "const_int_operand" "n"))) |
+ [(set (cc0) (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "r") |
+ (const_int 1) |
+ (match_operand 1 "const_int_operand" "n")) |
+ (const_int 0))) |
(clobber (match_scratch:SI 2 "=&r"))] |
"(TARGET_H8300H || TARGET_H8300S) |
&& INTVAL (operands[1]) >= 16" |
@@ -1026,18 +1033,18 @@ |
(const_int -65536)) |
(lshiftrt:SI (match_dup 0) |
(const_int 16)))) |
- (set (cc0) |
- (zero_extract:SI (match_dup 2) |
- (const_int 1) |
- (match_dup 3)))] |
+ (set (cc0) (compare (zero_extract:SI (match_dup 2) |
+ (const_int 1) |
+ (match_dup 3)) |
+ (const_int 0)))] |
"operands[3] = GEN_INT (INTVAL (operands[1]) - 16);") |
(define_insn "*tstsi_variable_bit" |
- [(set (cc0) |
- (zero_extract:SI (match_operand:SI 0 "register_operand" "r") |
- (const_int 1) |
- (and:SI (match_operand:SI 1 "register_operand" "r") |
- (const_int 7))))] |
+ [(set (cc0) (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "r") |
+ (const_int 1) |
+ (and:SI (match_operand:SI 1 "register_operand" "r") |
+ (const_int 7))) |
+ (const_int 0)))] |
"TARGET_H8300H || TARGET_H8300S" |
"btst %w1,%w0" |
[(set_attr "length" "2") |
@@ -1045,10 +1052,12 @@ |
(define_insn_and_split "*tstsi_variable_bit_qi" |
[(set (cc0) |
- (zero_extract:SI (zero_extend:SI (match_operand:QI 0 "general_operand_src" "r,U,mn>")) |
- (const_int 1) |
- (and:SI (match_operand:SI 1 "register_operand" "r,r,r") |
- (const_int 7)))) |
+ (compare |
+ (zero_extract:SI (zero_extend:SI (match_operand:QI 0 "general_operand_src" "r,U,mn>")) |
+ (const_int 1) |
+ (and:SI (match_operand:SI 1 "register_operand" "r,r,r") |
+ (const_int 7))) |
+ (const_int 0))) |
(clobber (match_scratch:QI 2 "=X,X,&r"))] |
"(TARGET_H8300H || TARGET_H8300S)" |
"@ |
@@ -1059,55 +1068,59 @@ |
&& !OK_FOR_U (operands[0])" |
[(set (match_dup 2) |
(match_dup 0)) |
- (parallel [(set (cc0) (zero_extract:SI (zero_extend:SI (match_dup 2)) |
- (const_int 1) |
- (and:SI (match_dup 1) |
- (const_int 7)))) |
+ (parallel [(set (cc0) (compare (zero_extract:SI (zero_extend:SI (match_dup 2)) |
+ (const_int 1) |
+ (and:SI (match_dup 1) |
+ (const_int 7))) |
+ (const_int 0))) |
(clobber (scratch:QI))])] |
"" |
[(set_attr "length" "2,8,10") |
(set_attr "cc" "set_zn,set_zn,set_zn")]) |
-(define_insn "tstqi" |
- [(set (cc0) (match_operand:QI 0 "register_operand" "r"))] |
+(define_insn "*tstqi" |
+ [(set (cc0) (compare (match_operand:QI 0 "register_operand" "r") |
+ (const_int 0)))] |
"" |
"mov.b %X0,%X0" |
[(set_attr "length" "2") |
(set_attr "cc" "set_znv")]) |
-(define_insn "tsthi" |
- [(set (cc0) (match_operand:HI 0 "register_operand" "r"))] |
+(define_insn "*tsthi" |
+ [(set (cc0) (compare (match_operand:HI 0 "register_operand" "r") |
+ (const_int 0)))] |
"" |
"mov.w %T0,%T0" |
[(set_attr "length" "2") |
(set_attr "cc" "set_znv")]) |
(define_insn "*tsthi_upper" |
- [(set (cc0) |
- (and:HI (match_operand:HI 0 "register_operand" "r") |
- (const_int -256)))] |
+ [(set (cc0) (compare (and:HI (match_operand:HI 0 "register_operand" "r") |
+ (const_int -256)) |
+ (const_int 0)))] |
"" |
"mov.b %t0,%t0" |
[(set_attr "length" "2") |
(set_attr "cc" "set_znv")]) |
-(define_insn "tstsi" |
- [(set (cc0) (match_operand:SI 0 "register_operand" "r"))] |
+(define_insn "*tstsi" |
+ [(set (cc0) (compare (match_operand:SI 0 "register_operand" "r") |
+ (const_int 0)))] |
"TARGET_H8300H || TARGET_H8300S" |
"mov.l %S0,%S0" |
[(set_attr "length" "2") |
(set_attr "cc" "set_znv")]) |
(define_insn "*tstsi_upper" |
- [(set (cc0) |
- (and:SI (match_operand:SI 0 "register_operand" "r") |
- (const_int -65536)))] |
+ [(set (cc0) (compare (and:SI (match_operand:SI 0 "register_operand" "r") |
+ (const_int -65536)) |
+ (const_int 0)))] |
"" |
"mov.w %e0,%e0" |
[(set_attr "length" "2") |
(set_attr "cc" "set_znv")]) |
-(define_insn "cmpqi" |
+(define_insn "*cmpqi" |
[(set (cc0) |
(compare (match_operand:QI 0 "h8300_dst_operand" "rQ") |
(match_operand:QI 1 "h8300_src_operand" "rQi")))] |
@@ -1116,19 +1129,6 @@ |
[(set_attr "length_table" "addb") |
(set_attr "cc" "compare")]) |
-(define_expand "cmphi" |
- [(set (cc0) |
- (compare (match_operand:HI 0 "h8300_dst_operand" "") |
- (match_operand:HI 1 "h8300_src_operand" "")))] |
- "" |
- " |
-{ |
- /* Force operand1 into a register if we're compiling |
- for the H8/300. */ |
- if (GET_CODE (operands[1]) != REG && TARGET_H8300) |
- operands[1] = force_reg (HImode, operands[1]); |
-}") |
- |
(define_insn "*cmphi_h8300_znvc" |
[(set (cc0) |
(compare (match_operand:HI 0 "register_operand" "r") |
@@ -2155,55 +2155,37 @@ |
;; Conditional jump instructions |
-(define_expand "ble" |
- [(match_operand 0 "" "")] |
- "" |
- "h8300_expand_branch (LE, operands[0]); DONE;") |
- |
-(define_expand "bleu" |
- [(match_operand 0 "" "")] |
+(define_expand "cbranchqi4" |
+ [(use (match_operator 0 "ordered_comparison_operator" |
+ [(match_operand:QI 1 "h8300_dst_operand" "") |
+ (match_operand:QI 2 "h8300_src_operand" "")])) |
+ (use (match_operand 3 ""))] |
"" |
- "h8300_expand_branch (LEU, operands[0]); DONE;") |
+ "h8300_expand_branch (operands); DONE;") |
-(define_expand "bge" |
- [(match_operand 0 "" "")] |
+(define_expand "cbranchhi4" |
+ [(use (match_operator 0 "ordered_comparison_operator" |
+ [(match_operand:HI 1 "h8300_dst_operand" "") |
+ (match_operand:HI 2 "h8300_src_operand" "")])) |
+ (use (match_operand 3 ""))] |
"" |
- "h8300_expand_branch (GE, operands[0]); DONE;") |
- |
-(define_expand "bgeu" |
- [(match_operand 0 "" "")] |
- "" |
- "h8300_expand_branch (GEU, operands[0]); DONE;") |
- |
-(define_expand "blt" |
- [(match_operand 0 "" "")] |
- "" |
- "h8300_expand_branch (LT, operands[0]); DONE;") |
- |
-(define_expand "bltu" |
- [(match_operand 0 "" "")] |
- "" |
- "h8300_expand_branch (LTU, operands[0]); DONE;") |
- |
-(define_expand "bgt" |
- [(match_operand 0 "" "")] |
- "" |
- "h8300_expand_branch (GT, operands[0]); DONE;") |
- |
-(define_expand "bgtu" |
- [(match_operand 0 "" "")] |
- "" |
- "h8300_expand_branch (GTU, operands[0]); DONE;") |
- |
-(define_expand "beq" |
- [(match_operand 0 "" "")] |
- "" |
- "h8300_expand_branch (EQ, operands[0]); DONE;") |
+ " |
+{ |
+ /* Force operand1 into a register if we're compiling |
+ for the H8/300. */ |
+ if ((GET_CODE (operands[2]) != REG && operands[2] != const0_rtx) |
+ && TARGET_H8300) |
+ operands[2] = force_reg (HImode, operands[2]); |
+ h8300_expand_branch (operands); DONE; |
+}") |
-(define_expand "bne" |
- [(match_operand 0 "" "")] |
- "" |
- "h8300_expand_branch (NE, operands[0]); DONE;") |
+(define_expand "cbranchsi4" |
+ [(use (match_operator 0 "ordered_comparison_operator" |
+ [(match_operand:SI 1 "h8300_dst_operand" "") |
+ (match_operand:SI 2 "h8300_src_operand" "")])) |
+ (use (match_operand 3 ""))] |
+ "TARGET_H8300H || TARGET_H8300S" |
+ "h8300_expand_branch (operands); DONE;") |
(define_insn "branch_true" |
[(set (pc) |
@@ -3019,8 +3001,8 @@ |
(clobber (match_operand:QI 3 "register_operand" ""))] |
"epilogue_completed |
&& find_regno_note (insn, REG_DEAD, REGNO (operands[1]))" |
- [(set (cc0) |
- (match_dup 1)) |
+ [(set (cc0) (compare (match_dup 1) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (le (cc0) (const_int 0)) |
(label_ref (match_dup 5)) |
@@ -3032,8 +3014,8 @@ |
(clobber (scratch:QI))]) |
(set (match_dup 1) |
(plus:QI (match_dup 1) (const_int -1))) |
- (set (cc0) |
- (match_dup 1)) |
+ (set (cc0) (compare (match_dup 1) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (ne (cc0) (const_int 0)) |
(label_ref (match_dup 4)) |
@@ -3052,8 +3034,8 @@ |
&& !find_regno_note (insn, REG_DEAD, REGNO (operands[1]))" |
[(set (match_dup 3) |
(match_dup 1)) |
- (set (cc0) |
- (match_dup 3)) |
+ (set (cc0) (compare (match_dup 3) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (le (cc0) (const_int 0)) |
(label_ref (match_dup 5)) |
@@ -3065,8 +3047,8 @@ |
(clobber (scratch:QI))]) |
(set (match_dup 3) |
(plus:QI (match_dup 3) (const_int -1))) |
- (set (cc0) |
- (match_dup 3)) |
+ (set (cc0) (compare (match_dup 3) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (ne (cc0) (const_int 0)) |
(label_ref (match_dup 4)) |
@@ -3413,17 +3395,29 @@ |
[(set_attr "cc" "none_0hit") |
(set_attr "length_table" "bitfield")]) |
-(define_expand "seq" |
- [(set (match_operand:HI 0 "register_operand" "") |
- (eq:HI (cc0) (const_int 0)))] |
+(define_expand "cstoreqi4" |
+ [(use (match_operator 1 "eqne_operator" |
+ [(match_operand:QI 2 "h8300_dst_operand" "") |
+ (match_operand:QI 3 "h8300_src_operand" "")])) |
+ (clobber (match_operand:HI 0 "register_operand"))] |
"TARGET_H8300SX" |
- "") |
+ "h8300_expand_store (operands); DONE;") |
-(define_expand "sne" |
- [(set (match_operand:HI 0 "register_operand" "") |
- (ne:HI (cc0) (const_int 0)))] |
+(define_expand "cstorehi4" |
+ [(use (match_operator 1 "eqne_operator" |
+ [(match_operand:HI 2 "h8300_dst_operand" "") |
+ (match_operand:HI 3 "h8300_src_operand" "")])) |
+ (clobber (match_operand:HI 0 "register_operand"))] |
"TARGET_H8300SX" |
- "") |
+ "h8300_expand_store (operands); DONE;") |
+ |
+(define_expand "cstoresi4" |
+ [(use (match_operator 1 "eqne_operator" |
+ [(match_operand:SI 2 "h8300_dst_operand" "") |
+ (match_operand:SI 3 "h8300_src_operand" "")])) |
+ (clobber (match_operand:HI 0 "register_operand"))] |
+ "TARGET_H8300SX" |
+ "h8300_expand_store (operands); DONE;") |
(define_insn "*bstzhireg" |
[(set (match_operand:HI 0 "register_operand" "=r") |
@@ -3451,13 +3445,7 @@ |
[(set (cc0) (match_dup 5)) |
(set (zero_extract:QI (match_dup 0) (const_int 1) (match_dup 1)) |
(match_op_dup:QI 2 [(cc0) (const_int 0)]))] |
- " |
-{ |
- if (operands[4] == const0_rtx && GET_CODE (operands[3]) == REG) |
- operands[5] = operands[3]; |
- else |
- operands[5] = gen_rtx_COMPARE (VOIDmode, operands[3], operands[4]); |
-}" |
+ "operands[5] = gen_rtx_COMPARE (VOIDmode, operands[3], operands[4]);" |
[(set_attr "cc" "set_znv,compare")]) |
(define_insn "*bstz" |
@@ -3499,13 +3487,7 @@ |
(if_then_else:QI |
(match_op_dup 1 [(cc0) (const_int 0)]) |
(ior:QI (match_dup 4) (match_dup 5)) (match_dup 4)))] |
- " |
-{ |
- if (operands[3] == const0_rtx && GET_CODE (operands[2]) == REG) |
- operands[6] = operands[2]; |
- else |
- operands[6] = gen_rtx_COMPARE (VOIDmode, operands[2], operands[3]); |
-}" |
+ "operands[6] = gen_rtx_COMPARE (VOIDmode, operands[2], operands[3]);" |
[(set_attr "cc" "set_znv,compare")]) |
(define_insn "*condbset" |
@@ -3541,13 +3523,7 @@ |
(if_then_else:QI |
(match_op_dup 1 [(cc0) (const_int 0)]) |
(and:QI (match_dup 4) (match_dup 5)) (match_dup 4)))] |
- " |
-{ |
- if (operands[3] == const0_rtx && GET_CODE (operands[2]) == REG) |
- operands[6] = operands[2]; |
- else |
- operands[6] = gen_rtx_COMPARE (VOIDmode, operands[2], operands[3]); |
-}" |
+ "operands[6] = gen_rtx_COMPARE (VOIDmode, operands[2], operands[3]);" |
[(set_attr "cc" "set_znv,compare")]) |
(define_insn "*condbclr" |
@@ -3587,13 +3563,7 @@ |
(ashift:QI (const_int 1) |
(match_operand:QI 5 "register_operand" "r,r"))) |
(match_dup 4)))] |
- " |
-{ |
- if (operands[3] == const0_rtx && GET_CODE (operands[2]) == REG) |
- operands[6] = operands[2]; |
- else |
- operands[6] = gen_rtx_COMPARE (VOIDmode, operands[2], operands[3]); |
-}" |
+ "operands[6] = gen_rtx_COMPARE (VOIDmode, operands[2], operands[3]);" |
[(set_attr "cc" "set_znv,compare")]) |
(define_insn "*condbsetreg" |
@@ -3634,13 +3604,7 @@ |
(ashift:QI (const_int 1) |
(match_operand:QI 5 "register_operand" "r,r"))) |
(match_dup 4)))] |
- " |
-{ |
- if (operands[3] == const0_rtx && GET_CODE (operands[2]) == REG) |
- operands[6] = operands[2]; |
- else |
- operands[6] = gen_rtx_COMPARE (VOIDmode, operands[2], operands[3]); |
-}" |
+ "operands[6] = gen_rtx_COMPARE (VOIDmode, operands[2], operands[3]);" |
[(set_attr "cc" "set_znv,compare")]) |
(define_insn "*condbclrreg" |
@@ -3878,10 +3842,10 @@ |
"(TARGET_H8300H || TARGET_H8300S)" |
"#" |
"&& reload_completed" |
- [(set (cc0) |
- (zero_extract:SI (match_dup 1) |
- (const_int 1) |
- (const_int 0))) |
+ [(set (cc0) (compare (zero_extract:SI (match_dup 1) |
+ (const_int 1) |
+ (const_int 0)) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (eq (cc0) |
(const_int 0)) |
@@ -3901,10 +3865,10 @@ |
"(TARGET_H8300H || TARGET_H8300S)" |
"#" |
"&& reload_completed" |
- [(set (cc0) |
- (zero_extract:SI (match_dup 1) |
- (const_int 1) |
- (const_int 0))) |
+ [(set (cc0) (compare (zero_extract:SI (match_dup 1) |
+ (const_int 1) |
+ (const_int 0)) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (ne (cc0) |
(const_int 0)) |
@@ -4398,8 +4362,8 @@ |
"" |
"#" |
"" |
- [(set (cc0) |
- (match_dup 0)) |
+ [(set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (ge (cc0) |
(const_int 0)) |
@@ -4418,8 +4382,8 @@ |
"" |
"#" |
"" |
- [(set (cc0) |
- (match_dup 0)) |
+ [(set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (lt (cc0) |
(const_int 0)) |
@@ -4852,8 +4816,8 @@ |
[(set (match_operand:HI 0 "register_operand" "") |
(plus:HI (match_dup 0) |
(match_operand 1 "incdec_operand" ""))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_operator 3 "eqne_operator" |
[(cc0) (const_int 0)]) |
@@ -4864,8 +4828,8 @@ |
(unspec:HI [(match_dup 0) |
(match_dup 1)] |
UNSPEC_INCDEC)) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -4878,8 +4842,8 @@ |
[(set (match_operand:SI 0 "register_operand" "") |
(plus:SI (match_dup 0) |
(match_operand 1 "incdec_operand" ""))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_operator 3 "eqne_operator" |
[(cc0) (const_int 0)]) |
@@ -4890,8 +4854,8 @@ |
(unspec:SI [(match_dup 0) |
(match_dup 1)] |
UNSPEC_INCDEC)) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -4900,9 +4864,10 @@ |
(define_peephole2 |
[(parallel [(set (cc0) |
- (zero_extract:SI (match_operand:QI 0 "register_operand" "") |
- (const_int 1) |
- (const_int 7))) |
+ (compare (zero_extract:SI (match_operand:QI 0 "register_operand" "") |
+ (const_int 1) |
+ (const_int 7)) |
+ (const_int 0))) |
(clobber (scratch:QI))]) |
(set (pc) |
(if_then_else (match_operator 1 "eqne_operator" |
@@ -4910,8 +4875,8 @@ |
(label_ref (match_operand 2 "" "")) |
(pc)))] |
"(TARGET_H8300H || TARGET_H8300S)" |
- [(set (cc0) |
- (match_dup 0)) |
+ [(set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5032,6 +4997,45 @@ |
"operands[3] = gen_lowpart (HImode, operands[0]); |
operands[4] = gen_lowpart (HImode, operands[1]);") |
+;; Convert a memory comparison to a move if there is a scratch register. |
+ |
+(define_peephole2 |
+ [(match_scratch:QI 1 "r") |
+ (set (cc0) |
+ (compare (match_operand:QI 0 "memory_operand" "") |
+ (const_int 0)))] |
+ "" |
+ [(set (match_dup 1) |
+ (match_dup 0)) |
+ (set (cc0) (compare (match_dup 1) |
+ (const_int 0)))] |
+ "") |
+ |
+(define_peephole2 |
+ [(match_scratch:HI 1 "r") |
+ (set (cc0) |
+ (compare (match_operand:HI 0 "memory_operand" "") |
+ (const_int 0)))] |
+ "(TARGET_H8300H || TARGET_H8300S)" |
+ [(set (match_dup 1) |
+ (match_dup 0)) |
+ (set (cc0) (compare (match_dup 1) |
+ (const_int 0)))] |
+ "") |
+ |
+(define_peephole2 |
+ [(match_scratch:SI 1 "r") |
+ (set (cc0) |
+ (compare (match_operand:SI 0 "memory_operand" "") |
+ (const_int 0)))] |
+ "(TARGET_H8300H || TARGET_H8300S)" |
+ [(set (match_dup 1) |
+ (match_dup 0)) |
+ (set (cc0) (compare (match_dup 1) |
+ (const_int 0)))] |
+ "") |
+ |
+ |
;; (compare (reg:HI) (const_int)) takes 4 bytes, so we try to achieve |
;; the equivalent with shorter sequences. Here is the summary. Cases |
;; are grouped for each define_peephole2. |
@@ -5073,13 +5077,14 @@ |
(label_ref (match_operand 2 "" "")) |
(pc)))] |
"(TARGET_H8300H || TARGET_H8300S) |
+ && INTVAL (operands[1]) != 0 |
&& peep2_reg_dead_p (1, operands[0])" |
[(set (match_dup 0) |
(unspec:HI [(match_dup 0) |
(match_dup 4)] |
UNSPEC_INCDEC)) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5113,8 +5118,8 @@ |
(ashiftrt:HI (match_dup 0) |
(match_dup 4))) |
(clobber (scratch:QI))]) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 2) |
(label_ref (match_dup 3)) |
@@ -5148,8 +5153,8 @@ |
(ashiftrt:HI (match_dup 0) |
(match_dup 4))) |
(clobber (scratch:QI))]) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 5) |
(label_ref (match_dup 3)) |
@@ -5182,9 +5187,9 @@ |
(label_ref (match_operand 2 "" "")) |
(pc)))] |
"TARGET_H8300H || TARGET_H8300S" |
- [(set (cc0) |
- (and:HI (match_dup 0) |
- (const_int -256))) |
+ [(set (cc0) (compare (and:HI (match_dup 0) |
+ (const_int -256)) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 1) |
(label_ref (match_dup 2)) |
@@ -5211,9 +5216,9 @@ |
(label_ref (match_operand 2 "" "")) |
(pc)))] |
"TARGET_H8300H || TARGET_H8300S" |
- [(set (cc0) |
- (and:HI (match_dup 0) |
- (const_int -256))) |
+ [(set (cc0) (compare (and:HI (match_dup 0) |
+ (const_int -256)) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 3) |
(label_ref (match_dup 2)) |
@@ -5307,13 +5312,14 @@ |
(label_ref (match_operand 2 "" "")) |
(pc)))] |
"(TARGET_H8300H || TARGET_H8300S) |
+ && INTVAL (operands[1]) != 0 |
&& peep2_reg_dead_p (1, operands[0])" |
[(set (match_dup 0) |
(unspec:SI [(match_dup 0) |
(match_dup 4)] |
UNSPEC_INCDEC)) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5348,8 +5354,8 @@ |
[(set (match_dup 0) |
(plus:SI (match_dup 0) |
(match_dup 4))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5381,13 +5387,14 @@ |
&& ((INTVAL (operands[1]) & 0x00ff) == INTVAL (operands[1]) |
|| (INTVAL (operands[1]) & 0xff00) == INTVAL (operands[1]) |
|| INTVAL (operands[1]) == 0x0000ffff) |
+ && INTVAL (operands[1]) != 0 |
&& INTVAL (operands[1]) != 1 |
&& INTVAL (operands[1]) != 2" |
[(set (match_dup 0) |
(xor:SI (match_dup 0) |
(match_dup 1))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5425,8 +5432,8 @@ |
(match_dup 4))) |
(set (match_dup 0) |
(not:SI (match_dup 0))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5464,8 +5471,8 @@ |
(unspec:SI [(match_dup 0) |
(const_int -1)] |
UNSPEC_INCDEC)) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5507,8 +5514,8 @@ |
(ashiftrt:SI (match_dup 4) |
(match_dup 5))) |
(clobber (scratch:QI))]) |
- (set (cc0) |
- (match_dup 4)) |
+ (set (cc0) (compare (match_dup 4) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 2) |
(label_ref (match_dup 3)) |
@@ -5550,8 +5557,8 @@ |
(ashiftrt:SI (match_dup 4) |
(match_dup 5))) |
(clobber (scratch:QI))]) |
- (set (cc0) |
- (match_dup 4)) |
+ (set (cc0) (compare (match_dup 4) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 6) |
(label_ref (match_dup 3)) |
@@ -5591,8 +5598,8 @@ |
(ashiftrt:SI (match_dup 0) |
(match_dup 4))) |
(clobber (scratch:QI))]) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 2) |
(label_ref (match_dup 3)) |
@@ -5626,8 +5633,8 @@ |
(ashiftrt:SI (match_dup 0) |
(match_dup 4))) |
(clobber (scratch:QI))]) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 5) |
(label_ref (match_dup 3)) |
@@ -5672,8 +5679,8 @@ |
[(set (match_dup 0) |
(and:SI (match_dup 0) |
(match_dup 4))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 2) |
(label_ref (match_dup 3)) |
@@ -5712,8 +5719,8 @@ |
[(set (match_dup 0) |
(and:SI (match_dup 0) |
(match_dup 4))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 5) |
(label_ref (match_dup 3)) |
@@ -5746,9 +5753,9 @@ |
(label_ref (match_operand 2 "" "")) |
(pc)))] |
"TARGET_H8300H || TARGET_H8300S" |
- [(set (cc0) |
- (and:SI (match_dup 0) |
- (const_int -65536))) |
+ [(set (cc0) (compare (and:SI (match_dup 0) |
+ (const_int -65536)) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 1) |
(label_ref (match_dup 2)) |
@@ -5775,9 +5782,9 @@ |
(label_ref (match_operand 2 "" "")) |
(pc)))] |
"TARGET_H8300H || TARGET_H8300S" |
- [(set (cc0) |
- (and:SI (match_dup 0) |
- (const_int -65536))) |
+ [(set (cc0) (compare (and:SI (match_dup 0) |
+ (const_int -65536)) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_dup 3) |
(label_ref (match_dup 2)) |
@@ -5814,6 +5821,7 @@ |
(label_ref (match_operand 2 "" "")) |
(pc)))] |
"(TARGET_H8300H || TARGET_H8300S) |
+ && INTVAL (operands[1]) != 0 |
&& !peep2_reg_dead_p (1, operands[0]) |
&& !same_cmp_following_p (insn)" |
[(set (match_dup 4) |
@@ -5822,8 +5830,8 @@ |
(unspec:SI [(match_dup 4) |
(match_dup 5)] |
UNSPEC_INCDEC)) |
- (set (cc0) |
- (match_dup 4)) |
+ (set (cc0) (compare (match_dup 4) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5836,8 +5844,8 @@ |
[(set (match_operand:HI 0 "register_operand" "") |
(and:HI (match_dup 0) |
(match_operand:HI 1 "const_int_qi_operand" ""))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_operator 3 "eqne_operator" |
[(cc0) (const_int 0)]) |
@@ -5847,8 +5855,8 @@ |
[(set (match_dup 4) |
(and:QI (match_dup 4) |
(match_dup 5))) |
- (set (cc0) |
- (match_dup 4)) |
+ (set (cc0) (compare (match_dup 4) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5860,8 +5868,8 @@ |
[(set (match_operand:SI 0 "register_operand" "") |
(and:SI (match_dup 0) |
(match_operand:SI 1 "const_int_qi_operand" ""))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_operator 3 "eqne_operator" |
[(cc0) (const_int 0)]) |
@@ -5871,8 +5879,8 @@ |
[(set (match_dup 4) |
(and:QI (match_dup 4) |
(match_dup 5))) |
- (set (cc0) |
- (match_dup 4)) |
+ (set (cc0) (compare (match_dup 4) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5884,8 +5892,8 @@ |
[(set (match_operand:SI 0 "register_operand" "") |
(and:SI (match_dup 0) |
(match_operand:SI 1 "const_int_hi_operand" ""))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_operator 3 "eqne_operator" |
[(cc0) (const_int 0)]) |
@@ -5895,8 +5903,8 @@ |
[(set (match_dup 4) |
(and:HI (match_dup 4) |
(match_dup 5))) |
- (set (cc0) |
- (match_dup 4)) |
+ (set (cc0) (compare (match_dup 4) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) |
(label_ref (match_dup 2)) |
@@ -5911,8 +5919,8 @@ |
(set (match_dup 0) |
(xor:SI (match_dup 0) |
(match_operand:SI 2 "const_int_qi_operand" ""))) |
- (set (cc0) |
- (match_dup 0)) |
+ (set (cc0) (compare (match_dup 0) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_operator 4 "eqne_operator" |
[(cc0) (const_int 0)]) |
@@ -5926,8 +5934,8 @@ |
(set (match_dup 5) |
(xor:QI (match_dup 5) |
(match_dup 7))) |
- (set (cc0) |
- (match_dup 5)) |
+ (set (cc0) (compare (match_dup 5) |
+ (const_int 0))) |
(set (pc) |
(if_then_else (match_op_dup 4 [(cc0) (const_int 0)]) |
(label_ref (match_dup 3)) |
@@ -6088,7 +6096,8 @@ |
(match_operand 2 "h8300_src_operand" "")))] |
"TARGET_H8300SX |
&& peep2_reg_dead_p (2, operands[0]) |
- && !reg_overlap_mentioned_p (operands[0], operands[2])" |
+ && !reg_overlap_mentioned_p (operands[0], operands[2]) |
+ && operands[2] != const0_rtx" |
[(set (cc0) |
(compare (match_dup 1) |
(match_dup 2)))]) |