]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Driver/ppc-features.cpp
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / Driver / ppc-features.cpp
1 // Check that we error when -faltivec is specified on non-ppc platforms.
2
3 // RUN: %clang -target powerpc-unk-unk -faltivec -fsyntax-only %s
4 // RUN: %clang -target powerpc64-linux-gnu -faltivec -fsyntax-only %s
5 // RUN: %clang -target powerpc64-linux-gnu -maltivec -fsyntax-only %s
6
7 // RUN: not %clang -target i386-pc-win32 -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
8 // RUN: not %clang -target x86_64-unknown-freebsd -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
9 // RUN: not %clang -target armv6-apple-darwin -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
10 // RUN: not %clang -target armv7-apple-darwin -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
11 // RUN: not %clang -target mips-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
12 // RUN: not %clang -target mips64-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
13 // RUN: not %clang -target sparc-unknown-solaris -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
14
15 // check -msoft-float option for ppc32
16 // RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT %s
17 // CHECK-SOFTFLOAT: "-target-feature" "-hard-float"
18
19 // check -mfloat-abi=soft option for ppc32
20 // RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=soft -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABISOFT %s
21 // CHECK-FLOATABISOFT: "-target-feature" "-hard-float"
22
23 // check -mhard-float option for ppc32
24 // RUN: %clang -target powerpc-unknown-linux-gnu %s -mhard-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-HARDFLOAT %s
25 // CHECK-HARDFLOAT-NOT: "-target-feature" "-hard-float"
26
27 // check -mfloat-abi=hard option for ppc32
28 // RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=hard -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABIHARD %s
29 // CHECK-FLOATABIHARD-NOT: "-target-feature" "-hard-float"
30
31 // check combine -mhard-float -msoft-float option for ppc32
32 // RUN: %clang -target powerpc-unknown-linux-gnu %s -mhard-float -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-HARDSOFT %s
33 // CHECK-HARDSOFT: "-target-feature" "-hard-float"
34
35 // check combine -msoft-float -mhard-float option for ppc32
36 // RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -mhard-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTHARD %s
37 // CHECK-SOFTHARD-NOT: "-target-feature" "-hard-float"
38
39 // check -mfloat-abi=x option
40 // RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=x -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-ERRMSG %s
41 // CHECK-ERRMSG: error: invalid float ABI '-mfloat-abi=x'
42
43 // check -msoft-float option for ppc64
44 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT64 %s
45 // CHECK-SOFTFLOAT64: "-target-feature" "-hard-float"
46
47 // check -mfloat-abi=soft option for ppc64
48 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mfloat-abi=soft -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABISOFT64 %s
49 // CHECK-FLOATABISOFT64: "-target-feature" "-hard-float"
50
51 // check -msoft-float option for ppc64
52 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT64le %s
53 // CHECK-SOFTFLOAT64le: "-target-feature" "-hard-float"
54
55 // check -mfloat-abi=soft option for ppc64
56 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -mfloat-abi=soft -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABISOFT64le %s
57 // CHECK-FLOATABISOFT64le: "-target-feature" "-hard-float"
58
59 // CHECK: invalid argument '-faltivec' only allowed with 'ppc/ppc64/ppc64le'
60
61 // Check that -fno-altivec and -mno-altivec correctly disable the altivec
62 // target feature on powerpc.
63
64 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-1 %s
65 // CHECK-1: "-target-feature" "-altivec"
66
67 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-2 %s
68 // CHECK-2: "-target-feature" "-altivec"
69
70 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -faltivec -mno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-3 %s
71 // CHECK-3: "-target-feature" "-altivec"
72
73 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -maltivec -fno-altivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-4 %s
74 // CHECK-4: "-target-feature" "-altivec"
75
76 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-altivec -faltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-5 %s
77 // CHECK-5-NOT: "-target-feature" "-altivec"
78
79 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -maltivec -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-6 %s
80 // CHECK-6-NOT: "-target-feature" "-altivec"
81
82 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=7400 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-7 %s
83 // CHECK-7: "-target-feature" "-altivec"
84
85 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g4 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-8 %s
86 // CHECK-8: "-target-feature" "-altivec"
87
88 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=7450 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-9 %s
89 // CHECK-9: "-target-feature" "-altivec"
90
91 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g4+ -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-10 %s
92 // CHECK-10: "-target-feature" "-altivec"
93
94 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=970 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-11 %s
95 // CHECK-11: "-target-feature" "-altivec"
96
97 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=g5 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-12 %s
98 // CHECK-12: "-target-feature" "-altivec"
99
100 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr6 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-13 %s
101 // CHECK-13: "-target-feature" "-altivec"
102
103 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr7 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-14 %s
104 // CHECK-14: "-target-feature" "-altivec"
105
106 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=pwr8 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-15 %s
107 // CHECK-15: "-target-feature" "-altivec"
108
109 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -fno-altivec -mcpu=ppc64 -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-16 %s
110 // CHECK-16: "-target-feature" "-altivec"
111
112 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-qpx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOQPX %s
113 // CHECK-NOQPX: "-target-feature" "-qpx"
114
115 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-qpx -mqpx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-QPX %s
116 // CHECK-QPX-NOT: "-target-feature" "-qpx"
117
118 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-mfcrf -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOMFCRF %s
119 // CHECK-NOMFCRF: "-target-feature" "-mfocrf"
120
121 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-mfcrf -mmfcrf -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-MFCRF %s
122 // CHECK-MFCRF: "-target-feature" "+mfocrf"
123
124 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-isel -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOISEL %s
125 // CHECK-NOISEL: "-target-feature" "-isel"
126
127 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-isel -misel -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-ISEL %s
128 // CHECK-ISEL: "-target-feature" "+isel"
129
130 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-popcntd -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOPOPCNTD %s
131 // CHECK-NOPOPCNTD: "-target-feature" "-popcntd"
132
133 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-popcntd -mpopcntd -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-POPCNTD %s
134 // CHECK-POPCNTD: "-target-feature" "+popcntd"
135
136 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-fprnd -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOFPRND %s
137 // CHECK-NOFPRND: "-target-feature" "-fprnd"
138
139 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-fprnd -mfprnd -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-FPRND %s
140 // CHECK-FPRND: "-target-feature" "+fprnd"
141
142 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-cmpb -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOCMPB %s
143 // CHECK-NOCMPB: "-target-feature" "-cmpb"
144
145 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-cmpb -mcmpb -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-CMPB %s
146 // CHECK-CMPB: "-target-feature" "+cmpb"
147
148 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-vsx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOVSX %s
149 // CHECK-NOVSX: "-target-feature" "-vsx"
150
151 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-vsx -mvsx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-VSX %s
152 // CHECK-VSX: "-target-feature" "+vsx"
153
154 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-power8-vector -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOP8VECTOR %s
155 // CHECK-NOP8VECTOR: "-target-feature" "-power8-vector"
156
157 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-power8-vector -mpower8-vector -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-P8VECTOR %s
158 // CHECK-P8VECTOR: "-target-feature" "+power8-vector"
159
160 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-crbits -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOCRBITS %s
161 // CHECK-NOCRBITS: "-target-feature" "-crbits"
162
163 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-crbits -mcrbits -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-CRBITS %s
164 // CHECK-CRBITS: "-target-feature" "+crbits"
165
166 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-longcall -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOLONGCALL %s
167 // CHECK-NOLONGCALL: "-target-feature" "-longcall"
168
169 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-longcall -mlongcall -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-LONGCALL %s
170 // CHECK-LONGCALL: "-target-feature" "+longcall"
171
172 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-invariant-function-descriptors -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOINVFUNCDESC %s
173 // CHECK-NOINVFUNCDESC: "-target-feature" "-invariant-function-descriptors"
174
175 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-invariant-function-descriptors -minvariant-function-descriptors -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-INVFUNCDESC %s
176 // CHECK-INVFUNCDESC: "-target-feature" "+invariant-function-descriptors"
177
178 // Assembler features
179 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o -no-integrated-as 2>&1 | FileCheck -check-prefix=CHECK_BE_AS_ARGS %s
180 // CHECK_BE_AS_ARGS: "-mppc64"
181 // CHECK_BE_AS_ARGS: "-many"
182
183 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o -no-integrated-as 2>&1 | FileCheck -check-prefix=CHECK_LE_AS_ARGS %s
184 // CHECK_LE_AS_ARGS: "-mppc64"
185 // CHECK_LE_AS_ARGS: "-many"
186 // CHECK_LE_AS_ARGS: "-mlittle-endian"
187
188 // linker features
189 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_BE_LD_ARGS %s
190 // CHECK_BE_LD_ARGS: "elf64ppc"
191
192 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_LE_LD_ARGS %s
193 // CHECK_LE_LD_ARGS: "elf64lppc"
194
195 // OpenMP features
196 // RUN: %clang -target powerpc-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
197 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
198 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s
199 // CHECK_OPENMP_TLS-NOT: "-fnoopenmp-use-tls"