aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2011-06-01 22:36:08 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2011-06-01 22:36:08 +0000
commite95873dd5bbab240f64c4ab8138646ead2e3bdfc (patch)
tree232ef5af44e2c3235f2cd52f53a50a63518761fa /gcc
parenta82fcbe8255c5a3716710f27f08dc76ac16aeeca (diff)
downloadgcc-e95873dd5bbab240f64c4ab8138646ead2e3bdfc.zip
gcc-e95873dd5bbab240f64c4ab8138646ead2e3bdfc.tar.gz
gcc-e95873dd5bbab240f64c4ab8138646ead2e3bdfc.tar.bz2
sh.c (expand_cbranchdi4): Use a scratch register if needed when original operands are used for msw_skip...
* config/sh/sh.c (expand_cbranchdi4): Use a scratch register if needed when original operands are used for msw_skip comparison. * gcc.c-torture/compile/pr49238.c: New. From-SVN: r174550
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/sh/sh.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr49238.c18
4 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6483324..9b9fc41 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-01 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ PR target/49238
+ * config/sh/sh.c (expand_cbranchdi4): Use a scratch register if
+ needed when original operands are used for msw_skip comparison.
+
2011-06-01 Jakub Jelinek <jakub@redhat.com>
PR debug/49250
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index fb204c6..c5fbd56 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -2199,6 +2199,13 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison)
{
operands[1] = op1h;
operands[2] = op2h;
+ if (reload_completed
+ && ! arith_reg_or_0_operand (op2h, SImode)
+ && (true_regnum (op1h) || (comparison != EQ && comparison != NE)))
+ {
+ emit_move_insn (scratch, operands[2]);
+ operands[2] = scratch;
+ }
}
operands[3] = skip_label = gen_label_rtx ();
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 37a1dc6..a611a29 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-01 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ PR target/49238
+ * gcc.c-torture/compile/pr49238.c: New.
+
2011-06-01 Sofiane Naci <sofiane.naci@arm.com>
* gcc.target/arm/g2.c: Skip test in -mthumb.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49238.c b/gcc/testsuite/gcc.c-torture/compile/pr49238.c
new file mode 100644
index 0000000..fd8443a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr49238.c
@@ -0,0 +1,18 @@
+/* PR target/49238 */
+extern int bar (void);
+
+void
+foo (unsigned long long a, int b)
+{
+ int i;
+
+ if (b)
+ for (a = -12; a >= 10; a = bar ())
+ break;
+ else
+ return;
+
+ for (i = 0; i < 10; i += 10)
+ if ((i == bar ()) | (bar () >= a))
+ bar ();
+}