summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0403-PR-target-49238.patch
blob: d43c6357e98f0d7d16a9e4ed7e0d847376f7b6ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 097c985ab5f847fba2fe4f9e53732b75f2ecf266 Mon Sep 17 00:00:00 2001
From: kkojima <kkojima@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 8 Jun 2011 04:07:25 +0000
Subject: [PATCH] 	PR target/49238
 	* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174793 138bc75d-0d04-0410-961f-82ee72b054a4

index 05acb0a..ee80028 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -2187,6 +2187,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 ();
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 ();
+}
-- 
1.7.0.4