Clang Project

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