1 # Copyright
2010-2021 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
3 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
*/
16 # Contributed by Ken Werner
<ken.werner@de.ibm.com
>.
18 # Tests GDBs support
for OpenCL operators.
22 if { [skip_opencl_tests
] } {
23 unsupported
"OpenCL support not detected"
27 set testfile
"operators"
28 set clprogram
[remote_download target $
{srcdir
}/$
{subdir
}/$
{testfile
}.cl
]
30 #
Compile the generic OpenCL host app
31 if { [gdb_compile_opencl_hostapp
"${clprogram}" "${testfile}" "" ] != "" } {
32 untested
"failed to compile"
37 clean_restart $
{testfile
}
39 #
Set breakpoint at the OpenCL kernel
40 gdb_test
"tbreak testkernel" \
42 "Set pending breakpoint" \
43 ".*Function \"testkernel\" not defined.*Make breakpoint pending.*y or \\\[n\\\]. $" \
47 gdb_test
"" ".*reakpoint.*1.*testkernel.*" "run"
49 #
Continue to the marker
50 gdb_breakpoint
[gdb_get_line_number
"marker" "${clprogram}"]
51 gdb_continue_to_breakpoint
"marker"
53 #
Retrieve some information about availability of OpenCL extensions
54 set have_cl_khr_fp64
[get_integer_valueof
"have_cl_khr_fp64" 0]
55 set have_cl_khr_fp16
[get_integer_valueof
"have_cl_khr_fp16" 0]
57 proc check_basic
{ name type isfloat
} {
58 gdb_test
"print/d ${name}a" " = 2"
59 gdb_test
"print/d ${name}b" " = 1"
60 gdb_test
"print/d ${name}4a" " = \\{2, 4, 8, 16\\}"
61 gdb_test
"print/d ${name}4b" " = \\{1, 2, 8, 4\\}"
63 gdb_test
"ptype ${name}a" "type = ${type}"
64 gdb_test
"ptype ${name}b" "type = ${type}"
65 gdb_test
"ptype ${name}4a" "type = ${type}4"
66 gdb_test
"ptype ${name}4b" "type = ${type}4"
69 gdb_test
"print/d u${name}a" " = 2"
70 gdb_test
"print/d u${name}b" " = 1"
71 gdb_test
"print/d u${name}4a" " = \\{2, 4, 8, 16\\}"
72 gdb_test
"print/d u${name}4b" " = \\{1, 2, 8, 4\\}"
73 gdb_test
"ptype u${name}a" "type = (unsigned ${type}|u${type})"
74 gdb_test
"ptype u${name}b" "type = (unsigned ${type}|u${type})"
75 gdb_test
"ptype u${name}4a" "type = u${type}4"
76 gdb_test
"ptype u${name}4b" "type = u${type}4"
80 # Arithmetic operators
81 proc check_arithmetic_ops
{ name type isfloat size
} {
83 gdb_test
"print/d ${name}a + ${name}b" " = 3"
84 gdb_test
"print/d ${name}a - ${name}b" " = 1"
85 gdb_test
"print/d ${name}a * ${name}b" " = 2"
86 gdb_test
"print/d ${name}a / ${name}b" " = 2"
88 gdb_test
"print/d ${name}a + ${name}4b" " = \\{3, 4, 10, 6\\}"
89 gdb_test
"print/d ${name}4a - ${name}b" " = \\{1, 3, 7, 15\\}"
90 gdb_test
"print/d ${name}4a * ${name}b" " = \\{2, 4, 8, 16\\}"
91 gdb_test
"print/d ${name}a / ${name}4b" " = \\{2, 1, 0, 0\\}"
93 gdb_test
"print/d ${name}4a + ${name}4b" " = \\{3, 6, 16, 20\\}"
94 gdb_test
"print/d ${name}4a - ${name}4b" " = \\{1, 2, 0, 12\\}"
95 gdb_test
"print/d ${name}4a * ${name}4b" " = \\{2, 8, 64, 64\\}"
96 gdb_test
"print/d ${name}4a / ${name}4b" " = \\{2, 2, 1, 4\\}"
99 gdb_test
"print/d ${name}a++" " = 2"
100 gdb_test
"print/d ++${name}a" " = 4"
101 gdb_test
"print/d ${name}a--" " = 4"
102 gdb_test
"print/d --${name}a" " = 2"
103 gdb_test
"print/d +${name}a" " = 2"
104 gdb_test
"print/d -${name}a" " = -2"
106 gdb_test
"print/d ${name}4a++" " = \\{2, 4, 8, 16\\}"
107 gdb_test
"print/d ++${name}4a" " = \\{4, 6, 10, 18\\}"
108 gdb_test
"print/d ${name}4a--" " = \\{4, 6, 10, 18\\}"
109 gdb_test
"print/d --${name}4a" " = \\{2, 4, 8, 16\\}"
110 gdb_test
"print/d +${name}4a" " = \\{2, 4, 8, 16\\}"
111 gdb_test
"print/d -${name}4a" " = \\{-2, -4, -8, -16\\}"
114 gdb_test
"ptype ${name}a + ${name}4b" "type = ${type}4"
115 gdb_test
"ptype ${name}4a - ${name}b" "type = ${type}4"
116 gdb_test
"ptype ${name}a * ${name}4b" "type = ${type}4"
117 gdb_test
"ptype ${name}4a / ${name}b" "type = ${type}4"
119 gdb_test
"ptype ${name}4a + ${name}4b" "type = ${type}4"
120 gdb_test
"ptype ${name}4a - ${name}4b" "type = ${type}4"
121 gdb_test
"ptype ${name}4a * ${name}4b" "type = ${type}4"
122 gdb_test
"ptype ${name}4a / ${name}4b" "type = ${type}4"
125 gdb_test
"ptype ${name}a++" "type = ${type}"
126 gdb_test
"ptype ++${name}a" "type = ${type}"
127 gdb_test
"ptype ${name}a--" "type = ${type}"
128 gdb_test
"ptype --${name}a" "type = ${type}"
130 gdb_test
"ptype ${name}4a++" "type = ${type}4"
131 gdb_test
"ptype ++${name}4a" "type = ${type}4"
132 gdb_test
"ptype ${name}4a--" "type = ${type}4"
133 gdb_test
"ptype --${name}4a" "type = ${type}4"
134 gdb_test
"ptype +${name}4a" "type = ${type}4"
135 gdb_test
"ptype -${name}4a" "type = ${type}4"
139 gdb_test
"ptype ${name}a + ${name}b" "type = ${type}"
140 gdb_test
"ptype ${name}a - ${name}b" "type = ${type}"
141 gdb_test
"ptype ${name}a * ${name}b" "type = ${type}"
142 gdb_test
"ptype ${name}a / ${name}b" "type = ${type}"
144 gdb_test
"ptype +${name}a" "type = ${type}"
145 gdb_test
"ptype -${name}a" "type = ${type}"
148 gdb_test
"print/d ${name}a % ${name}b" " = 0"
150 gdb_test
"print/d ${name}4a % ${name}b" " = \\{0, 0, 0, 0\\}"
152 gdb_test
"print/d ${name}4a % ${name}b" " = \\{0, 0, 0, 0\\}"
155 gdb_test
"print/d u${name}a + u${name}b" " = 3"
156 gdb_test
"print/d u${name}a - u${name}b" " = 1"
157 gdb_test
"print/d u${name}a * u${name}b" " = 2"
158 gdb_test
"print/d u${name}a / u${name}b" " = 2"
159 gdb_test
"print/d u${name}a % u${name}b" " = 0"
161 gdb_test
"print/d u${name}a + u${name}4b" " = \\{3, 4, 10, 6\\}"
162 gdb_test
"print/d u${name}4a - u${name}b" " = \\{1, 3, 7, 15\\}"
163 gdb_test
"print/d u${name}4a * u${name}b" " = \\{2, 4, 8, 16\\}"
164 gdb_test
"print/d u${name}a / u${name}4b" " = \\{2, 1, 0, 0\\}"
165 gdb_test
"print/d u${name}4a % u${name}b" " = \\{0, 0, 0, 0\\}"
167 gdb_test
"print/d u${name}4a + u${name}4b" " = \\{3, 6, 16, 20\\}"
168 gdb_test
"print/d u${name}4a - u${name}4b" " = \\{1, 2, 0, 12\\}"
169 gdb_test
"print/d u${name}4a * u${name}4b" " = \\{2, 8, 64, 64\\}"
170 gdb_test
"print/d u${name}4a / u${name}4b" " = \\{2, 2, 1, 4\\}"
171 gdb_test
"print/d u${name}4a % u${name}4b" " = \\{0, 0, 0, 0\\}"
174 gdb_test
"print/d u${name}a++" " = 2"
175 gdb_test
"print/d ++u${name}a" " = 4"
176 gdb_test
"print/d u${name}a--" " = 4"
177 gdb_test
"print/d --u${name}a" " = 2"
178 gdb_test
"print/d +u${name}a" " = 2"
179 gdb_test
"print/x -u${name}a" " = 0x.*fe"
181 gdb_test
"print/d u${name}4a++" " = \\{2, 4, 8, 16\\}"
182 gdb_test
"print/d ++u${name}4a" " = \\{4, 6, 10, 18\\}"
183 gdb_test
"print/d u${name}4a--" " = \\{4, 6, 10, 18\\}"
184 gdb_test
"print/d --u${name}4a" " = \\{2, 4, 8, 16\\}"
185 gdb_test
"print/d +u${name}4a" " = \\{2, 4, 8, 16\\}"
186 gdb_test
"print/x -u${name}4a" " = \\{0x.*fe, 0x.*fc, 0x.*f8, 0x.*f0\\}"
190 gdb_test
"ptype ${name}a + ${name}b" "type = int"
191 gdb_test
"ptype ${name}a - ${name}b" "type = int"
192 gdb_test
"ptype ${name}a * ${name}b" "type = int"
193 gdb_test
"ptype ${name}a / ${name}b" "type = int"
194 gdb_test
"ptype ${name}a % ${name}b" "type = int"
195 gdb_test
"ptype +${name}a" "type = int"
196 gdb_test
"ptype -${name}a" "type = int"
197 gdb_test
"ptype u${name}a + u${name}b" "type = int"
198 gdb_test
"ptype u${name}a - u${name}b" "type = int"
199 gdb_test
"ptype u${name}a * u${name}b" "type = int"
200 gdb_test
"ptype u${name}a / u${name}b" "type = int"
201 gdb_test
"ptype u${name}a % u${name}b" "type = int"
202 gdb_test
"ptype +u${name}a" "type = int"
203 gdb_test
"ptype -u${name}a" "type = int"
204 } elseif
{ $
{size
} == 4 } {
205 gdb_test
"ptype ${name}a + ${name}b" "type = int"
206 gdb_test
"ptype ${name}a - ${name}b" "type = int"
207 gdb_test
"ptype ${name}a * ${name}b" "type = int"
208 gdb_test
"ptype ${name}a / ${name}b" "type = int"
209 gdb_test
"ptype ${name}a % ${name}b" "type = int"
210 gdb_test
"ptype +${name}a" "type = int"
211 gdb_test
"ptype -${name}a" "type = int"
212 gdb_test
"ptype u${name}a + u${name}b" "type = (unsigned int|uint)"
213 gdb_test
"ptype u${name}a - u${name}b" "type = (unsigned int|uint)"
214 gdb_test
"ptype u${name}a * u${name}b" "type = (unsigned int|uint)"
215 gdb_test
"ptype u${name}a / u${name}b" "type = (unsigned int|uint)"
216 gdb_test
"ptype u${name}a % u${name}b" "type = (unsigned int|uint)"
217 gdb_test
"ptype +u${name}a" "type = (unsigned int|uint)"
218 gdb_test
"ptype -u${name}a" "type = (unsigned int|uint)"
219 } else { # $
{size
} == 8
220 gdb_test
"ptype ${name}a + ${name}b" "type = long"
221 gdb_test
"ptype ${name}a - ${name}b" "type = long"
222 gdb_test
"ptype ${name}a * ${name}b" "type = long"
223 gdb_test
"ptype ${name}a / ${name}b" "type = long"
224 gdb_test
"ptype ${name}a % ${name}b" "type = long"
225 gdb_test
"ptype +${name}a" "type = long"
226 gdb_test
"ptype -${name}a" "type = long"
227 gdb_test
"ptype u${name}a + u${name}b" "type = (unsigned long|ulong)"
228 gdb_test
"ptype u${name}a - u${name}b" "type = (unsigned long|ulong)"
229 gdb_test
"ptype u${name}a * u${name}b" "type = (unsigned long|ulong)"
230 gdb_test
"ptype u${name}a / u${name}b" "type = (unsigned long|ulong)"
231 gdb_test
"ptype u${name}a % u${name}b" "type = (unsigned long|ulong)"
233 gdb_test
"ptype +u${name}a" "type = (unsigned long|ulong)"
234 gdb_test
"ptype -u${name}a" "type = (unsigned long|ulong)"
236 gdb_test
"ptype u${name}a++" "type = (unsigned ${type}|u${type})"
237 gdb_test
"ptype ++u${name}a" "type = (unsigned ${type}|u${type})"
238 gdb_test
"ptype u${name}a--" "type = (unsigned ${type}|u${type})"
239 gdb_test
"ptype --u${name}a" "type = (unsigned ${type}|u${type})"
241 gdb_test
"ptype ${name}a % ${name}4b" "type = ${type}4"
242 gdb_test
"ptype u${name}a + u${name}4b" "type = u${type}4"
243 gdb_test
"ptype u${name}4a - u${name}b" "type = u${type}4"
244 gdb_test
"ptype u${name}a * u${name}4b" "type = u${type}4"
245 gdb_test
"ptype u${name}4a / u${name}b" "type = u${type}4"
246 gdb_test
"ptype u${name}a % u${name}4b" "type = u${type}4"
248 gdb_test
"ptype ${name}4a % ${name}4b" "type = ${type}4"
249 gdb_test
"ptype u${name}4a + u${name}4b" "type = u${type}4"
250 gdb_test
"ptype u${name}4a - u${name}4b" "type = u${type}4"
251 gdb_test
"ptype u${name}4a * u${name}4b" "type = u${type}4"
252 gdb_test
"ptype u${name}4a / u${name}4b" "type = u${type}4"
253 gdb_test
"ptype u${name}4a % u${name}4b" "type = u${type}4"
254 gdb_test
"ptype u${name}4a++" "type = u${type}4"
255 gdb_test
"ptype ++u${name}4a" "type = u${type}4"
256 gdb_test
"ptype u${name}4a--" "type = u${type}4"
257 gdb_test
"ptype --u${name}4a" "type = u${type}4"
258 gdb_test
"ptype +u${name}4a" "type = u${type}4"
259 gdb_test
"ptype -u${name}4a" "type = u${type}4"
263 # Relational operators
264 proc check_relational_ops
{ name type isfloat size
} {
266 gdb_test
"print/d ${name}a > ${name}b" " = 1"
267 gdb_test
"print/d ${name}b < ${name}a" " = 1"
268 gdb_test
"print/d ${name}b >= ${name}a" " = 0"
269 gdb_test
"print/d ${name}a <= ${name}b" " = 0"
271 gdb_test
"print/d ${name}4a > ${name}b" " = \\{-1, -1, -1, -1\\}"
272 gdb_test
"print/d ${name}a < ${name}4b" " = \\{0, 0, -1, -1\\}"
273 gdb_test
"print/d ${name}4a >= ${name}b" " = \\{-1, -1, -1, -1\\}"
274 gdb_test
"print/d ${name}a <= ${name}4b" " = \\{0, -1, -1, -1\\}"
276 gdb_test
"print/d ${name}4a > ${name}4b" " = \\{-1, -1, 0, -1\\}"
277 gdb_test
"print/d ${name}4b < ${name}4a" " = \\{-1, -1, 0, -1\\}"
278 gdb_test
"print/d ${name}4b >= ${name}4a" " = \\{0, 0, -1, 0\\}"
279 gdb_test
"print/d ${name}4a <= ${name}4b" " = \\{0, 0, -1, 0\\}"
281 # result type should be
int for scalars
282 gdb_test
"ptype ${name}a < ${name}b" "type = int"
283 gdb_test
"ptype ${name}a > ${name}b" "type = int"
284 gdb_test
"ptype ${name}a <= ${name}b" "type = int"
285 gdb_test
"ptype ${name}a >= ${name}b" "type = int"
288 if { $
{size
} == 2 } {
289 # result type should be short
for half precision floating point vectors
291 gdb_test
"ptype ${name}4a > ${name}b" "type = short4"
292 gdb_test
"ptype ${name}a < ${name}4b" "type = short4"
293 gdb_test
"ptype ${name}4a >= ${name}b" "type = short4"
294 gdb_test
"ptype ${name}a <= ${name}4b" "type = short4"
296 gdb_test
"ptype ${name}4a > ${name}4b" "type = short4"
297 gdb_test
"ptype ${name}4a < ${name}4b" "type = short4"
298 gdb_test
"ptype ${name}4a >= ${name}4b" "type = short4"
299 gdb_test
"ptype ${name}4a <= ${name}4b" "type = short4"
300 } elseif
{ $
{size
} == 4 } {
301 # result type should be
int for single precision floating point vectors
303 gdb_test
"ptype ${name}4a > ${name}b" "type = int4"
304 gdb_test
"ptype ${name}a < ${name}4b" "type = int4"
305 gdb_test
"ptype ${name}4a >= ${name}b" "type = int4"
306 gdb_test
"ptype ${name}a <= ${name}4b" "type = int4"
308 gdb_test
"ptype ${name}4a > ${name}4b" "type = int4"
309 gdb_test
"ptype ${name}4a < ${name}4b" "type = int4"
310 gdb_test
"ptype ${name}4a >= ${name}4b" "type = int4"
311 gdb_test
"ptype ${name}4a <= ${name}4b" "type = int4"
312 } else { # $
{size
} == 8
313 # result type should be long
for double precision floating point vectors
315 gdb_test
"ptype ${name}4a > ${name}b" "type = long4"
316 gdb_test
"ptype ${name}a < ${name}4b" "type = long4"
317 gdb_test
"ptype ${name}4a >= ${name}b" "type = long4"
318 gdb_test
"ptype ${name}a <= ${name}4b" "type = long4"
320 gdb_test
"ptype ${name}4a > ${name}4b" "type = long4"
321 gdb_test
"ptype ${name}4a < ${name}4b" "type = long4"
322 gdb_test
"ptype ${name}4a >= ${name}4b" "type = long4"
323 gdb_test
"ptype ${name}4a <= ${name}4b" "type = long4"
327 gdb_test
"print/d u${name}a > u${name}b" " = 1"
328 gdb_test
"print/d u${name}b < u${name}a" " = 1"
329 gdb_test
"print/d u${name}b >= u${name}a" " = 0"
330 gdb_test
"print/d u${name}a <= u${name}b" " = 0"
332 gdb_test
"print/d u${name}4a > u${name}b" " = \\{-1, -1, -1, -1\\}"
333 gdb_test
"print/d u${name}a < u${name}4b" " = \\{0, 0, -1, -1\\}"
334 gdb_test
"print/d u${name}4a >= u${name}b" " = \\{-1, -1, -1, -1\\}"
335 gdb_test
"print/d u${name}a <= u${name}4b" " = \\{0, -1, -1, -1\\}"
337 gdb_test
"print/d u${name}4a > u${name}4b" " = \\{-1, -1, 0, -1\\}"
338 gdb_test
"print/d u${name}4b < u${name}4a" " = \\{-1, -1, 0, -1\\}"
339 gdb_test
"print/d u${name}4b >= u${name}4a" " = \\{0, 0, -1, 0\\}"
340 gdb_test
"print/d u${name}4a <= u${name}4b" " = \\{0, 0, -1, 0\\}"
342 # result type
for unsigned operands is signed
344 gdb_test
"ptype u${name}a < u${name}b" "type = int"
345 gdb_test
"ptype u${name}a > u${name}b" "type = int"
346 gdb_test
"ptype u${name}a <= u${name}b" "type = int"
347 gdb_test
"ptype u${name}a >= u${name}b" "type = int"
349 gdb_test
"ptype u${name}4a > u${name}b" "type = ${type}4"
350 gdb_test
"ptype u${name}a < u${name}4b" "type = ${type}4"
351 gdb_test
"ptype u${name}4a >= u${name}b" "type = ${type}4"
352 gdb_test
"ptype u${name}a <= u${name}4b" "type = ${type}4"
354 gdb_test
"ptype u${name}4a > u${name}4b" "type = ${type}4"
355 gdb_test
"ptype u${name}4a < u${name}4b" "type = ${type}4"
356 gdb_test
"ptype u${name}4a >= u${name}4b" "type = ${type}4"
357 gdb_test
"ptype u${name}4a <= u${name}4b" "type = ${type}4"
362 proc check_equality_ops
{ name type isfloat size
} {
364 gdb_test
"print/d ${name}a == ${name}b" " = 0"
365 gdb_test
"print/d ${name}a != ${name}b" " = 1"
367 gdb_test
"print/d ${name}4a == ${name}b" " = \\{0, 0, 0, 0\\}"
368 gdb_test
"print/d ${name}a != ${name}4b" " = \\{-1, 0, -1, -1\\}"
370 gdb_test
"print/d ${name}4a == ${name}4b" " = \\{0, 0, -1, 0\\}"
371 gdb_test
"print/d ${name}4a != ${name}4b" " = \\{-1, -1, 0, -1\\}"
374 gdb_test
"ptype ${name}a == ${name}b" "type = int"
375 gdb_test
"ptype ${name}a != ${name}b" "type = int"
378 if { $
{size
} == 2 } {
379 # result type should be short
for half precision floating point vectors
381 gdb_test
"ptype ${name}4a == ${name}b" "type = short4"
382 gdb_test
"ptype ${name}a != ${name}4b" "type = short4"
384 gdb_test
"ptype ${name}4a == ${name}4b" "type = short4"
385 gdb_test
"ptype ${name}4a != ${name}4b" "type = short4"
386 } elseif
{ $
{size
} == 4 } {
387 # result type should be
int for single precision floating point vectors
389 gdb_test
"ptype ${name}4a == ${name}b" "type = int4"
390 gdb_test
"ptype ${name}a != ${name}4b" "type = int4"
392 gdb_test
"ptype ${name}4a == ${name}4b" "type = int4"
393 gdb_test
"ptype ${name}4a != ${name}4b" "type = int4"
394 } else { # $
{size
} == 8
395 # result type should be long
for double precision floating point vectors
397 gdb_test
"ptype ${name}4a == ${name}b" "type = long4"
398 gdb_test
"ptype ${name}a != ${name}4b" "type = long4"
400 gdb_test
"ptype ${name}4a == ${name}4b" "type = long4"
401 gdb_test
"ptype ${name}4a != ${name}4b" "type = long4"
405 gdb_test
"print/d u${name}a == u${name}b" " = 0"
406 gdb_test
"print/d u${name}a != u${name}b" " = 1"
408 gdb_test
"print/d u${name}4a == u${name}b" " = \\{0, 0, 0, 0\\}"
409 gdb_test
"print/d u${name}a != u${name}4b" " = \\{-1, 0, -1, -1\\}"
411 gdb_test
"print/d u${name}4a == u${name}4b" " = \\{0, 0, -1, 0\\}"
412 gdb_test
"print/d u${name}4b != u${name}4a" " = \\{-1, -1, 0, -1\\}"
414 # result type
for unsigned operands is signed
416 gdb_test
"ptype u${name}a == u${name}b" "type = int"
417 gdb_test
"ptype u${name}a != u${name}b" "type = int"
419 gdb_test
"ptype u${name}4a == u${name}b" "type = ${type}4"
420 gdb_test
"ptype u${name}a != u${name}4b" "type = ${type}4"
422 gdb_test
"ptype u${name}4a == u${name}4b" "type = ${type}4"
423 gdb_test
"ptype u${name}4a != u${name}4b" "type = ${type}4"
428 proc check_shift_ops
{ name type size
} {
430 gdb_test
"print/d ${name}a << ${name}b" " = 4"
431 gdb_test
"print/d ${name}a >> ${name}b" " = 1"
432 gdb_test
"print/d u${name}a << u${name}b" " = 4"
433 gdb_test
"print/d u${name}a >> u${name}b" " = 1"
435 gdb_test
"print/d ${name}4a << ${name}b" " = \\{4, 8, 16, 32\\}"
436 gdb_test
"print/d ${name}4a >> ${name}b" " = \\{1, 2, 4, 8\\}"
437 gdb_test
"print/d u${name}4a << u${name}b" " = \\{4, 8, 16, 32\\}"
438 gdb_test
"print/d u${name}4a >> u${name}b" " = \\{1, 2, 4, 8\\}"
440 if { $
{size
} == 1 } {
441 gdb_test
"print/d ${name}4a << ${name}4b" " = \\{4, 16, 0, 0\\}"
442 gdb_test
"print/d u${name}4a << u${name}4b" " = \\{4, 16, 0, 0\\}"
444 gdb_test
"print/d ${name}4a << ${name}4b" " = \\{4, 16, 2048, 256\\}"
445 gdb_test
"print/d u${name}4a << u${name}4b" " = \\{4, 16, 2048, 256\\}"
447 gdb_test
"print/d ${name}4a >> ${name}4b" " = \\{1, 1, 0, 1\\}"
448 gdb_test
"print/d u${name}4a >> u${name}4b" " = \\{1, 1, 0, 1\\}"
452 gdb_test
"ptype ${name}a << ${name}b" "type = int"
453 gdb_test
"ptype ${name}a >> ${name}b" "type = int"
454 gdb_test
"ptype u${name}a << u${name}b" "type = int"
455 gdb_test
"ptype u${name}a >> u${name}b" "type = int"
456 } elseif
{ $
{size
} == 4 } {
457 gdb_test
"ptype ${name}a << ${name}b" "type = int"
458 gdb_test
"ptype ${name}a >> ${name}b" "type = int"
459 gdb_test
"ptype u${name}a << u${name}b" "type = (unsigned int|uint)"
460 gdb_test
"ptype u${name}a >> u${name}b" "type = (unsigned int|uint)"
461 } else { # $
{size
} == 8
462 gdb_test
"ptype ${name}a << ${name}b" "type = long"
463 gdb_test
"ptype ${name}a >> ${name}b" "type = long"
464 gdb_test
"ptype u${name}a << u${name}b" "type = (unsigned long|ulong)"
465 gdb_test
"ptype u${name}a >> u${name}b" "type = (unsigned long|ulong)"
468 gdb_test
"ptype ${name}4a << ${name}b" "type = ${type}4"
469 gdb_test
"ptype ${name}4a >> ${name}b" "type = ${type}4"
470 gdb_test
"ptype u${name}4a << u${name}b" "type = u${type}4"
471 gdb_test
"ptype u${name}4a >> u${name}b" "type = u${type}4"
473 gdb_test
"ptype ${name}4a << ${name}4b" "type = ${type}4"
474 gdb_test
"ptype ${name}4a >> ${name}4b" "type = ${type}4"
475 gdb_test
"ptype u${name}4a << u${name}4b" "type = u${type}4"
476 gdb_test
"ptype u${name}4a >> u${name}4b" "type = u${type}4"
480 proc check_bitwise_ops
{ name type size
} {
482 gdb_test
"print/d ${name}a & ${name}b" " = 0"
483 gdb_test
"print/d ${name}a | ${name}b" " = 3"
484 gdb_test
"print/d ${name}a ^ ${name}b" " = 3"
485 gdb_test
"print/d u${name}a & u${name}b" " = 0"
486 gdb_test
"print/d u${name}a | u${name}b" " = 3"
487 gdb_test
"print/d u${name}a ^ u${name}b" " = 3"
489 gdb_test
"print/d ${name}4a & ${name}b" " = \\{0, 0, 0, 0\\}"
490 gdb_test
"print/d ${name}a | ${name}4b" " = \\{3, 2, 10, 6\\}"
491 gdb_test
"print/d ${name}4a ^ ${name}b" " = \\{3, 5, 9, 17\\}"
492 gdb_test
"print/d u${name}4a & u${name}b" " = \\{0, 0, 0, 0\\}"
493 gdb_test
"print/d u${name}a | u${name}4b" " = \\{3, 2, 10, 6\\}"
494 gdb_test
"print/d u${name}4a ^ u${name}b" " = \\{3, 5, 9, 17\\}"
496 gdb_test
"print/d ${name}4a & ${name}4b" " = \\{0, 0, 8, 0\\}"
497 gdb_test
"print/d ${name}4a | ${name}4b" " = \\{3, 6, 8, 20\\}"
498 gdb_test
"print/d ${name}4a ^ ${name}4b" " = \\{3, 6, 0, 20\\}"
499 gdb_test
"print/d u${name}4a & u${name}4b" " = \\{0, 0, 8, 0\\}"
500 gdb_test
"print/d u${name}4a | u${name}4b" " = \\{3, 6, 8, 20\\}"
501 gdb_test
"print/d u${name}4a ^ u${name}4b" " = \\{3, 6, 0, 20\\}"
505 gdb_test
"ptype ${name}a & ${name}b" "type = int"
506 gdb_test
"ptype ${name}a | ${name}b" "type = int"
507 gdb_test
"ptype ${name}a ^ ${name}b" "type = int"
508 gdb_test
"ptype u${name}a & u${name}b" "type = int"
509 gdb_test
"ptype u${name}a | u${name}b" "type = int"
510 gdb_test
"ptype u${name}a ^ u${name}b" "type = int"
511 } elseif
{ $
{size
} == 4 } {
512 gdb_test
"ptype ${name}a & ${name}b" "type = int"
513 gdb_test
"ptype ${name}a | ${name}b" "type = int"
514 gdb_test
"ptype ${name}a ^ ${name}b" "type = int"
515 gdb_test
"ptype u${name}a & u${name}b" "type = (unsigned int|uint)"
516 gdb_test
"ptype u${name}a | u${name}b" "type = (unsigned int|uint)"
517 gdb_test
"ptype u${name}a ^ u${name}b" "type = (unsigned int|uint)"
518 } else { # $
{size
} == 8
519 gdb_test
"ptype ${name}a & ${name}b" "type = long"
520 gdb_test
"ptype ${name}a | ${name}b" "type = long"
521 gdb_test
"ptype ${name}a ^ ${name}b" "type = long"
522 gdb_test
"ptype u${name}a & u${name}b" "type = (unsigned long|ulong)"
523 gdb_test
"ptype u${name}a | u${name}b" "type = (unsigned long|ulong)"
524 gdb_test
"ptype u${name}a ^ u${name}b" "type = (unsigned long|ulong)"
527 gdb_test
"ptype ${name}4a & ${name}b" "type = ${type}4"
528 gdb_test
"ptype ${name}a | ${name}4b" "type = ${type}4"
529 gdb_test
"ptype ${name}4a ^ ${name}b" "type = ${type}4"
530 gdb_test
"ptype u${name}4a & u${name}b" "type = u${type}4"
531 gdb_test
"ptype u${name}a | u${name}4b" "type = u${type}4"
532 gdb_test
"ptype u${name}4a ^ u${name}b" "type = u${type}4"
534 gdb_test
"ptype ${name}4a & ${name}4b" "type = ${type}4"
535 gdb_test
"ptype ${name}4a | ${name}4b" "type = ${type}4"
536 gdb_test
"ptype ${name}4a ^ ${name}4b" "type = ${type}4"
537 gdb_test
"ptype u${name}4a & u${name}4b" "type = u${type}4"
538 gdb_test
"ptype u${name}4a | u${name}4b" "type = u${type}4"
539 gdb_test
"ptype u${name}4a ^ u${name}4b" "type = u${type}4"
543 gdb_test
"print/x ~${name}a" " = 0xfffffffd"
544 gdb_test
"print/x ~u${name}a" " = 0xfffffffd"
546 gdb_test
"print/x ~${name}a" " = 0xfffffffffffffffd"
547 gdb_test
"print/x ~u${name}a" " = 0xfffffffffffffffd"
550 if { $
{size
} == 1 } {
551 gdb_test
"print/x ~${name}4a" " = \\{0xfd, 0xfb, 0xf7, 0xef\\}"
552 gdb_test
"print/x ~u${name}4a" " = \\{0xfd, 0xfb, 0xf7, 0xef\\}"
553 } elseif
{ $
{size
} == 2 } {
554 gdb_test
"print/x ~${name}4a" " = \\{0xfffd, 0xfffb, 0xfff7, 0xffef\\}"
555 gdb_test
"print/x ~u${name}4a" " = \\{0xfffd, 0xfffb, 0xfff7, 0xffef\\}"
556 } elseif
{ $
{size
} == 4 } {
557 gdb_test
"print/x ~${name}4a" " = \\{0xfffffffd, 0xfffffffb, 0xfffffff7, 0xffffffef\\}"
558 gdb_test
"print/x ~u${name}4a" " = \\{0xfffffffd, 0xfffffffb, 0xfffffff7, 0xffffffef\\}"
559 } else { # $
{size
} == 8
560 gdb_test
"print/x ~${name}4a" " = \\{0xfffffffffffffffd, 0xfffffffffffffffb, 0xfffffffffffffff7, 0xffffffffffffffef\\}"
561 gdb_test
"print/x ~u${name}4a" " = \\{0xfffffffffffffffd, 0xfffffffffffffffb, 0xfffffffffffffff7, 0xffffffffffffffef\\}"
565 gdb_test
"ptype ~${name}a" "type = int"
566 gdb_test
"ptype ~u${name}a" "type = int"
567 } elseif
{ $
{size
} == 4 } {
568 gdb_test
"ptype ~${name}a" "type = int"
569 gdb_test
"ptype ~u${name}a" "type = (unsigned int|uint)"
570 } else { # $
{size
} == 8
571 gdb_test
"ptype ~${name}a" "type = long"
572 gdb_test
"ptype ~u${name}a" "type = (unsigned long|ulong)"
575 gdb_test
"ptype ~${name}4a" "type = ${type}4"
576 gdb_test
"ptype ~u${name}4a" "type = u${type}4"
580 proc check_logical_ops
{ name type isfloat size
} {
582 gdb_test
"print/d !${name}a " " = 0"
583 gdb_test
"print/d !!${name}a " " = 1"
585 gdb_test
"print/d !${name}4a " " = \\{0, 0, 0, 0\\}"
586 gdb_test
"print/d !!${name}4a " " = \\{-1, -1, -1, -1\\}"
589 gdb_test
"print/d ${name}a && ${name}b" " = 1"
590 gdb_test
"print/d ${name}a && !${name}b" " = 0"
591 gdb_test
"print/d ${name}a || ${name}b" " = 1"
592 gdb_test
"print/d ${name}a || !${name}b" " = 1"
593 gdb_test
"print/d !${name}a || !${name}b" " = 0"
596 gdb_test
"print/d ${name}4a && ${name}b" " = \\{-1, -1, -1, -1\\}"
597 gdb_test
"print/d ${name}4a && !${name}b" " = \\{0, 0, 0, 0\\}"
598 gdb_test
"print/d ${name}a || ${name}4b" " = \\{-1, -1, -1, -1\\}"
599 gdb_test
"print/d ${name}a || !${name}4b" " = \\{-1, -1, -1, -1\\}"
600 gdb_test
"print/d !${name}4a || !${name}b" " = \\{0, 0, 0, 0\\}"
602 gdb_test
"print/d ${name}4a && ${name}4b" " = \\{-1, -1, -1, -1\\}"
603 gdb_test
"print/d ${name}4a || ${name}4b" " = \\{-1, -1, -1, -1\\}"
605 # result type should be
int for scalars
606 gdb_test
"ptype !${name}a" "type = int"
607 gdb_test
"ptype ${name}a && ${name}b" "type = int"
608 gdb_test
"ptype ${name}a || ${name}b" "type = int"
611 if { $
{size
} == 2 } {
612 # result type should be short
for half precision floating point vectors
614 gdb_test
"ptype ${name}4a && ${name}b" "type = short4"
615 gdb_test
"ptype ${name}a || ${name}4b" "type = short4"
617 gdb_test
"ptype !${name}4a" "type = short4"
618 gdb_test
"ptype ${name}4a && ${name}4b" "type = short4"
619 gdb_test
"ptype ${name}4a || ${name}4b" "type = short4"
620 } elseif
{ $
{size
} == 4 } {
621 # result type should be
int for single precision floating point vectors
623 gdb_test
"ptype ${name}4a && ${name}b" "type = int4"
624 gdb_test
"ptype ${name}a || ${name}4b" "type = int4"
626 gdb_test
"ptype !${name}4a" "type = int4"
627 gdb_test
"ptype ${name}4a && ${name}4b" "type = int4"
628 gdb_test
"ptype ${name}4a || ${name}4b" "type = int4"
629 } else { # $
{size
} == 8
630 # result type should be long
for double precision floating point vectors
632 gdb_test
"ptype ${name}4a && ${name}b" "type = long4"
633 gdb_test
"ptype ${name}a || ${name}4b" "type = long4"
635 gdb_test
"ptype !${name}4a" "type = long4"
636 gdb_test
"ptype ${name}4a && ${name}4b" "type = long4"
637 gdb_test
"ptype ${name}4a || ${name}4b" "type = long4"
641 gdb_test
"print/d !u${name}a " " = 0"
642 gdb_test
"print/d !!u${name}a " " = 1"
644 gdb_test
"print/d !u${name}4a " " = \\{0, 0, 0, 0\\}"
645 gdb_test
"print/d !!u${name}4a " " = \\{-1, -1, -1, -1\\}"
648 gdb_test
"print/d u${name}a && u${name}b" " = 1"
649 gdb_test
"print/d u${name}a || u${name}b" " = 1"
651 gdb_test
"print/d u${name}4a && u${name}b" " = \\{-1, -1, -1, -1\\}"
652 gdb_test
"print/d u${name}a || u${name}4b" " = \\{-1, -1, -1, -1\\}"
654 gdb_test
"print/d u${name}4a && u${name}4b" " = \\{-1, -1, -1, -1\\}"
655 gdb_test
"print/d u${name}4a || u${name}4b" " = \\{-1, -1, -1, -1\\}"
658 gdb_test
"ptype !u${name}a" "type = int"
660 gdb_test
"ptype !${name}4a" "type = ${type}4"
661 gdb_test
"ptype !u${name}4a" "type = ${type}4"
664 gdb_test
"ptype ${name}4a && ${name}b" "type = ${type}4"
665 gdb_test
"ptype ${name}a || ${name}4b" "type = ${type}4"
666 # result type
for unsigned vector operand is signed
667 gdb_test
"ptype u${name}4a && u${name}b" "type = ${type}4"
668 gdb_test
"ptype u${name}a || u${name}4b" "type = ${type}4"
670 gdb_test
"ptype ${name}4a && ${name}4b" "type = ${type}4"
671 gdb_test
"ptype ${name}4a || ${name}4b" "type = ${type}4"
672 # result type
for unsigned vector operand is signed
673 gdb_test
"ptype u${name}4a && u${name}4b" "type = ${type}4"
674 gdb_test
"ptype u${name}4a || u${name}4b" "type = ${type}4"
678 # Conditional operator
679 proc check_conditional_op
{ name type isfloat
} {
681 gdb_test
"print/d ${name}a ? ${name}b : ${name}a" " = 1"
682 gdb_test
"print/d !${name}a ? ${name}b : ${name}a" " = 2"
684 gdb_test
"print/d ${name}4a ? ${name}4b : ${name}a" " = \\{1, 2, 8, 4\\}"
685 gdb_test
"print/d ${name}4a ? ${name}b : ${name}4a" " = \\{1, 1, 1, 1\\}"
686 gdb_test
"print/d ${name}4a > 4 ? 1 : ${name}4a" " = \\{2, 4, 1, 1\\}"
687 gdb_test
"print/d ${name}4a > 4 ? ${name}4b : ${name}a" " = \\{2, 2, 8, 4\\}"
689 gdb_test
"print/d ${name}4a ? ${name}4b : ${name}4a" " = \\{1, 2, 8, 4\\}"
690 gdb_test
"print/d ${name}4a > 4 ? ${name}4b : ${name}4a" " = \\{2, 4, 8, 4\\}"
693 gdb_test
"ptype ${name}a ? ${name}b : ${name}a" "type = ${type}"
695 gdb_test
"ptype ${name}4a ? ${name}4b : ${name}a" "type = ${type}4"
696 gdb_test
"ptype ${name}4a ? ${name}b : ${name}4a" "type = ${type}4"
698 gdb_test
"ptype ${name}4a ? ${name}4b : ${name}4a" "type = ${type}4"
702 gdb_test
"print/d u${name}a ? u${name}b : u${name}a" " = 1"
703 gdb_test
"print/d !u${name}a ? u${name}b : u${name}a" " = 2"
705 gdb_test
"print/d u${name}4a ? u${name}4b : u${name}a" " = \\{1, 2, 8, 4\\}"
706 gdb_test
"print/d u${name}4a ? u${name}b : u${name}4a" " = \\{1, 1, 1, 1\\}"
707 gdb_test
"print/d u${name}4a > 4 ? 1 : u${name}4a" " = \\{2, 4, 1, 1\\}"
708 gdb_test
"print/d u${name}4a > 4 ? u${name}4b : u${name}a" " = \\{2, 2, 8, 4\\}"
710 gdb_test
"print/d u${name}4a ? u${name}4b : u${name}4a" " = \\{1, 2, 8, 4\\}"
711 gdb_test
"print/d u${name}4a > 4 ? u${name}4b : u${name}4a" " = \\{2, 4, 8, 4\\}"
714 gdb_test
"ptype u${name}a ? u${name}b : u${name}a" "type = (unsigned ${type}|u${type})"
716 gdb_test
"ptype u${name}4a ? u${name}4b : u${name}a" "type = u${type}4"
717 gdb_test
"ptype u${name}4a ? u${name}b : u${name}4a" "type = u${type}4"
719 gdb_test
"ptype u${name}4a ? u${name}4b : u${name}4a" "type = u${type}4"
723 # Assignment operators
724 proc check_assignment_ops
{ name type isfloat size
} {
726 gdb_test
"print/d ${name}a = ${name}b" " = 1"
727 gdb_test
"print/d ${name}a = 2" " = 2"
728 gdb_test
"print/d ${name}a += ${name}b" " = 3"
729 gdb_test
"print/d ${name}a -= ${name}b" " = 2"
730 gdb_test
"print/d ${name}b *= ${name}a" " = 2"
731 gdb_test
"print/d ${name}b /= ${name}a" " = 1"
733 gdb_test
"print/d ${name}4a = ${name}b" " = \\{1, 1, 1, 1\\}"
734 gdb_test
"print/d ${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
735 gdb_test
"print/d ${name}4a += ${name}b" " = \\{3, 5, 9, 17\\}"
736 gdb_test
"print/d ${name}4a -= ${name}b" " = \\{2, 4, 8, 16\\}"
737 gdb_test
"print/d ${name}4b *= ${name}a" " = \\{2, 4, 16, 8\\}"
738 gdb_test
"print/d ${name}4b /= ${name}a" " = \\{1, 2, 8, 4\\}"
740 gdb_test
"print/d ${name}4a = ${name}4b" " = \\{1, 2, 8, 4\\}"
741 gdb_test
"print/d ${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
742 gdb_test
"print/d ${name}4a += ${name}4b" " = \\{3, 6, 16, 20\\}"
743 gdb_test
"print/d ${name}4a -= ${name}4b" " = \\{2, 4, 8, 16\\}"
744 gdb_test
"print/d ${name}4b *= ${name}4a" " = \\{2, 8, 64, 64\\}"
745 gdb_test
"print/d ${name}4b /= ${name}4a" " = \\{1, 2, 8, 4\\}"
748 gdb_test
"ptype ${name}a = ${name}b" "type = ${type}"
749 gdb_test
"ptype ${name}a += ${name}b" "type = ${type}"
750 gdb_test
"ptype ${name}a -= ${name}b" "type = ${type}"
751 gdb_test
"ptype ${name}a *= ${name}b" "type = ${type}"
752 gdb_test
"ptype ${name}a /= ${name}b" "type = ${type}"
754 gdb_test
"ptype ${name}4a = ${name}b" "type = ${type}4"
755 gdb_test
"ptype ${name}4a += ${name}b" "type = ${type}4"
756 gdb_test
"ptype ${name}4a -= ${name}b" "type = ${type}4"
757 gdb_test
"ptype ${name}4b *= ${name}a" "type = ${type}4"
758 gdb_test
"ptype ${name}4b /= ${name}a" "type = ${type}4"
760 gdb_test
"ptype ${name}4a = ${name}4b" "type = ${type}4"
761 gdb_test
"ptype ${name}4a += ${name}4b" "type = ${type}4"
762 gdb_test
"ptype ${name}4a -= ${name}4b" "type = ${type}4"
763 gdb_test
"ptype ${name}4b *= ${name}4a" "type = ${type}4"
764 gdb_test
"ptype ${name}4b /= ${name}4a" "type = ${type}4"
768 gdb_test
"print/d ${name}a %= ${name}b" " = 0"
769 gdb_test
"print/d ${name}a = 2" " = 2"
770 gdb_test
"print/d ${name}a <<= ${name}b" " = 4"
771 gdb_test
"print/d ${name}a = 2" " = 2"
772 gdb_test
"print/d ${name}a >>= ${name}b" " = 1"
773 gdb_test
"print/d ${name}a = 2" " = 2"
774 gdb_test
"print/d ${name}a &= ${name}b" " = 0"
775 gdb_test
"print/d ${name}a = 2" " = 2"
776 gdb_test
"print/d ${name}a |= ${name}b" " = 3"
777 gdb_test
"print/d ${name}a = 2" " = 2"
778 gdb_test
"print/d ${name}a ^= ${name}b" " = 3"
779 gdb_test
"print/d ${name}a = 2" " = 2"
781 gdb_test
"print/d ${name}4b %= ${name}a" " = \\{1, 0, 0, 0\\}"
782 gdb_test
"print/d ${name}4b = \{1, 2, 8, 4\}" " = \\{1, 2, 8, 4\\}"
783 gdb_test
"print/d ${name}4a <<= ${name}b" " = \\{4, 8, 16, 32\\}"
784 gdb_test
"print/d ${name}4a >>= ${name}b" " = \\{2, 4, 8, 16\\}"
785 gdb_test
"print/d ${name}4a &= ${name}b" " = \\{0, 0, 0, 0\\}"
786 gdb_test
"print/d ${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
787 gdb_test
"print/d ${name}4a |= ${name}b" " = \\{3, 5, 9, 17\\}"
788 gdb_test
"print/d ${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
789 gdb_test
"print/d ${name}4a ^= ${name}b" " = \\{3, 5, 9, 17\\}"
790 gdb_test
"print/d ${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
792 gdb_test
"print/d ${name}4b %= ${name}4a" " = \\{1, 2, 0, 4\\}"
793 gdb_test
"print/d ${name}4b = \{1, 2, 8, 4\}" " = \\{1, 2, 8, 4\\}"
794 if { $
{size
} == 1 } {
795 gdb_test
"print/d ${name}4a <<= ${name}4b" " = \\{4, 16, 0, 0\\}"
796 gdb_test
"print/d ${name}4a >>= ${name}4b" " = \\{2, 4, 0, 0\\}"
797 gdb_test
"print/d ${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
799 gdb_test
"print/d ${name}4a <<= ${name}4b" " = \\{4, 16, 2048, 256\\}"
800 gdb_test
"print/d ${name}4a >>= ${name}4b" " = \\{2, 4, 8, 16\\}"
802 gdb_test
"print/d ${name}4a &= ${name}4b" " = \\{0, 0, 8, 0\\}"
803 gdb_test
"print/d ${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
804 gdb_test
"print/d ${name}4a |= ${name}4b" " = \\{3, 6, 8, 20\\}"
805 gdb_test
"print/d ${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
806 gdb_test
"print/d ${name}4a ^= ${name}4b" " = \\{3, 6, 0, 20\\}"
807 gdb_test
"print/d ${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
810 gdb_test
"ptype ${name}a %= ${name}b" "type = ${type}"
811 gdb_test
"ptype ${name}a <<= ${name}b" "type = ${type}"
812 gdb_test
"ptype ${name}a >>= ${name}b" "type = ${type}"
813 gdb_test
"ptype ${name}a &= ${name}b" "type = ${type}"
814 gdb_test
"ptype ${name}a |= ${name}b" "type = ${type}"
815 gdb_test
"ptype ${name}a ^= ${name}b" "type = ${type}"
817 gdb_test
"ptype ${name}4a %= ${name}b" "type = ${type}4"
818 gdb_test
"ptype ${name}4a <<= ${name}b" "type = ${type}4"
819 gdb_test
"ptype ${name}4a >>= ${name}b" "type = ${type}4"
820 gdb_test
"ptype ${name}4a &= ${name}b" "type = ${type}4"
821 gdb_test
"ptype ${name}4a |= ${name}b" "type = ${type}4"
822 gdb_test
"ptype ${name}4a ^= ${name}b" "type = ${type}4"
824 gdb_test
"ptype ${name}4a %= ${name}4b" "type = ${type}4"
825 gdb_test
"ptype ${name}4a <<= ${name}4b" "type = ${type}4"
826 gdb_test
"ptype ${name}4a >>= ${name}4b" "type = ${type}4"
827 gdb_test
"ptype ${name}4a &= ${name}4b" "type = ${type}4"
828 gdb_test
"ptype ${name}4a |= ${name}4b" "type = ${type}4"
829 gdb_test
"ptype ${name}4a ^= ${name}4b" "type = ${type}4"
832 gdb_test
"print/d u${name}a = u${name}b" " = 1"
833 gdb_test
"print/d u${name}a = 2" " = 2"
834 gdb_test
"print/d u${name}a += u${name}b" " = 3"
835 gdb_test
"print/d u${name}a -= u${name}b" " = 2"
836 gdb_test
"print/d u${name}b *= u${name}a" " = 2"
837 gdb_test
"print/d u${name}b /= u${name}a" " = 1"
838 gdb_test
"print/d u${name}a %= u${name}b" " = 0"
839 gdb_test
"print/d u${name}a = 2" " = 2"
840 gdb_test
"print/d u${name}a <<= u${name}b" " = 4"
841 gdb_test
"print/d u${name}a = 2" " = 2"
842 gdb_test
"print/d u${name}a >>= u${name}b" " = 1"
843 gdb_test
"print/d u${name}a = 2" " = 2"
844 gdb_test
"print/d u${name}a &= u${name}b" " = 0"
845 gdb_test
"print/d u${name}a = 2" " = 2"
846 gdb_test
"print/d u${name}a |= u${name}b" " = 3"
847 gdb_test
"print/d u${name}a = 2" " = 2"
848 gdb_test
"print/d u${name}a ^= u${name}b" " = 3"
849 gdb_test
"print/d u${name}a = 2" " = 2"
851 gdb_test
"print/d u${name}4a = u${name}b" " = \\{1, 1, 1, 1\\}"
852 gdb_test
"print/d u${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
853 gdb_test
"print/d u${name}4a += u${name}b" " = \\{3, 5, 9, 17\\}"
854 gdb_test
"print/d u${name}4a -= u${name}b" " = \\{2, 4, 8, 16\\}"
855 gdb_test
"print/d u${name}4b *= u${name}a" " = \\{2, 4, 16, 8\\}"
856 gdb_test
"print/d u${name}4b /= u${name}a" " = \\{1, 2, 8, 4\\}"
857 gdb_test
"print/d u${name}4b %= u${name}a" " = \\{1, 0, 0, 0\\}"
858 gdb_test
"print/d u${name}4b = \{1, 2, 8, 4\}" " = \\{1, 2, 8, 4\\}"
859 gdb_test
"print/d u${name}4a <<= u${name}b" " = \\{4, 8, 16, 32\\}"
860 gdb_test
"print/d u${name}4a >>= u${name}b" " = \\{2, 4, 8, 16\\}"
861 gdb_test
"print/d u${name}4a &= u${name}b" " = \\{0, 0, 0, 0\\}"
862 gdb_test
"print/d u${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
863 gdb_test
"print/d u${name}4a |= u${name}b" " = \\{3, 5, 9, 17\\}"
864 gdb_test
"print/d u${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
865 gdb_test
"print/d u${name}4a ^= u${name}b" " = \\{3, 5, 9, 17\\}"
866 gdb_test
"print/d u${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
868 gdb_test
"print/d u${name}4a = u${name}4b" " = \\{1, 2, 8, 4\\}"
869 gdb_test
"print/d u${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
870 gdb_test
"print/d u${name}4a += u${name}4b" " = \\{3, 6, 16, 20\\}"
871 gdb_test
"print/d u${name}4a -= u${name}4b" " = \\{2, 4, 8, 16\\}"
872 gdb_test
"print/d u${name}4b *= u${name}4a" " = \\{2, 8, 64, 64\\}"
873 gdb_test
"print/d u${name}4b /= u${name}4a" " = \\{1, 2, 8, 4\\}"
874 gdb_test
"print/d u${name}4b %= u${name}4a" " = \\{1, 2, 0, 4\\}"
875 gdb_test
"print/d u${name}4b = \{1, 2, 8, 4\}" " = \\{1, 2, 8, 4\\}"
876 if { $
{size
} == 1 } {
877 gdb_test
"print/d u${name}4a <<= u${name}4b" " = \\{4, 16, 0, 0\\}"
878 gdb_test
"print/d u${name}4a >>= u${name}4b" " = \\{2, 4, 0, 0\\}"
879 gdb_test
"print/d u${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
881 gdb_test
"print/d u${name}4a <<= u${name}4b" " = \\{4, 16, 2048, 256\\}"
882 gdb_test
"print/d u${name}4a >>= u${name}4b" " = \\{2, 4, 8, 16\\}"
884 gdb_test
"print/d u${name}4a &= u${name}4b" " = \\{0, 0, 8, 0\\}"
885 gdb_test
"print/d u${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
886 gdb_test
"print/d u${name}4a |= u${name}4b" " = \\{3, 6, 8, 20\\}"
887 gdb_test
"print/d u${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
888 gdb_test
"print/d u${name}4a ^= u${name}4b" " = \\{3, 6, 0, 20\\}"
889 gdb_test
"print/d u${name}4a = \{2, 4, 8, 16\}" " = \\{2, 4, 8, 16\\}"
892 gdb_test
"ptype u${name}a = u${name}b" "type = (unsigned ${type}|u${type})"
893 gdb_test
"ptype u${name}a += u${name}b" "type = (unsigned ${type}|u${type})"
894 gdb_test
"ptype u${name}a -= u${name}b" "type = (unsigned ${type}|u${type})"
895 gdb_test
"ptype u${name}a *= u${name}b" "type = (unsigned ${type}|u${type})"
896 gdb_test
"ptype u${name}a /= u${name}b" "type = (unsigned ${type}|u${type})"
897 gdb_test
"ptype u${name}a %= u${name}b" "type = (unsigned ${type}|u${type})"
898 gdb_test
"ptype u${name}a <<= u${name}b" "type = (unsigned ${type}|u${type})"
899 gdb_test
"ptype u${name}a >>= u${name}b" "type = (unsigned ${type}|u${type})"
900 gdb_test
"ptype u${name}a &= u${name}b" "type = (unsigned ${type}|u${type})"
901 gdb_test
"ptype u${name}a |= u${name}b" "type = (unsigned ${type}|u${type})"
902 gdb_test
"ptype u${name}a ^= u${name}b" "type = (unsigned ${type}|u${type})"
904 gdb_test
"ptype u${name}4a = u${name}b" "type = u${type}4"
905 gdb_test
"ptype u${name}4a += u${name}b" "type = u${type}4"
906 gdb_test
"ptype u${name}4a -= u${name}b" "type = u${type}4"
907 gdb_test
"ptype u${name}4b *= u${name}a" "type = u${type}4"
908 gdb_test
"ptype u${name}4b /= u${name}a" "type = u${type}4"
909 gdb_test
"ptype u${name}4a %= u${name}b" "type = u${type}4"
910 gdb_test
"ptype u${name}4a <<= u${name}b" "type = u${type}4"
911 gdb_test
"ptype u${name}4a >>= u${name}b" "type = u${type}4"
912 gdb_test
"ptype u${name}4a &= u${name}b" "type = u${type}4"
913 gdb_test
"ptype u${name}4a |= u${name}b" "type = u${type}4"
914 gdb_test
"ptype u${name}4a ^= u${name}b" "type = u${type}4"
916 gdb_test
"ptype u${name}4a = u${name}4b" "type = u${type}4"
917 gdb_test
"ptype u${name}4a += u${name}4b" "type = u${type}4"
918 gdb_test
"ptype u${name}4a -= u${name}4b" "type = u${type}4"
919 gdb_test
"ptype u${name}4b *= u${name}4a" "type = u${type}4"
920 gdb_test
"ptype u${name}4b /= u${name}4a" "type = u${type}4"
921 gdb_test
"ptype u${name}4a %= u${name}4b" "type = u${type}4"
922 gdb_test
"ptype u${name}4a <<= u${name}4b" "type = u${type}4"
923 gdb_test
"ptype u${name}4a >>= u${name}4b" "type = u${type}4"
924 gdb_test
"ptype u${name}4a &= u${name}4b" "type = u${type}4"
925 gdb_test
"ptype u${name}4a |= u${name}4b" "type = u${type}4"
926 gdb_test
"ptype u${name}4a ^= u${name}4b" "type = u${type}4"
930 proc do_check
{ name type isfloat size
} {
931 check_basic $
{name} $
{type
} $
{isfloat
}
932 check_arithmetic_ops $
{name} $
{type
} $
{isfloat
} $
{size
}
933 check_relational_ops $
{name} $
{type
} $
{isfloat
} $
{size
}
934 check_equality_ops $
{name} $
{type
} $
{isfloat
} $
{size
}
936 check_shift_ops $
{name} $
{type
} $
{size
}
937 check_bitwise_ops $
{name} $
{type
} $
{size
}
939 check_logical_ops $
{name} $
{type
} $
{isfloat
} $
{size
}
940 check_conditional_op $
{name} $
{type
} $
{isfloat
}
941 check_assignment_ops $
{name} $
{type
} $
{isfloat
} $
{size
}
944 do_check
"c" "char" 0 1
945 do_check
"s" "short" 0 2
946 do_check
"i" "int" 0 4
947 do_check
"l" "long" 0 8
948 if { $
{have_cl_khr_fp16
} } {
949 do_check
"h" "half" 1 2
951 do_check
"f" "float" 1 4
952 if { $
{have_cl_khr_fp64
} } {
953 do_check
"d" "double" 1 8
955 #
Delete the OpenCL
program source
956 remote_file target
delete $
{clprogram
}