Debian Codegraph @

clang/test/Driver/mips-abi.c

raw
1 // Check passing Mips ABI options to the backend.
2 //
3 // RUN: %clang --target=mips-linux-gnu -### -c %s 2>&1 \
4 // RUN: | FileCheck -check-prefix=MIPS32R2-O32 %s
5 // RUN: %clang --target=mips64-linux-gnu -mips32r2 -mabi=32 -### -c %s 2>&1 \
6 // RUN: | FileCheck -check-prefix=MIPS32R2-O32 %s
7 // MIPS32R2-O32: "-target-cpu" "mips32r2"
8 // MIPS32R2-O32: "-target-abi" "o32"
9 //
10 // RUN: %clang --target=mips64-linux-gnu -### -c %s 2>&1 \
11 // RUN: | FileCheck -check-prefix=MIPS64R2-N64 %s
12 // RUN: %clang --target=mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \
13 // RUN: | FileCheck -check-prefix=MIPS64R2-N64 %s
14 // RUN: %clang --target=mips-mti-linux-gnu -mips64r2 -### -c %s 2>&1 \
15 // RUN: | FileCheck -check-prefix=MIPS64R2-N64 %s
16 // RUN: %clang --target=mips-linux-gnu -mips64r2 -mabi=64 -### -c %s 2>&1 \
17 // RUN: | FileCheck -check-prefix=MIPS64R2-N64 %s
18 // MIPS64R2-N64: "-target-cpu" "mips64r2"
19 // MIPS64R2-N64: "-target-abi" "n64"
20 //
21 // RUN: %clang --target=mips64-linux-gnu -### -mips64r3 -c %s 2>&1 \
22 // RUN: | FileCheck -check-prefix=MIPS64R3-N64 %s
23 // RUN: %clang --target=mips-img-linux-gnu -mips64r3 -### -c %s 2>&1 \
24 // RUN: | FileCheck -check-prefix=MIPS64R3-N64 %s
25 // RUN: %clang --target=mips-mti-linux-gnu -mips64r3 -### -c %s 2>&1 \
26 // RUN: | FileCheck -check-prefix=MIPS64R3-N64 %s
27 // MIPS64R3-N64: "-target-cpu" "mips64r3"
28 // MIPS64R3-N64: "-target-abi" "n64"
29 //
30 // RUN: %clang --target=mips-linux-gnu -### -c %s \
31 // RUN: -mabi=32 2>&1 \
32 // RUN: | FileCheck -check-prefix=MIPS-ABI-32 %s
33 // MIPS-ABI-32: "-target-cpu" "mips32r2"
34 // MIPS-ABI-32: "-target-abi" "o32"
35 //
36 // RUN: %clang --target=mips-linux-gnu -### -c %s \
37 // RUN: -mabi=o32 2>&1 \
38 // RUN: | FileCheck -check-prefix=MIPS-ABI-O32 %s
39 // MIPS-ABI-O32: "-target-cpu" "mips32r2"
40 // MIPS-ABI-O32: "-target-abi" "o32"
41 //
42 // RUN: %clang --target=mips-linux-gnu -### -c %s \
43 // RUN: -mabi=n32 2>&1 \
44 // RUN: | FileCheck -check-prefix=MIPS-ABI-N32 %s
45 // MIPS-ABI-N32: "-target-cpu" "mips64r2"
46 // MIPS-ABI-N32: "-target-abi" "n32"
47 //
48 // RUN: %clang --target=mips64-linux-gnu -### -c %s \
49 // RUN: -mabi=64 2>&1 \
50 // RUN: | FileCheck -check-prefix=MIPS-ABI-64 %s
51 // MIPS-ABI-64: "-target-cpu" "mips64r2"
52 // MIPS-ABI-64: "-target-abi" "n64"
53 //
54 // RUN: %clang --target=mips64-linux-gnu -### -c %s \
55 // RUN: -mabi=n64 2>&1 \
56 // RUN: | FileCheck -check-prefix=MIPS-ABI-N64 %s
57 // MIPS-ABI-N64: "-target-cpu" "mips64r2"
58 // MIPS-ABI-N64: "-target-abi" "n64"
59 //
60 // RUN: not %clang --target=mips64-linux-gnu -c %s \
61 // RUN: -mabi=o64 2>&1 \
62 // RUN: | FileCheck -check-prefix=MIPS-ABI-O64 %s
63 // MIPS-ABI-O64: error: unknown target ABI 'o64'
64 //
65 // RUN: not %clang --target=mips-linux-gnu -c %s \
66 // RUN: -mabi=unknown 2>&1 \
67 // RUN: | FileCheck -check-prefix=MIPS-ABI-UNKNOWN %s
68 // MIPS-ABI-UNKNOWN: error: unknown target ABI 'unknown'
69 //
70 // RUN: %clang --target=mips-linux-gnu -### -c %s \
71 // RUN: -march=mips1 2>&1 \
72 // RUN: | FileCheck -check-prefix=MIPS-ARCH-1 %s
73 // MIPS-ARCH-1: "-target-cpu" "mips1"
74 // MIPS-ARCH-1: "-target-abi" "o32"
75 //
76 // RUN: %clang --target=mips-linux-gnu -### -c %s \
77 // RUN: -march=mips2 2>&1 \
78 // RUN: | FileCheck -check-prefix=MIPS-ARCH-2 %s
79 // MIPS-ARCH-2: "-target-cpu" "mips2"
80 // MIPS-ARCH-2: "-target-abi" "o32"
81 //
82 // RUN: %clang --target=mips-linux-gnu -### -c %s \
83 // RUN: -march=mips3 2>&1 \
84 // RUN: | FileCheck -check-prefix=MIPS-ARCH-3 %s
85 // MIPS-ARCH-3: "-target-cpu" "mips3"
86 // MIPS-ARCH-3: "-target-abi" "o32"
87 //
88 // RUN: %clang --target=mips-linux-gnu -### -c %s \
89 // RUN: -march=mips4 2>&1 \
90 // RUN: | FileCheck -check-prefix=MIPS-ARCH-4 %s
91 // MIPS-ARCH-4: "-target-cpu" "mips4"
92 // MIPS-ARCH-4: "-target-abi" "o32"
93 //
94 // RUN: %clang --target=mips-linux-gnu -### -c %s \
95 // RUN: -march=mips5 2>&1 \
96 // RUN: | FileCheck -check-prefix=MIPS-ARCH-5 %s
97 // MIPS-ARCH-5: "-target-cpu" "mips5"
98 // MIPS-ARCH-5: "-target-abi" "o32"
99 //
100 // RUN: %clang --target=mips-linux-gnu -### -c %s \
101 // RUN: -march=mips32 2>&1 \
102 // RUN: | FileCheck -check-prefix=MIPS-ARCH-32 %s
103 // MIPS-ARCH-32: "-target-cpu" "mips32"
104 // MIPS-ARCH-32: "-target-abi" "o32"
105 //
106 // RUN: %clang --target=mips-linux-gnu -### -c %s \
107 // RUN: -march=mips32r2 2>&1 \
108 // RUN: | FileCheck -check-prefix=MIPS-ARCH-32R2 %s
109 // MIPS-ARCH-32R2: "-target-cpu" "mips32r2"
110 // MIPS-ARCH-32R2: "-target-abi" "o32"
111 //
112 // RUN: %clang --target=mips-linux-gnu -### -c %s \
113 // RUN: -march=p5600 2>&1 \
114 // RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600 %s
115 // MIPS-ARCH-P5600: "-target-cpu" "p5600"
116 // MIPS-ARCH-P5600: "-target-abi" "o32"
117 //
118 // RUN: %clang --target=mips-linux-gnu -### -c %s \
119 // RUN: -march=p5600 -mmsa -mnan=2008 2>&1 \
120 // RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-MSA %s
121 // MIPS-ARCH-P5600-MSA: "-target-cpu" "p5600"
122 // MIPS-ARCH-P5600-MSA: "-target-feature" "+msa"
123 // MIPS-ARCH-P5600-MSA: "-target-feature" "+fp64"
124 //
125 // RUN: %clang --target=mips-linux-gnu -### -c %s \
126 // RUN: -march=p5600 -mmsa -mnan=2008 2>&1 \
127 // RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-NAN2008 %s
128 // MIPS-ARCH-P5600-NAN2008: "-target-cpu" "p5600"
129 // MIPS-ARCH-P5600-NAN2008: "-target-feature" "+nan2008"
130 // MIPS-ARCH-P5600-NAN2008: "-target-feature" "+abs2008"
131 //
132 // RUN: not %clang --target=mips-linux-gnu -c %s \
133 // RUN: -march=p5600 -mabi=64 2>&1 \
134 // RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-N64 %s
135 // MIPS-ARCH-P5600-N64: error: ABI 'n64' is not supported on CPU 'p5600'
136 //
137 // RUN: %clang --target=mips-linux-gnu -### -c %s \
138 // RUN: -march=i6400 2>&1 \
139 // RUN: | FileCheck -check-prefix=MIPS-ARCH-I6400 %s
140 // MIPS-ARCH-I6400: "-target-cpu" "i6400"
141 // MIPS-ARCH-I6400: "-target-abi" "o32"
142 //
143 // RUN: %clang --target=mips-linux-gnu -### -c %s \
144 // RUN: -march=i6400 -mabi=64 2>&1 \
145 // RUN: | FileCheck -check-prefix=MIPS-ARCH-I6400-N64 %s
146 // MIPS-ARCH-I6400-N64: "-target-cpu" "i6400"
147 // MIPS-ARCH-I6400-N64: "-target-abi" "n64"
148 //
149 // RUN: %clang --target=mips64-linux-gnu -### -c %s \
150 // RUN: -march=i6400 2>&1 \
151 // RUN: | FileCheck -check-prefix=MIPS64-ARCH-I6400 %s
152 // MIPS64-ARCH-I6400: "-target-cpu" "i6400"
153 // MIPS64-ARCH-I6400: "-target-abi" "n64"
154 //
155 // RUN: %clang --target=mips64-linux-gnu -### -c %s \
156 // RUN: -march=i6400 -mabi=32 2>&1 \
157 // RUN: | FileCheck -check-prefix=MIPS64-ARCH-I6400-O32 %s
158 // MIPS64-ARCH-I6400-O32: "-target-cpu" "i6400"
159 // MIPS64-ARCH-I6400-O32: "-target-abi" "o32"
160 //
161 // RUN: %clang --target=mips-linux-gnu -### -c %s \
162 // RUN: -march=i6500 2>&1 \
163 // RUN: | FileCheck -check-prefix=MIPS-ARCH-I6500 %s
164 // MIPS-ARCH-I6500: "-target-cpu" "i6500"
165 // MIPS-ARCH-I6500: "-target-abi" "o32"
166 //
167 // RUN: %clang --target=mips-linux-gnu -### -c %s \
168 // RUN: -march=i6500 -mabi=64 2>&1 \
169 // RUN: | FileCheck -check-prefix=MIPS-ARCH-I6500-N64 %s
170 // MIPS-ARCH-I6500-N64: "-target-cpu" "i6500"
171 // MIPS-ARCH-I6500-N64: "-target-abi" "n64"
172 //
173 // RUN: %clang --target=mips64-linux-gnu -### -c %s \
174 // RUN: -march=i6500 2>&1 \
175 // RUN: | FileCheck -check-prefix=MIPS64-ARCH-I6500 %s
176 // MIPS64-ARCH-I6500: "-target-cpu" "i6500"
177 // MIPS64-ARCH-I6500: "-target-abi" "n64"
178 //
179 // RUN: %clang --target=mips64-linux-gnu -### -c %s \
180 // RUN: -march=i6500 -mabi=32 2>&1 \
181 // RUN: | FileCheck -check-prefix=MIPS64-ARCH-I6500-O32 %s
182 // MIPS64-ARCH-I6500-O32: "-target-cpu" "i6500"
183 // MIPS54-ARCH-I6500-O32: "-target-abi" "o32"
184 //
185 // RUN: %clang --target=mips-linux-gnu -### -c %s \
186 // RUN: -march=mips64 2>&1 \
187 // RUN: | FileCheck -check-prefix=MIPS-ARCH-3264 %s
188 // MIPS-ARCH-3264: "-target-cpu" "mips64"
189 // MIPS-ARCH-3264: "-target-abi" "o32"
190 //
191 // RUN: %clang --target=mips64-linux-gnu -### -c %s \
192 // RUN: -march=mips64 2>&1 \
193 // RUN: | FileCheck -check-prefix=MIPS-ARCH-64 %s
194 // MIPS-ARCH-64: "-target-cpu" "mips64"
195 // MIPS-ARCH-64: "-target-abi" "n64"
196 //
197 // RUN: %clang --target=mips64-linux-gnu -### -c %s \
198 // RUN: -march=mips64r2 2>&1 \
199 // RUN: | FileCheck -check-prefix=MIPS-ARCH-64R2 %s
200 // MIPS-ARCH-64R2: "-target-cpu" "mips64r2"
201 // MIPS-ARCH-64R2: "-target-abi" "n64"
202 //
203 // RUN: %clang --target=mips64-linux-gnu -### -c %s \
204 // RUN: -march=octeon 2>&1 \
205 // RUN: | FileCheck -check-prefix=MIPS-ARCH-OCTEON %s
206 // MIPS-ARCH-OCTEON: "-target-cpu" "octeon"
207 // MIPS-ARCH-OCTEON: "-target-abi" "n64"
208 //
209 // RUN: %clang --target=mips64-linux-gnu -### -c %s \
210 // RUN: -march=octeon+ 2>&1 \
211 // RUN: | FileCheck -check-prefix=MIPS-ARCH-OCTEONP %s
212 // MIPS-ARCH-OCTEONP: "-target-cpu" "octeon+"
213 // MIPS-ARCH-OCTEONP: "-target-abi" "n64"
214 //
215 // RUN: not %clang --target=mips64-linux-gnu -c %s \
216 // RUN: -march=mips32 2>&1 \
217 // RUN: | FileCheck -check-prefix=MIPS-ARCH-6432 %s
218 // MIPS-ARCH-6432: error: ABI 'n64' is not supported on CPU 'mips32'
219 //
220 // RUN: not %clang --target=mips-linux-gnu -c %s \
221 // RUN: -march=unknown 2>&1 \
222 // RUN: | FileCheck -check-prefix=MIPS-ARCH-UNKNOWN %s
223 // MIPS-ARCH-UNKNOWN: error: unknown target CPU 'unknown'
224
225 // Check adjusting of target triple accordingly to `-mabi` option.
226 // RUN: %clang --target=mips64-linux-gnuabi64 -mabi=32 -### %s 2>&1 \
227 // RUN: | FileCheck -check-prefix=TARGET-O32 %s
228 // TARGET-O32: "-triple" "mips-unknown-linux-gnu"
229 // TARGET-O32: "-target-cpu" "mips32r2"
230 // TARGET-O32: "-target-abi" "o32"
231 // TARGET-O32: ld{{(.exe)?}}"
232 // TARGET-O32: "-m" "elf32btsmip"
233
234 // RUN: %clang --target=mips-linux-gnu -mabi=n32 -### %s 2>&1 \
235 // RUN: | FileCheck -check-prefix=TARGET-N32 %s
236 // TARGET-N32: "-triple" "mips64-unknown-linux-gnuabin32"
237 // TARGET-N32: "-target-cpu" "mips64r2"
238 // TARGET-N32: "-target-abi" "n32"
239 // TARGET-N32: ld{{(.exe)?}}"
240 // TARGET-N32: "-m" "elf32btsmipn32"
241
242 // RUN: %clang --target=mips-linux-gnu -mabi=64 -### %s 2>&1 \
243 // RUN: | FileCheck -check-prefix=TARGET-N64 %s
244 // TARGET-N64: "-triple" "mips64-unknown-linux-gnuabi64"
245 // TARGET-N64: "-target-cpu" "mips64r2"
246 // TARGET-N64: "-target-abi" "n64"
247 // TARGET-N64: ld{{(.exe)?}}"
248 // TARGET-N64: "-m" "elf64btsmip"