aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOleg Endo <olegendo@gcc.gnu.org>2015-01-26 23:56:05 +0000
committerOleg Endo <olegendo@gcc.gnu.org>2015-01-26 23:56:05 +0000
commit48e4f473eb23e4bf95e517f9eb83272316674c16 (patch)
treeee29468871e63260274fe84d0ff21a1e5b303dee /gcc
parent831a3a9e343d66a4dc51c141f2b5a87df5433627 (diff)
downloadgcc-48e4f473eb23e4bf95e517f9eb83272316674c16.zip
gcc-48e4f473eb23e4bf95e517f9eb83272316674c16.tar.gz
gcc-48e4f473eb23e4bf95e517f9eb83272316674c16.tar.bz2
re PR target/49263 (SH Target: underutilized "TST #imm, R0" instruction)
gcc/ PR target/49263 * config/sh/sh.c (sh_split_treg_set_expr): Invoke emit_insn before remove_insn. * config/sh/sh.md (tstsi_t): Don't try to optimize constant with right shifts if it already fits into K08. gcc/testsuite/ PR target/49263 * gcc.target/sh/pr49263-4.c: New. From-SVN: r220144
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/sh/sh.c4
-rw-r--r--gcc/config/sh/sh.md8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/sh/pr49263-4.c10
5 files changed, 31 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8cf5d5b..e44eb73 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2015-01-26 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/49263
+ * config/sh/sh.c (sh_split_treg_set_expr): Invoke emit_insn before
+ remove_insn.
+ * config/sh/sh.md (tstsi_t): Don't try to optimize constant with right
+ shifts if it already fits into K08.
+
2015-01-26 Jakub Jelinek <jakub@redhat.com>
PR ipa/64730
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 7d07634..a7427f5 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -14466,6 +14466,8 @@ sh_split_treg_set_expr (rtx x, rtx_insn* curr_insn)
fprintf (dump_file, "trailing nott insn %d\n", INSN_UID (nott_insn));
}
+ emit_insn (insnlist.first);
+
if (nott_insn != NULL && append_nott)
{
if (dump_file)
@@ -14475,8 +14477,6 @@ sh_split_treg_set_expr (rtx x, rtx_insn* curr_insn)
append_nott = false;
}
- emit_insn (insnlist.first);
-
if (append_nott)
nott_insn = emit_insn (gen_nott (get_t_reg_rtx ()));
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 956d1ef..4a39e12 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -742,8 +742,12 @@
variant instead and load the constant into a reg. For that we'd need
to do some analysis. */
- if ((op1val & 0xFFFF) == 0
- && CONST_OK_FOR_K08 (op1val >> 16) && optimize_size)
+ if (CONST_OK_FOR_K08 (op1val))
+ {
+ /* Do nothing. */
+ }
+ else if ((op1val & 0xFFFF) == 0
+ && CONST_OK_FOR_K08 (op1val >> 16) && optimize_size)
{
/* Use a swap.w insn to do a shift + reg copy (to R0) in one insn. */
op1val = op1val >> 16;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cf72ea92..c66df20 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-26 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/49263
+ * gcc.target/sh/pr49263-4.c: New.
+
2015-01-26 Paul Thomas <pault@gcc.gnu.org>
PR fortran/62044
diff --git a/gcc/testsuite/gcc.target/sh/pr49263-4.c b/gcc/testsuite/gcc.target/sh/pr49263-4.c
new file mode 100644
index 0000000..cbba68b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/pr49263-4.c
@@ -0,0 +1,10 @@
+/* Verify that TST #imm, R0 instruction is generated if the constant
+ allows it when compiling for -Os. */
+/* { dg-do compile } */
+/* { dg-options "-Os" } */
+/* { dg-final { scan-assembler-not "and" } } */
+/* { dg-final { scan-assembler-not "extu" } } */
+/* { dg-final { scan-assembler-not "exts" } } */
+/* { dg-final { scan-assembler-not "shlr" } } */
+
+#include "pr49263.c"