xref: /aosp_15_r20/external/clang/test/Driver/arm-mfpu.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // Test that different values of -mfpu pick correct ARM FPU target-feature(s).
2*67e74705SXin Li 
3*67e74705SXin Li // RUN: %clang -target arm-linux-eabi %s -### -o %t.o 2>&1 \
4*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-DEFAULT %s
5*67e74705SXin Li // CHECK-DEFAULT-NOT: "-target-feature" "+vfp2"
6*67e74705SXin Li // CHECK-DEFAULT-NOT: "-target-feature" "+vfp3"
7*67e74705SXin Li // CHECK-DEFAULT-NOT: "-target-feature" "+d16"
8*67e74705SXin Li // CHECK-DEFAULT-NOT: "-target-feature" "+neon"
9*67e74705SXin Li 
10*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=fpa %s -### -o %t.o 2>&1 \
11*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
12*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=fpe2 %s -### -o %t.o 2>&1 \
13*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
14*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=fpe3 %s -### -o %t.o 2>&1 \
15*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
16*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=maverick %s -### -o %t.o 2>&1 \
17*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
18*67e74705SXin Li // CHECK-FPA: error: {{.*}} does not support '-mfpu={{fpa|fpe|fpe2|fpe3|maverick}}'
19*67e74705SXin Li 
20*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfp %s -### -o %t.o 2>&1 \
21*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP %s
22*67e74705SXin Li // CHECK-VFP: "-target-feature" "+vfp2"
23*67e74705SXin Li // CHECK-VFP: "-target-feature" "-vfp3"
24*67e74705SXin Li // CHECK-VFP: "-target-feature" "-vfp4"
25*67e74705SXin Li // CHECK-VFP: "-target-feature" "-fp-armv8"
26*67e74705SXin Li // CHECK-VFP: "-target-feature" "-neon"
27*67e74705SXin Li 
28*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfp3 %s -### -o %t.o 2>&1 \
29*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP3 %s
30*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3 %s -### -o %t.o 2>&1 \
31*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP3 %s
32*67e74705SXin Li // CHECK-VFP3: "-target-feature" "+vfp3"
33*67e74705SXin Li // CHECK-VFP3: "-target-feature" "-vfp4"
34*67e74705SXin Li // CHECK-VFP3: "-target-feature" "-fp-armv8"
35*67e74705SXin Li // CHECK-VFP3: "-target-feature" "-neon"
36*67e74705SXin Li 
37*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-fp16 %s -### -o %t.o 2>&1 \
38*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP3-FP16 %s
39*67e74705SXin Li // CHECK-VFP3-FP16: "-target-feature" "-fp-only-sp"
40*67e74705SXin Li // CHECK-VFP3-FP16: "-target-feature" "-d16"
41*67e74705SXin Li // CHECK-VFP3-FP16: "-target-feature" "+vfp3"
42*67e74705SXin Li // CHECK-VFP3-FP16: "-target-feature" "+fp16"
43*67e74705SXin Li // CHECK-VFP3-FP16: "-target-feature" "-vfp4"
44*67e74705SXin Li // CHECK-VFP3-FP16: "-target-feature" "-fp-armv8"
45*67e74705SXin Li // CHECK-VFP3-FP16: "-target-feature" "-neon"
46*67e74705SXin Li // CHECK-VFP3-FP16: "-target-feature" "-crypto"
47*67e74705SXin Li 
48*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfp3-d16 %s -### -o %t.o 2>&1 \
49*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16 %s
50*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16 %s -### -o %t.o 2>&1 \
51*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16 %s
52*67e74705SXin Li // CHECK-VFP3-D16: "-target-feature" "-fp-only-sp"
53*67e74705SXin Li // CHECK-VFP3-D16: "-target-feature" "+d16"
54*67e74705SXin Li // CHECK-VFP3-D16: "-target-feature" "+vfp3"
55*67e74705SXin Li // CHECK-VFP3-D16: "-target-feature" "-vfp4"
56*67e74705SXin Li // CHECK-VFP3-D16: "-target-feature" "-fp-armv8"
57*67e74705SXin Li // CHECK-VFP3-D16: "-target-feature" "-neon"
58*67e74705SXin Li 
59*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16-fp16 %s -### -o %t.o 2>&1 \
60*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16-FP16 %s
61*67e74705SXin Li // CHECK-VFP3-D16-FP16: "-target-feature" "-fp-only-sp"
62*67e74705SXin Li // CHECK-VFP3-D16-FP16: "-target-feature" "+d16"
63*67e74705SXin Li // CHECK-VFP3-D16-FP16: "-target-feature" "+vfp3"
64*67e74705SXin Li // CHECK-VFP3-D16-FP16: "-target-feature" "+fp16"
65*67e74705SXin Li // CHECK-VFP3-D16-FP16: "-target-feature" "-vfp4"
66*67e74705SXin Li // CHECK-VFP3-D16-FP16: "-target-feature" "-fp-armv8"
67*67e74705SXin Li // CHECK-VFP3-D16-FP16: "-target-feature" "-neon"
68*67e74705SXin Li // CHECK-VFP3-D16-FP16: "-target-feature" "-crypto"
69*67e74705SXin Li 
70*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3xd %s -### -o %t.o 2>&1 \
71*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP3XD %s
72*67e74705SXin Li // CHECK-VFP3XD: "-target-feature" "+fp-only-sp"
73*67e74705SXin Li // CHECK-VFP3XD: "-target-feature" "+d16"
74*67e74705SXin Li // CHECK-VFP3XD: "-target-feature" "+vfp3"
75*67e74705SXin Li // CHECK-VFP3XD: "-target-feature" "-fp16"
76*67e74705SXin Li // CHECK-VFP3XD: "-target-feature" "-vfp4"
77*67e74705SXin Li // CHECK-VFP3XD: "-target-feature" "-fp-armv8"
78*67e74705SXin Li // CHECK-VFP3XD: "-target-feature" "-neon"
79*67e74705SXin Li // CHECK-VFP3XD: "-target-feature" "-crypto"
80*67e74705SXin Li 
81*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3xd-fp16 %s -### -o %t.o 2>&1 \
82*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP3XD-FP16 %s
83*67e74705SXin Li // CHECK-VFP3XD-FP16: "-target-feature" "+fp-only-sp"
84*67e74705SXin Li // CHECK-VFP3XD-FP16: "-target-feature" "+d16"
85*67e74705SXin Li // CHECK-VFP3XD-FP16: "-target-feature" "+vfp3"
86*67e74705SXin Li // CHECK-VFP3XD-FP16: "-target-feature" "+fp16"
87*67e74705SXin Li // CHECK-VFP3XD-FP16: "-target-feature" "-vfp4"
88*67e74705SXin Li // CHECK-VFP3XD-FP16: "-target-feature" "-fp-armv8"
89*67e74705SXin Li // CHECK-VFP3XD-FP16: "-target-feature" "-neon"
90*67e74705SXin Li // CHECK-VFP3XD-FP16: "-target-feature" "-crypto"
91*67e74705SXin Li 
92*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfp4 %s -### -o %t.o 2>&1 \
93*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP4 %s
94*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4 %s -### -o %t.o 2>&1 \
95*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP4 %s
96*67e74705SXin Li // CHECK-VFP4: "-target-feature" "+vfp4"
97*67e74705SXin Li // CHECK-VFP4: "-target-feature" "-fp-armv8"
98*67e74705SXin Li // CHECK-VFP4: "-target-feature" "-neon"
99*67e74705SXin Li 
100*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfp4-d16 %s -### -o %t.o 2>&1 \
101*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP4-D16 %s
102*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4-d16 %s -### -o %t.o 2>&1 \
103*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-VFP4-D16 %s
104*67e74705SXin Li // CHECK-VFP4-D16: "-target-feature" "-fp-only-sp"
105*67e74705SXin Li // CHECK-VFP4-D16: "-target-feature" "+d16"
106*67e74705SXin Li // CHECK-VFP4-D16: "-target-feature" "+vfp4"
107*67e74705SXin Li // CHECK-VFP4-D16: "-target-feature" "-fp-armv8"
108*67e74705SXin Li // CHECK-VFP4-D16: "-target-feature" "-neon"
109*67e74705SXin Li 
110*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=fp4-sp-d16 %s -### -o %t.o 2>&1 \
111*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FP4-SP-D16 %s
112*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=fpv4-sp-d16 %s -### -o %t.o 2>&1 \
113*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FP4-SP-D16 %s
114*67e74705SXin Li // CHECK-FP4-SP-D16: "-target-feature" "+fp-only-sp"
115*67e74705SXin Li // CHECK-FP4-SP-D16: "-target-feature" "+d16"
116*67e74705SXin Li // CHECK-FP4-SP-D16: "-target-feature" "+vfp4"
117*67e74705SXin Li // CHECK-FP4-SP-D16: "-target-feature" "-fp-armv8"
118*67e74705SXin Li // CHECK-FP4-SP-D16: "-target-feature" "-neon"
119*67e74705SXin Li 
120*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=fp5-sp-d16 %s -### -o %t.o 2>&1 \
121*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s
122*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-sp-d16 %s -### -o %t.o 2>&1 \
123*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s
124*67e74705SXin Li // CHECK-FP5-SP-D16: "-target-feature" "+fp-only-sp"
125*67e74705SXin Li // CHECK-FP5-SP-D16: "-target-feature" "+d16"
126*67e74705SXin Li // CHECK-FP5-SP-D16: "-target-feature" "+fp-armv8"
127*67e74705SXin Li // CHECK-FP5-SP-D16: "-target-feature" "-neon"
128*67e74705SXin Li // CHECK-FP5-SP-D16: "-target-feature" "-crypto"
129*67e74705SXin Li 
130*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=fp5-dp-d16 %s -### -o %t.o 2>&1 \
131*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s
132*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-dp-d16 %s -### -o %t.o 2>&1 \
133*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s
134*67e74705SXin Li // CHECK-FP5-DP-D16: "-target-feature" "-fp-only-sp"
135*67e74705SXin Li // CHECK-FP5-DP-D16: "-target-feature" "+d16"
136*67e74705SXin Li // CHECK-FP5-DP-D16: "-target-feature" "+fp-armv8"
137*67e74705SXin Li // CHECK-FP5-DP-D16: "-target-feature" "-neon"
138*67e74705SXin Li // CHECK-FP5-DP-D16: "-target-feature" "-crypto"
139*67e74705SXin Li 
140*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=neon %s -### -o %t.o 2>&1 \
141*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-NEON %s
142*67e74705SXin Li // CHECK-NEON: "-target-feature" "+neon"
143*67e74705SXin Li 
144*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=neon-fp16 %s -### -o %t.o 2>&1 \
145*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-NEON-FP16 %s
146*67e74705SXin Li // CHECK-NEON-FP16: "-target-feature" "-fp-only-sp"
147*67e74705SXin Li // CHECK-NEON-FP16: "-target-feature" "-d16"
148*67e74705SXin Li // CHECK-NEON-FP16: "-target-feature" "+vfp3"
149*67e74705SXin Li // CHECK-NEON-FP16: "-target-feature" "+fp16"
150*67e74705SXin Li // CHECK-NEON-FP16: "-target-feature" "-vfp4"
151*67e74705SXin Li // CHECK-NEON-FP16: "-target-feature" "-fp-armv8"
152*67e74705SXin Li // CHECK-NEON-FP16: "-target-feature" "+neon"
153*67e74705SXin Li // CHECK-NEON-FP16: "-target-feature" "-crypto"
154*67e74705SXin Li 
155*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv3 %s -### -o %t.o 2>&1 \
156*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-NEON-VFPV3 %s
157*67e74705SXin Li // CHECK-NEON-VFPV3: "-target-feature" "+neon"
158*67e74705SXin Li 
159*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv4 %s -### -o %t.o 2>&1 \
160*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-NEON-VFPV4 %s
161*67e74705SXin Li // CHECK-NEON-VFPV4: "-target-feature" "+vfp4"
162*67e74705SXin Li // CHECK-NEON-VFPV4: "-target-feature" "+neon"
163*67e74705SXin Li 
164*67e74705SXin Li // RUN: %clang -target arm-linux-eabi -msoft-float %s -### -o %t.o 2>&1 \
165*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-SOFT-FLOAT %s
166*67e74705SXin Li // CHECK-SOFT-FLOAT: "-target-feature" "-neon"
167*67e74705SXin Li 
168*67e74705SXin Li // RUN: %clang -target armv8 %s -### 2>&1 \
169*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-ARMV8-DEFAULT-SOFT-FP %s
170*67e74705SXin Li // CHECK-ARMV8-DEFAULT-SOFT-FP: "-target-feature" "-neon"
171*67e74705SXin Li // CHECK-ARMV8-DEFAULT-SOFT-FP: "-target-feature" "-crypto"
172*67e74705SXin Li 
173*67e74705SXin Li // RUN: %clang -target armv8 -mfpu=fp-armv8 %s -### 2>&1 \
174*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-ARMV8-SOFT-FLOAT %s
175*67e74705SXin Li // CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "+fp-armv8"
176*67e74705SXin Li // CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "-neon"
177*67e74705SXin Li // CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "-crypto"
178*67e74705SXin Li 
179*67e74705SXin Li // RUN: %clang -target armv8-linux-gnueabihf -mfpu=fp-armv8 %s -### 2>&1 \
180*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-FP-ARMV8 %s
181*67e74705SXin Li // CHECK-FP-ARMV8-NOT: "-target-feature" "+neon"
182*67e74705SXin Li // CHECK-FP-ARMV8: "-target-feature" "+fp-armv8"
183*67e74705SXin Li // CHECK-FP-ARMV8: "-target-feature" "-neon"
184*67e74705SXin Li // CHECK-FP-ARMV8: "-target-feature" "-crypto"
185*67e74705SXin Li 
186*67e74705SXin Li // RUN: %clang -target armv8-linux-gnueabihf -mfpu=neon-fp-armv8 %s -### 2>&1 \
187*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-NEON-FP-ARMV8 %s
188*67e74705SXin Li // CHECK-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
189*67e74705SXin Li // CHECK-NEON-FP-ARMV8: "-target-feature" "+neon"
190*67e74705SXin Li // CHECK-NEON-FP-ARMV8: "-target-feature" "-crypto"
191*67e74705SXin Li 
192*67e74705SXin Li // RUN: %clang -target armv8-linux-gnueabihf -mfpu=crypto-neon-fp-armv8 %s -### 2>&1 \
193*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-CRYPTO-NEON-FP-ARMV8 %s
194*67e74705SXin Li // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
195*67e74705SXin Li // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+crypto"
196*67e74705SXin Li 
197*67e74705SXin Li // RUN: %clang -target armv8-linux-gnueabi -mfpu=none %s -### 2>&1 \
198*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-NO-FP %s
199*67e74705SXin Li // CHECK-NO-FP: "-target-feature" "-fp-only-sp"
200*67e74705SXin Li // CHECK-NO-FP: "-target-feature" "-d16"
201*67e74705SXin Li // CHECK-NO-FP: "-target-feature" "-vfp2"
202*67e74705SXin Li // CHECK-NO-FP: "-target-feature" "-vfp3"
203*67e74705SXin Li // CHECK-NO-FP: "-target-feature" "-vfp4"
204*67e74705SXin Li // CHECK-NO-FP: "-target-feature" "-fp-armv8"
205*67e74705SXin Li // CHECK-NO-FP: "-target-feature" "-neon"
206*67e74705SXin Li // CHECK-NO-FP: "-target-feature" "-crypto"
207*67e74705SXin Li 
208*67e74705SXin Li // RUN: %clang -target arm-linux-gnueabihf %s -### 2>&1 \
209*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-HF %s
210*67e74705SXin Li // RUN: %clang -target arm-linux-musleabihf %s -### 2>&1 \
211*67e74705SXin Li // RUN:   | FileCheck --check-prefix=CHECK-HF %s
212*67e74705SXin Li // CHECK-HF: "-target-cpu" "arm1176jzf-s"
213*67e74705SXin Li 
214*67e74705SXin Li // RUN: %clang -target armv7-apple-darwin -x assembler %s -### -c 2>&1 \
215*67e74705SXin Li // RUN:   | FileCheck --check-prefix=ASM %s
216*67e74705SXin Li // ASM-NOT: -target-feature
217