This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[SH, committed] Fix some failing PR 51244 tests
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 17 May 2014 00:58:23 +0200
- Subject: [SH, committed] Fix some failing PR 51244 tests
- Authentication-results: sourceware.org; auth=none
Hi,
Since recently, some of the PR 51244 tests started to fail. The
attached patch fixes that.
Tested on rev 210305 with
make -k check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
and no new failures.
Committed as rev 210535.
Cheers,
Oleg
gcc/ChangeLog:
PR target/51244
* config/sh/sh.c (sh_eval_treg_value): Handle t_reg_operand and
negt_reg_operand cases.
* config/sh/sh.md (*cset_zero): Likewise by using cbranch_treg_value
predicate.
* config/sh/predicates.md (cbranch_treg_value): Simplify.
Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c (revision 210301)
+++ gcc/config/sh/sh.c (working copy)
@@ -2224,7 +2225,12 @@
int
sh_eval_treg_value (rtx op)
{
- enum rtx_code code = GET_CODE (op);
+ if (t_reg_operand (op, GET_MODE (op)))
+ return 1;
+ if (negt_reg_operand (op, GET_MODE (op)))
+ return 0;
+
+ rtx_code code = GET_CODE (op);
if ((code != EQ && code != NE) || !CONST_INT_P (XEXP (op, 1)))
return -1;
Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md (revision 210301)
+++ gcc/config/sh/sh.md (working copy)
@@ -11624,14 +11624,22 @@
(define_insn "*cset_zero"
[(set (match_operand:SI 0 "arith_reg_dest" "=r")
- (if_then_else:SI (match_operand:SI 1 "t_reg_operand")
+ (if_then_else:SI (match_operand:SI 1 "cbranch_treg_value")
(match_operand:SI 2 "arith_reg_operand" "0")
(const_int 0)))]
"TARGET_SH1 && TARGET_ZDCBRANCH"
{
- return "bt 0f" "\n"
- " mov #0,%0" "\n"
- "0:";
+ int tval = sh_eval_treg_value (operands[1]);
+ if (tval == true)
+ return "bt 0f" "\n"
+ " mov #0,%0" "\n"
+ "0:";
+ else if (tval == false)
+ return "bf 0f" "\n"
+ " mov #0,%0" "\n"
+ "0:";
+ else
+ gcc_unreachable ();
}
[(set_attr "type" "arith") ;; poor approximation
(set_attr "length" "4")])
Index: gcc/config/sh/predicates.md
===================================================================
--- gcc/config/sh/predicates.md (revision 210301)
+++ gcc/config/sh/predicates.md (working copy)
@@ -1119,10 +1119,8 @@
;; A predicate that returns true if OP is a valid construct around the T bit
;; that can be used as an operand for conditional branches.
(define_predicate "cbranch_treg_value"
- (match_code "eq,ne,reg,subreg,xor,sign_extend,zero_extend")
-{
- return sh_eval_treg_value (op) >= 0;
-})
+ (and (match_code "eq,ne,reg,subreg,xor,sign_extend,zero_extend")
+ (match_test "sh_eval_treg_value (op) >= 0")))
;; Returns true if OP is arith_reg_operand or t_reg_operand.
(define_predicate "arith_reg_or_t_reg_operand"