1 // Test that different values of -mfpu pick correct ARM FPU target-feature(s).
2 
3 // RUN: %clang -target arm-linux-eabi %s -### -o %t.o 2>&1 \
4 // RUN:   | FileCheck --check-prefix=CHECK-DEFAULT %s
5 // CHECK-DEFAULT-NOT: "-target-feature" "+vfp2"
6 // CHECK-DEFAULT-NOT: "-target-feature" "+vfp3"
7 // CHECK-DEFAULT-NOT: "-target-feature" "+d16"
8 // CHECK-DEFAULT-NOT: "-target-feature" "+neon"
9 
10 // RUN: %clang -target arm-linux-eabi -mfpu=fpa %s -### -o %t.o 2>&1 \
11 // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
12 // RUN: %clang -target arm-linux-eabi -mfpu=fpe2 %s -### -o %t.o 2>&1 \
13 // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
14 // RUN: %clang -target arm-linux-eabi -mfpu=fpe3 %s -### -o %t.o 2>&1 \
15 // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
16 // RUN: %clang -target arm-linux-eabi -mfpu=maverick %s -### -o %t.o 2>&1 \
17 // RUN:   | FileCheck --check-prefix=CHECK-FPA %s
18 // CHECK-FPA: "-target-feature" "-vfp2"
19 // CHECK-FPA: "-target-feature" "-vfp3"
20 // CHECK-FPA: "-target-feature" "-neon"
21 
22 // RUN: %clang -target arm-linux-eabi -mfpu=vfp %s -### -o %t.o 2>&1 \
23 // RUN:   | FileCheck --check-prefix=CHECK-VFP %s
24 // CHECK-VFP: "-target-feature" "+vfp2"
25 // CHECK-VFP: "-target-feature" "-neon"
26 
27 // RUN: %clang -target arm-linux-eabi -mfpu=vfp3 %s -### -o %t.o 2>&1 \
28 // RUN:   | FileCheck --check-prefix=CHECK-VFP3 %s
29 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3 %s -### -o %t.o 2>&1 \
30 // RUN:   | FileCheck --check-prefix=CHECK-VFP3 %s
31 // CHECK-VFP3: "-target-feature" "+vfp3"
32 // CHECK-VFP3: "-target-feature" "-neon"
33 
34 // RUN: %clang -target arm-linux-eabi -mfpu=vfp3-d16 %s -### -o %t.o 2>&1 \
35 // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16 %s
36 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16 %s -### -o %t.o 2>&1 \
37 // RUN:   | FileCheck --check-prefix=CHECK-VFP3-D16 %s
38 // CHECK-VFP3-D16: "-target-feature" "+vfp3"
39 // CHECK-VFP3-D16: "-target-feature" "+d16"
40 // CHECK-VFP3-D16: "-target-feature" "-neon"
41 
42 // RUN: %clang -target arm-linux-eabi -mfpu=vfp4 %s -### -o %t.o 2>&1 \
43 // RUN:   | FileCheck --check-prefix=CHECK-VFP4 %s
44 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4 %s -### -o %t.o 2>&1 \
45 // RUN:   | FileCheck --check-prefix=CHECK-VFP4 %s
46 // CHECK-VFP4: "-target-feature" "+vfp4"
47 // CHECK-VFP4: "-target-feature" "-neon"
48 
49 // RUN: %clang -target arm-linux-eabi -mfpu=vfp4-d16 %s -### -o %t.o 2>&1 \
50 // RUN:   | FileCheck --check-prefix=CHECK-VFP4-D16 %s
51 // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4-d16 %s -### -o %t.o 2>&1 \
52 // RUN:   | FileCheck --check-prefix=CHECK-VFP4-D16 %s
53 // CHECK-VFP4-D16: "-target-feature" "+vfp4"
54 // CHECK-VFP4-D16: "-target-feature" "+d16"
55 // CHECK-VFP4-D16: "-target-feature" "-neon"
56 
57 // RUN: %clang -target arm-linux-eabi -mfpu=fp4-sp-d16 %s -### -o %t.o 2>&1 \
58 // RUN:   | FileCheck --check-prefix=CHECK-FP4-SP-D16 %s
59 // RUN: %clang -target arm-linux-eabi -mfpu=fpv4-sp-d16 %s -### -o %t.o 2>&1 \
60 // RUN:   | FileCheck --check-prefix=CHECK-FP4-SP-D16 %s
61 // CHECK-FP4-SP-D16: "-target-feature" "+vfp4"
62 // CHECK-FP4-SP-D16: "-target-feature" "+d16"
63 // CHECK-FP4-SP-D16: "-target-feature" "+fp-only-sp"
64 // CHECK-FP4-SP-D16: "-target-feature" "-neon"
65 
66 // RUN: %clang -target arm-linux-eabi -mfpu=fp5-sp-d16 %s -### -o %t.o 2>&1 \
67 // RUN:   | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s
68 // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-sp-d16 %s -### -o %t.o 2>&1 \
69 // RUN:   | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s
70 // CHECK-FP5-SP-D16: "-target-feature" "+fp-armv8"
71 // CHECK-FP5-SP-D16: "-target-feature" "+fp-only-sp"
72 // CHECK-FP5-SP-D16: "-target-feature" "+d16"
73 // CHECK-FP5-SP-D16: "-target-feature" "-neon"
74 // CHECK-FP5-SP-D16: "-target-feature" "-crypto"
75 
76 // RUN: %clang -target arm-linux-eabi -mfpu=fp5-dp-d16 %s -### -o %t.o 2>&1 \
77 // RUN:   | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s
78 // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-dp-d16 %s -### -o %t.o 2>&1 \
79 // RUN:   | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s
80 // CHECK-FP5-DP-D16: "-target-feature" "+fp-armv8"
81 // CHECK-FP5-DP-D16: "-target-feature" "+d16"
82 // CHECK-FP5-DP-D16: "-target-feature" "-neon"
83 // CHECK-FP5-DP-D16: "-target-feature" "-crypto"
84 
85 // RUN: %clang -target arm-linux-eabi -mfpu=neon %s -### -o %t.o 2>&1 \
86 // RUN:   | FileCheck --check-prefix=CHECK-NEON %s
87 // CHECK-NEON: "-target-feature" "+neon"
88 
89 // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv3 %s -### -o %t.o 2>&1 \
90 // RUN:   | FileCheck --check-prefix=CHECK-NEON-VFPV3 %s
91 // CHECK-NEON-VFPV3: "-target-feature" "+vfp3"
92 // CHECK-NEON-VFPV3: "-target-feature" "+neon"
93 
94 // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv4 %s -### -o %t.o 2>&1 \
95 // RUN:   | FileCheck --check-prefix=CHECK-NEON-VFPV4 %s
96 // CHECK-NEON-VFPV4: "-target-feature" "+neon"
97 // CHECK-NEON-VFPV4: "-target-feature" "+vfp4"
98 
99 // RUN: %clang -target arm-linux-eabi -msoft-float %s -### -o %t.o 2>&1 \
100 // RUN:   | FileCheck --check-prefix=CHECK-SOFT-FLOAT %s
101 // CHECK-SOFT-FLOAT: "-target-feature" "-neon"
102 
103 // RUN: %clang -target armv8 %s -### 2>&1 \
104 // RUN:   | FileCheck --check-prefix=CHECK-ARMV8-DEFAULT-SOFT-FP %s
105 // CHECK-ARMV8-DEFAULT-SOFT-FP: "-target-feature" "-neon"
106 // CHECK-ARMV8-DEFAULT-SOFT-FP: "-target-feature" "-crypto"
107 
108 // RUN: %clang -target armv8 -mfpu=fp-armv8 %s -### 2>&1 \
109 // RUN:   | FileCheck --check-prefix=CHECK-ARMV8-SOFT-FLOAT %s
110 // CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "+fp-armv8"
111 // CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "-neon"
112 // CHECK-ARMV8-SOFT-FLOAT: "-target-feature" "-crypto"
113 
114 // RUN: %clang -target armv8-linux-gnueabihf -mfpu=fp-armv8 %s -### 2>&1 \
115 // RUN:   | FileCheck --check-prefix=CHECK-FP-ARMV8 %s
116 // CHECK-FP-ARMV8-NOT: "-target-feature" "+neon"
117 // CHECK-FP-ARMV8: "-target-feature" "+fp-armv8"
118 // CHECK-FP-ARMV8: "-target-feature" "-neon"
119 // CHECK-FP-ARMV8: "-target-feature" "-crypto"
120 
121 // RUN: %clang -target armv8-linux-gnueabihf -mfpu=neon-fp-armv8 %s -### 2>&1 \
122 // RUN:   | FileCheck --check-prefix=CHECK-NEON-FP-ARMV8 %s
123 // CHECK-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
124 // CHECK-NEON-FP-ARMV8: "-target-feature" "+neon"
125 // CHECK-NEON-FP-ARMV8: "-target-feature" "-crypto"
126 
127 // RUN: %clang -target armv8-linux-gnueabihf -mfpu=crypto-neon-fp-armv8 %s -### 2>&1 \
128 // RUN:   | FileCheck --check-prefix=CHECK-CRYPTO-NEON-FP-ARMV8 %s
129 // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
130 // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+neon"
131 // CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+crypto"
132 
133 // RUN: %clang -target armv8-linux-gnueabi -mfpu=none %s -### 2>&1 \
134 // RUN:   | FileCheck --check-prefix=CHECK-NO-FP %s
135 // CHECK-NO-FP: "-target-feature" "-vfp2"
136 // CHECK-NO-FP: "-target-feature" "-vfp3"
137 // CHECK-NO-FP: "-target-feature" "-vfp4"
138 // CHECK-NO-FP: "-target-feature" "-fp-armv8"
139 // CHECK-NO-FP: "-target-feature" "-crypto"
140 // CHECK-NO-FP: "-target-feature" "-neon"
141 
142 // RUN: %clang -target arm-linux-gnueabihf %s -### 2>&1 \
143 // RUN:   | FileCheck --check-prefix=CHECK-HF %s
144 // CHECK-HF: "-target-cpu" "arm1136jf-s"
145 
146 // RUN: %clang -target armv7-apple-darwin -x assembler %s -### -c 2>&1 \
147 // RUN:   | FileCheck --check-prefix=ASM %s
148 // ASM-NOT: -target-feature
149