1 // -----------------------------------------------------------------------------
2 // Tests for the hvx features and warnings.
3 // -----------------------------------------------------------------------------
5 // No HVX without -mhvx/-mhvx=
7 // CHECK-HVX-ON: "-target-feature" "+hvx
8 // CHECK-HVX-ON-NOT: "-target-feature" "-hvx
9 // CHECK-HVX-OFF-NOT: "-target-feature" "+hvx
11 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv5 \
12 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
13 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv55 \
14 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
15 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv60 \
16 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
17 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv62 \
18 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
19 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv65 \
20 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
21 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv66 \
22 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
23 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv67 \
24 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
25 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv67t \
26 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
27 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv68 \
28 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
29 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 \
30 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
31 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv71 \
32 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
33 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv71t \
34 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
35 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv73 \
36 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
38 // Infer HVX version from flag:
40 // CHECK-HVX-V60: "-target-feature" "+hvxv60"
41 // CHECK-HVX-V62: "-target-feature" "+hvxv62"
42 // CHECK-HVX-V65: "-target-feature" "+hvxv65"
43 // CHECK-HVX-V66: "-target-feature" "+hvxv66"
44 // CHECK-HVX-V67: "-target-feature" "+hvxv67"
45 // CHECK-HVX-V68: "-target-feature" "+hvxv68"
46 // CHECK-HVX-V69: "-target-feature" "+hvxv69"
47 // CHECK-HVX-V71: "-target-feature" "+hvxv71"
48 // CHECK-HVX-V73: "-target-feature" "+hvxv73"
50 // Direct version flag:
51 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v60 \
52 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V60 %s
53 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v62 \
54 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V62 %s
55 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v65 \
56 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V65 %s
57 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v66 \
58 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V66 %s
59 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v67 \
60 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V67 %s
61 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v68 \
62 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V68 %s
63 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v69 \
64 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V69 %s
65 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v71 \
66 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V71 %s
67 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v73 \
68 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V73 %s
69 // Infer HVX version from CPU version:
70 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv60 -mhvx \
71 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V60 %s
72 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv62 -mhvx \
73 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V62 %s
74 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv65 -mhvx \
75 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V65 %s
76 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv66 -mhvx \
77 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V66 %s
78 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv67 -mhvx \
79 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V67 %s
80 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv67t -mhvx \
81 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V67 %s
82 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv68 -mhvx \
83 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V68 %s
84 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx \
85 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V69 %s
86 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv71 -mhvx \
87 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V71 %s
88 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv73 -mhvx \
89 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V73 %s
91 // Direct version flag with different CPU version:
92 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v60 -mv62 \
93 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V60 %s
94 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v62 -mv65 \
95 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V62 %s
96 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v65 -mv66 \
97 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V65 %s
98 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v66 -mv67 \
99 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V66 %s
100 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v67 -mv68 \
101 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V67 %s
102 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v68 -mv69 \
103 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V68 %s
104 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v69 -mv71 \
105 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V69 %s
106 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v71 -mv73 \
107 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V71 %s
108 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v73 -mv60 \
109 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V73 %s
111 // Direct version flag with different CPU version and versionless -mhvx:
112 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v60 -mv62 -mhvx \
113 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V62 %s
114 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v62 -mv65 -mhvx \
115 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V65 %s
116 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v65 -mv66 -mhvx \
117 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V66 %s
118 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v66 -mv67 -mhvx \
119 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V67 %s
120 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v67 -mv68 -mhvx \
121 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V68 %s
122 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v68 -mv69 -mhvx \
123 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V69 %s
124 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v69 -mv71 -mhvx \
125 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V71 %s
126 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v71 -mv73 -mhvx \
127 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V73 %s
128 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v73 -mv60 -mhvx \
129 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V60 %s
131 // Direct version flag with different CPU version, versionless -mhvx
132 // and -mno-hvx. The -mno-hvx cancels -mhvx=, versionless -mhvx wins:
133 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v60 -mno-hvx -mv62 -mhvx \
134 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V62 %s
135 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v62 -mno-hvx -mv65 -mhvx \
136 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V65 %s
137 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v65 -mno-hvx -mv66 -mhvx \
138 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V66 %s
139 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v66 -mno-hvx -mv67 -mhvx \
140 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V67 %s
141 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v67 -mno-hvx -mv68 -mhvx \
142 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V68 %s
143 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v68 -mno-hvx -mv69 -mhvx \
144 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V69 %s
145 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v69 -mno-hvx -mv71 -mhvx \
146 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V71 %s
147 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v71 -mno-hvx -mv73 -mhvx \
148 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V73 %s
149 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v73 -mno-hvx -mv60 -mhvx \
150 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V60 %s
152 // Direct version flag with different CPU version, versionless -mhvx
153 // and -mno-hvx. The -mno-hvx cancels versionless -mhvx, -mhvx= wins:
154 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv62 -mhvx -mno-hvx -mhvx=v60 \
155 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V60 %s
156 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv65 -mhvx -mno-hvx -mhvx=v62 \
157 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V62 %s
158 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv66 -mhvx -mno-hvx -mhvx=v65 \
159 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V65 %s
160 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv67 -mhvx -mno-hvx -mhvx=v66 \
161 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V66 %s
162 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv68 -mhvx -mno-hvx -mhvx=v67 \
163 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V67 %s
164 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mno-hvx -mhvx=v68 \
165 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V68 %s
166 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv71 -mhvx -mno-hvx -mhvx=v69 \
167 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V69 %s
168 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv73 -mhvx -mno-hvx -mhvx=v71 \
169 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V71 %s
170 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv60 -mhvx -mno-hvx -mhvx=v73 \
171 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-V73 %s
173 // Infer HVX length from flag:
175 // CHECK-HVX-L64: "-target-feature" "+hvx-length64b"
176 // CHECK-HVX-L64-NOT: "-target-feature" "+hvx-length128b"
177 // CHECK-HVX-L128: "-target-feature" "+hvx-length128b"
178 // CHECK-HVX-L128-NOT: "-target-feature" "+hvx-length64b"
180 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx -mhvx-length=64b \
181 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-L64 %s
182 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx -mhvx-length=128b \
183 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-L128 %s
185 // Infer HVX length from HVX version:
187 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v60 \
188 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-L64 %s
189 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v62 \
190 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-L64 %s
191 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v65 \
192 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-L64 %s
193 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v66 \
194 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-L128 %s
195 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v67 \
196 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-L128 %s
197 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v68 \
198 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-L128 %s
199 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v69 \
200 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-L128 %s
202 // No HVX with trailing -mno-hvx
204 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v69 -mno-hvx \
205 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
206 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mno-hvx \
207 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
208 // RUN: not %clang -c %s -### --target=hexagon-unknown-elf -mhvx=v69 -mhvx-length=128b -mno-hvx \
209 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
210 // RUN: not %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mhvx-qfloat -mno-hvx \
211 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-OFF %s
215 // CHECK-HVX-QFLOAT-ON: "-target-feature" "+hvx-qfloat"
216 // CHECK-HVX-QFLOAT-OFF-NOT: "-target-feature" "+hvx-qfloat"
217 // CHECK-HVX-IEEE-ON: "-target-feature" "+hvx-ieee-fp"
218 // CHECK-HVX-IEEE-OFF-NOT: "-target-feature" "+hvx-ieee-fp"
220 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mhvx-qfloat \
221 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-QFLOAT-ON %s
222 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mno-hvx-qfloat \
223 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-QFLOAT-OFF %s
224 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mno-hvx-qfloat -mhvx-qfloat \
225 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-QFLOAT-ON %s
226 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mhvx-qfloat -mno-hvx-qfloat \
227 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-QFLOAT-OFF %s
229 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mhvx-ieee-fp \
230 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-IEEE-ON %s
231 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mno-hvx-ieee-fp \
232 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-IEEE-OFF %s
233 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mno-hvx-ieee-fp -mhvx-ieee-fp \
234 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-IEEE-ON %s
235 // RUN: %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx -mhvx-ieee-fp -mno-hvx-ieee-fp \
236 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-IEEE-OFF %s
238 // HVX flags heed HVX:
240 // CHECK-NEEDS-HVX: error: {{.*}} requires HVX, use -mhvx/-mhvx= to enable it
242 // RUN: not %clang -c %s -### --target=hexagon-unknown-elf -mv66 -mhvx-length=64b \
243 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-NEEDS-HVX %s
244 // RUN: not %clang -c %s -### --target=hexagon-unknown-elf -mv66 -mhvx-length=128b \
245 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-NEEDS-HVX %s
246 // RUN: not %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx-qfloat \
247 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-NEEDS-HVX %s
248 // RUN: not %clang -c %s -### --target=hexagon-unknown-elf -mv69 -mhvx-ieee-fp \
249 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-NEEDS-HVX %s
251 // Invalid HVX length:
253 // CHECK-HVX-BAD-LENGTH: error: unsupported argument '{{.*}}' to option '-mhvx-length='
255 // RUN: not %clang -c %s -### --target=hexagon-unknown-elf -mhvx -mhvx-length=B \
256 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-BAD-LENGTH %s
257 // RUN: not %clang -c %s -### --target=hexagon-unknown-elf -mhvx -mhvx-length=128 \
258 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-BAD-LENGTH %s