// // Copyright (c) 2017 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #include "harness/compat.h" #include #include #include #include #include #include "procs.h" const char *conditional_kernel_code = "__kernel void test_if(__global int *src, __global int *dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" " if (src[tid] == 0)\n" " dst[tid] = 0x12345678;\n" " else if (src[tid] == 1)\n" " dst[tid] = 0x23456781;\n" " else if (src[tid] == 2)\n" " dst[tid] = 0x34567812;\n" " else if (src[tid] == 3)\n" " dst[tid] = 0x45678123;\n" " else if (src[tid] == 4)\n" " dst[tid] = 0x56781234;\n" " else if (src[tid] == 5)\n" " dst[tid] = 0x67812345;\n" " else if (src[tid] == 6)\n" " dst[tid] = 0x78123456;\n" " else if (src[tid] == 7)\n" " dst[tid] = 0x81234567;\n" " else\n" " dst[tid] = 0x7FFFFFFF;\n" "\n" "}\n"; const int results[] = { 0x12345678, 0x23456781, 0x34567812, 0x45678123, 0x56781234, 0x67812345, 0x78123456, 0x81234567, }; int verify_if(int *inptr, int *outptr, int n) { int r, i; for (i=0; i