diff options
author | Ruiling Song <ruiling.song@intel.com> | 2013-09-18 10:18:43 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@linux.intel.com> | 2013-09-18 13:11:44 +0800 |
commit | 86becbcd3490db2710c21d5ba370f3331f8ee73d (patch) | |
tree | 04ceb1afcc89d93c22e184726453bde19ba1ceee /kernels/compiler_global_constant.cl | |
parent | 912f7a4ea0cda6b70253ebf840827ce28b6a6c12 (diff) | |
download | beignet-86becbcd3490db2710c21d5ba370f3331f8ee73d.tar.gz |
utests: add more constant test cases for composite type.
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'kernels/compiler_global_constant.cl')
-rw-r--r-- | kernels/compiler_global_constant.cl | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/kernels/compiler_global_constant.cl b/kernels/compiler_global_constant.cl index 5db58d6d..71fe86ca 100644 --- a/kernels/compiler_global_constant.cl +++ b/kernels/compiler_global_constant.cl @@ -1,10 +1,65 @@ constant int m[3] = {71,72,73}; constant int n = 1; -constant int o[3] = {1, 1, 1}; +constant int o[3] = {3, 2, 1}; + +constant int4 a= {1, 2, 3, 4}; +constant int4 b = {0, -1, -2, -3}; + +struct Person { + char name[7]; + int3 idNumber; +}; + +struct Test1 { + int a0; + char a1; +}; + +struct Test2 { + char a0; + int a1; +}; + +constant struct Person james= {{"james"}, (int3)(1, 2, 3)}; + +constant struct Test1 t0 = {1, 2}; +constant struct Test2 t1 = {1, 2}; + +constant int3 c[3] = {(int3)(0, 1, 2), (int3)(3, 4, 5), (int3)(6,7,8) }; +constant char4 d[3] = {(char4)(0, 1, 2, 3), (char4)(4, 5, 6, 7), (char4)(8, 9, 10, 11)}; + +constant struct Person members[3] = {{{"abc"}, (int3)(1, 2, 3)}, { {"defg"}, (int3)(4,5,6)}, { {"hijk"}, (int3)(7,8,9)} }; __kernel void compiler_global_constant(__global int *dst, int e, int r) { int id = (int)get_global_id(0); - dst[id] = m[id%3] * n * o[2] + e + r; + + int4 x = a + b; + dst[id] = m[id%3] * n * o[2] + e + r *x.y * a.x; +} +// array of vectors +__kernel void +compiler_global_constant1(__global int *dst) +{ + int id = (int)get_global_id(0); + dst[id] = c[id%3].y + d[id%3].w; +} + +// structure +__kernel void +compiler_global_constant2(__global int *dst) +{ + int id = (int)get_global_id(0); + + dst[id] = james.idNumber.y + t0.a1 + t1.a1; +} + +//array of structure +__kernel void +compiler_global_constant3(__global int *dst) +{ + int id = (int)get_global_id(0); + + dst[id] = members[id%3].idNumber.z + members[id%3].name[2]; } |