* [SH] Simplify cstore patterns
@ 2012-04-05 18:25 Oleg Endo
2012-04-05 22:42 ` Kaz Kojima
0 siblings, 1 reply; 2+ messages in thread
From: Oleg Endo @ 2012-04-05 18:25 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 542 bytes --]
Hi,
The attached patch simplifies the cstore patterns by removing GET_CODE
checks that are already done in sh_expand_t_scc.
Tested against rev 185893 with...
make -k check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a-single/-mb,
-m4-single/-ml,-m4-single/-mb,
-m4a-single/-ml,-m4a-single/-mb}"
...and no new failures.
OK?
Cheers,
Oleg
ChangeLog:
* config/sh/sh.c (sh_expand_t_scc): Change return type from int
to bool.
* config/sh/sh.md (cstoresi4, cstoredi4): Remove GET_CODE checks
before calling sh_expand_t_scc.
[-- Attachment #2: 00_sh_simplify_cstore.patch --]
[-- Type: text/x-patch, Size: 2351 bytes --]
Index: gcc/config/sh/sh-protos.h
===================================================================
--- gcc/config/sh/sh-protos.h (revision 185893)
+++ gcc/config/sh/sh-protos.h (working copy)
@@ -117,7 +117,7 @@
extern int sh_can_redirect_branch (rtx, rtx);
extern void sh_expand_unop_v2sf (enum rtx_code, rtx, rtx);
extern void sh_expand_binop_v2sf (enum rtx_code, rtx, rtx, rtx);
-extern int sh_expand_t_scc (rtx *);
+extern bool sh_expand_t_scc (rtx *);
extern rtx sh_gen_truncate (enum machine_mode, rtx, int);
extern bool sh_vector_mode_supported_p (enum machine_mode);
#endif /* RTX_CODE */
Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c (revision 185894)
+++ gcc/config/sh/sh.c (working copy)
@@ -11942,7 +11942,7 @@
return val;
}
-int
+bool
sh_expand_t_scc (rtx operands[])
{
enum rtx_code code = GET_CODE (operands[1]);
@@ -11954,21 +11954,21 @@
if (!REG_P (op0) || REGNO (op0) != T_REG
|| !CONST_INT_P (op1))
- return 0;
+ return false;
if (!REG_P (result))
result = gen_reg_rtx (SImode);
val = INTVAL (op1);
if ((code == EQ && val == 1) || (code == NE && val == 0))
emit_insn (gen_movt (result));
else if ((code == EQ && val == 0) || (code == NE && val == 1))
- emit_insn (gen_movnegt (result));
+ emit_insn (gen_movnegt (result));
else if (code == EQ || code == NE)
emit_insn (gen_move_insn (result, GEN_INT (code == NE)));
else
- return 0;
+ return false;
if (result != target)
emit_move_insn (target, result);
- return 1;
+ return true;
}
/* INSN is an sfunc; return the rtx that describes the address used. */
Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md (revision 185893)
+++ gcc/config/sh/sh.md (working copy)
@@ -9575,8 +9575,7 @@
DONE;
}
- if ((GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)
- && sh_expand_t_scc (operands))
+ if (sh_expand_t_scc (operands))
DONE;
if (! currently_expanding_to_rtl)
@@ -9600,8 +9599,7 @@
DONE;
}
- if ((GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)
- && sh_expand_t_scc (operands))
+ if (sh_expand_t_scc (operands))
DONE;
if (! currently_expanding_to_rtl)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [SH] Simplify cstore patterns
2012-04-05 18:25 [SH] Simplify cstore patterns Oleg Endo
@ 2012-04-05 22:42 ` Kaz Kojima
0 siblings, 0 replies; 2+ messages in thread
From: Kaz Kojima @ 2012-04-05 22:42 UTC (permalink / raw)
To: oleg.endo; +Cc: gcc-patches
Oleg Endo <oleg.endo@t-online.de> wrote:
> The attached patch simplifies the cstore patterns by removing GET_CODE
> checks that are already done in sh_expand_t_scc.
>
> Tested against rev 185893 with...
> make -k check RUNTESTFLAGS="--target_board=sh-sim
> \{-m2/-ml,-m2/-mb,-m2a-single/-mb,
> -m4-single/-ml,-m4-single/-mb,
> -m4a-single/-ml,-m4a-single/-mb}"
>
> ...and no new failures.
>
> OK?
OK.
Regards,
kaz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-05 22:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-05 18:25 [SH] Simplify cstore patterns Oleg Endo
2012-04-05 22:42 ` Kaz Kojima
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).