1 Upstream-Status: Inappropriate [Backport]
2 From 99347f932bdf7d9b0bf8a4f36737ed128813c1a9 Mon Sep 17 00:00:00 2001
3 From: meissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>
4 Date: Thu, 28 Apr 2011 22:39:59 +0000
5 Subject: [PATCH 196/200] Backport 4.7 patchtes to 4.6
7 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@173137 138bc75d-0d04-0410-961f-82ee72b054a4
9 index d7357ee..d38ec9a 100644
10 --- a/gcc/config/rs6000/altivec.md
11 +++ b/gcc/config/rs6000/altivec.md
14 (define_expand "vec_extract_evenv4si"
15 [(set (match_operand:V4SI 0 "register_operand" "")
16 - (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "")
17 + (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "")
18 (match_operand:V4SI 2 "register_operand" "")]
19 UNSPEC_EXTEVEN_V4SI))]
23 (define_expand "vec_extract_evenv4sf"
24 [(set (match_operand:V4SF 0 "register_operand" "")
25 - (unspec:V8HI [(match_operand:V4SF 1 "register_operand" "")
26 + (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "")
27 (match_operand:V4SF 2 "register_operand" "")]
28 UNSPEC_EXTEVEN_V4SF))]
33 (define_expand "vec_extract_evenv8hi"
34 - [(set (match_operand:V4SI 0 "register_operand" "")
35 + [(set (match_operand:V8HI 0 "register_operand" "")
36 (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "")
37 (match_operand:V8HI 2 "register_operand" "")]
38 UNSPEC_EXTEVEN_V8HI))]
42 (define_expand "vec_extract_evenv16qi"
43 - [(set (match_operand:V4SI 0 "register_operand" "")
44 - (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "")
45 - (match_operand:V16QI 2 "register_operand" "")]
46 + [(set (match_operand:V16QI 0 "register_operand" "")
47 + (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "")
48 + (match_operand:V16QI 2 "register_operand" "")]
49 UNSPEC_EXTEVEN_V16QI))]
54 (define_expand "vec_extract_oddv4si"
55 [(set (match_operand:V4SI 0 "register_operand" "")
56 - (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "")
57 + (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "")
58 (match_operand:V4SI 2 "register_operand" "")]
63 (define_expand "vec_extract_oddv4sf"
64 [(set (match_operand:V4SF 0 "register_operand" "")
65 - (unspec:V8HI [(match_operand:V4SF 1 "register_operand" "")
66 + (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "")
67 (match_operand:V4SF 2 "register_operand" "")]
70 diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md
71 index 5335d9d..cbdfd58 100644
72 --- a/gcc/config/rs6000/vector.md
73 +++ b/gcc/config/rs6000/vector.md
75 ;; Under VSX, vectors of 4/8 byte alignments do not need to be aligned
76 ;; since the load already handles it.
77 (define_expand "movmisalign<mode>"
78 - [(set (match_operand:VEC_N 0 "vfloat_operand" "")
79 - (match_operand:VEC_N 1 "vfloat_operand" ""))]
80 + [(set (match_operand:VEC_N 0 "nonimmediate_operand" "")
81 + (match_operand:VEC_N 1 "any_operand" ""))]
82 "VECTOR_MEM_VSX_P (<MODE>mode) && TARGET_ALLOW_MOVMISALIGN"
85 index 8496460..8c0da54 100644
86 --- a/gcc/testsuite/gcc.dg/torture/va-arg-25.c
87 +++ b/gcc/testsuite/gcc.dg/torture/va-arg-25.c
90 /* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
91 /* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */
92 +/* { dg-options "-mabi=altivec -maltivec" { target { powerpc-*-* powerpc64-*-* } } } */
93 +/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* } } } */
97 diff --git a/gcc/testsuite/gcc.dg/torture/vector-1.c b/gcc/testsuite/gcc.dg/torture/vector-1.c
98 index 9ab78aa..205fee6 100644
99 --- a/gcc/testsuite/gcc.dg/torture/vector-1.c
100 +++ b/gcc/testsuite/gcc.dg/torture/vector-1.c
103 /* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
104 /* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */
105 +/* { dg-options "-mabi=altivec" { target { powerpc-*-* powerpc64-*-* } } } */
106 +/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* } } } */
108 #define vector __attribute__((vector_size(16) ))
110 diff --git a/gcc/testsuite/gcc.dg/torture/vector-2.c b/gcc/testsuite/gcc.dg/torture/vector-2.c
111 index bff9f82..6cc56cf 100644
112 --- a/gcc/testsuite/gcc.dg/torture/vector-2.c
113 +++ b/gcc/testsuite/gcc.dg/torture/vector-2.c
116 /* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
117 /* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */
118 +/* { dg-options "-mabi=altivec" { target { powerpc-*-* powerpc64-*-* } } } */
119 +/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* } } } */
121 #define vector __attribute__((vector_size(16) ))
123 diff --git a/gcc/testsuite/gcc.target/powerpc/pr48192.c b/gcc/testsuite/gcc.target/powerpc/pr48192.c
125 index 0000000..5159260
127 +++ b/gcc/testsuite/gcc.target/powerpc/pr48192.c
129 +/* { dg-do compile } */
130 +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
131 +/* { dg-require-effective-target powerpc_vsx_ok } */
132 +/* { dg-options "-O3 -mcpu=power7 -std=gnu89" } */
134 +/* Make sure that the conditional macros vector, bool, and pixel are not
135 + considered as being defined. */
138 +#error "bool is considered defined"
142 +#error "vector is considered defined"
146 +#error "pixel is condsidered defined"
150 +#error "bool is considered defined"
154 +#error "vector is considered defined"
158 +#error "pixel is condsidered defined"
163 +#error "bool is considered defined"
168 +#error "vector is considered defined"
173 +#error "pixel is condsidered defined"
176 +#define bool long double
178 index 85a17b1..f244ae5 100644
179 --- a/libcpp/directives.c
180 +++ b/libcpp/directives.c
181 @@ -1819,7 +1819,12 @@ do_ifdef (cpp_reader *pfile)
185 - skip = node->type != NT_MACRO;
186 + /* Do not treat conditional macros as being defined. This is due to
187 + the powerpc and spu ports using conditional macros for 'vector',
188 + 'bool', and 'pixel' to act as conditional keywords. This messes
189 + up tests like #ifndef bool. */
190 + skip = (node->type != NT_MACRO
191 + || ((node->flags & NODE_CONDITIONAL) != 0));
192 _cpp_mark_macro_used (node);
193 if (!(node->flags & NODE_USED))
195 @@ -1860,7 +1865,12 @@ do_ifndef (cpp_reader *pfile)
199 - skip = node->type == NT_MACRO;
200 + /* Do not treat conditional macros as being defined. This is due to
201 + the powerpc and spu ports using conditional macros for 'vector',
202 + 'bool', and 'pixel' to act as conditional keywords. This messes
203 + up tests like #ifndef bool. */
204 + skip = (node->type == NT_MACRO
205 + && ((node->flags & NODE_CONDITIONAL) == 0));
206 _cpp_mark_macro_used (node);
207 if (!(node->flags & NODE_USED))
209 diff --git a/libcpp/expr.c b/libcpp/expr.c
210 index d2fec2a..3c36127 100644
213 @@ -720,10 +720,15 @@ parse_defined (cpp_reader *pfile)
215 pfile->state.prevent_expansion--;
217 + /* Do not treat conditional macros as being defined. This is due to the
218 + powerpc and spu ports using conditional macros for 'vector', 'bool', and
219 + 'pixel' to act as conditional keywords. This messes up tests like #ifndef
221 result.unsignedp = false;
223 result.overflow = false;
224 - result.low = node && node->type == NT_MACRO;
225 + result.low = (node && node->type == NT_MACRO
226 + && (node->flags & NODE_CONDITIONAL) == 0);