]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.opencl/operators.cl
update copyright year range in GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.opencl / operators.cl
1 /* This testcase is part of GDB, the GNU debugger.
2
3 Copyright 2010-2017 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 Contributed by Ken Werner <ken.werner@de.ibm.com> */
19
20 __constant int opencl_version = __OPENCL_VERSION__;
21
22 #ifdef HAVE_cl_khr_fp64
23 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
24 __constant int have_cl_khr_fp64 = 1;
25 #else
26 __constant int have_cl_khr_fp64 = 0;
27 #endif
28
29 #ifdef HAVE_cl_khr_fp16
30 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
31 __constant int have_cl_khr_fp16 = 1;
32 #else
33 __constant int have_cl_khr_fp16 = 0;
34 #endif
35
36 __kernel void testkernel (__global int *data)
37 {
38 char ca = 2;
39 char cb = 1;
40 uchar uca = 2;
41 uchar ucb = 1;
42 char4 c4a = (char4) (2, 4, 8, 16);
43 char4 c4b = (char4) (1, 2, 8, 4);
44 uchar4 uc4a = (uchar4) (2, 4, 8, 16);
45 uchar4 uc4b = (uchar4) (1, 2, 8, 4);
46
47 short sa = 2;
48 short sb = 1;
49 ushort usa = 2;
50 ushort usb = 1;
51 short4 s4a = (short4) (2, 4, 8, 16);
52 short4 s4b = (short4) (1, 2, 8, 4);
53 ushort4 us4a = (ushort4) (2, 4, 8, 16);
54 ushort4 us4b = (ushort4) (1, 2, 8, 4);
55
56 int ia = 2;
57 int ib = 1;
58 uint uia = 2;
59 uint uib = 1;
60 int4 i4a = (int4) (2, 4, 8, 16);
61 int4 i4b = (int4) (1, 2, 8, 4);
62 uint4 ui4a = (uint4) (2, 4, 8, 16);
63 uint4 ui4b = (uint4) (1, 2, 8, 4);
64
65 long la = 2;
66 long lb = 1;
67 ulong ula = 2;
68 ulong ulb = 1;
69 long4 l4a = (long4) (2, 4, 8, 16);
70 long4 l4b = (long4) (1, 2, 8, 4);
71 ulong4 ul4a = (ulong4) (2, 4, 8, 16);
72 ulong4 ul4b = (ulong4) (1, 2, 8, 4);
73
74 #ifdef cl_khr_fp16
75 half ha = 2;
76 half hb = 1;
77 half4 h4a = (half4) (2, 4, 8, 16);
78 half4 h4b = (half4) (1, 2, 8, 4);
79 #endif
80
81 float fa = 2;
82 float fb = 1;
83 float4 f4a = (float4) (2, 4, 8, 16);
84 float4 f4b = (float4) (1, 2, 8, 4);
85
86 #ifdef cl_khr_fp64
87 double da = 2;
88 double db = 1;
89 double4 d4a = (double4) (2, 4, 8, 16);
90 double4 d4b = (double4) (1, 2, 8, 4);
91 #endif
92
93 uint4 ui4 = (uint4) (2, 4, 8, 16);
94 int2 i2 = (int2) (1, 2);
95 long2 l2 = (long2) (1, 2);
96 #ifdef cl_khr_fp16
97 half2 h2 = (half2) (1, 2);
98 #endif
99 float2 f2 = (float2) (1, 2);
100 #ifdef cl_khr_fp64
101 double2 d2 = (double2) (1, 2);
102 #endif
103
104 /* marker! */
105
106 data[get_global_id(0)] = 1;
107 }