aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99448.patch
blob: 9f3d47f38b39b1f08f4389656d6af052ee15a301 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
2010-12-13  Chung-Lin Tang  <cltang@codesourcery.com>

	Backport from mainline:

	2010-12-10  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/46865

	* rtl.c (rtx_equal_p_cb, rtx_equal_p): For last operand of
	ASM_OPERANDS and ASM_INPUT if integers are different,
	call locator_eq.
	* jump.c (rtx_renumbered_equal_p): Likewise.

	gcc/testsuite/
	* gcc.target/i386/pr46865-1.c: New test.
	* gcc.target/i386/pr46865-2.c: New test.

=== modified file 'gcc/jump.c'
--- old/gcc/jump.c	2009-11-25 10:55:54 +0000
+++ new/gcc/jump.c	2010-12-13 10:05:52 +0000
@@ -1728,7 +1728,13 @@
 
 	case 'i':
 	  if (XINT (x, i) != XINT (y, i))
-	    return 0;
+	    {
+	      if (((code == ASM_OPERANDS && i == 6)
+		   || (code == ASM_INPUT && i == 1))
+		  && locator_eq (XINT (x, i), XINT (y, i)))
+		break;
+	      return 0;
+	    }
 	  break;
 
 	case 't':

=== modified file 'gcc/rtl.c'
--- old/gcc/rtl.c	2009-11-25 10:55:54 +0000
+++ new/gcc/rtl.c	2010-12-13 10:05:52 +0000
@@ -429,7 +429,15 @@
 	case 'n':
 	case 'i':
 	  if (XINT (x, i) != XINT (y, i))
-	    return 0;
+	    {
+#ifndef GENERATOR_FILE
+	      if (((code == ASM_OPERANDS && i == 6)
+		   || (code == ASM_INPUT && i == 1))
+		  && locator_eq (XINT (x, i), XINT (y, i)))
+		break;
+#endif
+	      return 0;
+	    }
 	  break;
 
 	case 'V':
@@ -549,7 +557,15 @@
 	case 'n':
 	case 'i':
 	  if (XINT (x, i) != XINT (y, i))
-	    return 0;
+	    {
+#ifndef GENERATOR_FILE
+	      if (((code == ASM_OPERANDS && i == 6)
+		   || (code == ASM_INPUT && i == 1))
+		  && locator_eq (XINT (x, i), XINT (y, i)))
+		break;
+#endif
+	      return 0;
+	    }
 	  break;
 
 	case 'V':

=== added file 'gcc/testsuite/gcc.target/i386/pr46865-1.c'
--- old/gcc/testsuite/gcc.target/i386/pr46865-1.c	1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/i386/pr46865-1.c	2010-12-13 10:05:52 +0000
@@ -0,0 +1,31 @@
+/* PR rtl-optimization/46865 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern unsigned long f;
+
+#define m1(f)							\
+  if (f & 1)							\
+    asm volatile ("nop /* asmnop */\n");			\
+  else								\
+    asm volatile ("nop /* asmnop */\n");
+
+#define m2(f)							\
+  if (f & 1)							\
+    asm volatile ("nop /* asmnop */\n" : : "i" (6) : "cx");	\
+  else								\
+    asm volatile ("nop /* asmnop */\n" : : "i" (6) : "cx");
+
+void
+foo (void)
+{
+  m1 (f);
+}
+
+void
+bar (void)
+{
+  m2 (f);
+}
+
+/* { dg-final { scan-assembler-times "asmnop" 2 } } */

=== added file 'gcc/testsuite/gcc.target/i386/pr46865-2.c'
--- old/gcc/testsuite/gcc.target/i386/pr46865-2.c	1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.target/i386/pr46865-2.c	2010-12-13 10:05:52 +0000
@@ -0,0 +1,32 @@
+/* PR rtl-optimization/46865 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -save-temps" } */
+
+extern unsigned long f;
+
+#define m1(f)							\
+  if (f & 1)							\
+    asm volatile ("nop /* asmnop */\n");			\
+  else								\
+    asm volatile ("nop /* asmnop */\n");
+
+#define m2(f)							\
+  if (f & 1)							\
+    asm volatile ("nop /* asmnop */\n" : : "i" (6) : "cx");	\
+  else								\
+    asm volatile ("nop /* asmnop */\n" : : "i" (6) : "cx");
+
+void
+foo (void)
+{
+  m1 (f);
+}
+
+void
+bar (void)
+{
+  m2 (f);
+}
+
+/* { dg-final { scan-assembler-times "asmnop" 2 } } */
+/* { dg-final { cleanup-saved-temps } } */