summaryrefslogtreecommitdiff
path: root/tests/cl/program/execute/int-definitions.cl
blob: 011599d28db6b0d5a8c092620cb7c5dd904996ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*!

[config]
name: Integer Definitions
clc_version_min: 10

dimensions: 1
global_size: 1 0 0

## Integer definitions from spec ##

[test]
name: Char Definitions
kernel_name: test_char
arg_out: 0 buffer int[6] 8 127 -128 127 -128 255

[test]
name: Short Definitions
kernel_name: test_short
arg_out: 0 buffer int[3] 32767 -32768 65535

[test]
name: Int Definitions
kernel_name: test_int
arg_out: 0 buffer int[3] 2147483647 -2147483648 0xffffffff

[test]
name: Long Definitions
kernel_name: test_long
arg_out: 0 buffer long[3] 9223372036854775807 \
                          -9223372036854775808 \
                          18446744073709551615
!*/

kernel void test_char(global int* out) {
  int i = 0;
  out[i++] = CHAR_BIT;
  out[i++] = CHAR_MAX;
  out[i++] = CHAR_MIN;
  out[i++] = SCHAR_MAX;
  out[i++] = SCHAR_MIN;
  out[i++] = UCHAR_MAX;
}

kernel void test_short(global int* out) {
  int i = 0;
  out[i++] = SHRT_MAX;
  out[i++] = SHRT_MIN;
  out[i++] = USHRT_MAX;
}

kernel void test_int(global int* out) {
  int i = 0;
  out[i++] = INT_MAX;
  out[i++] = INT_MIN;
  out[i++] = UINT_MAX;
}

kernel void test_long(global long* out) {
  int i = 0;
  out[i++] = LONG_MAX;
  out[i++] = LONG_MIN;
  out[i++] = ULONG_MAX;
}