brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · d8b6e13 Raw
66 lines · plain
1// RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s2// RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple amdgcn-unknown-unknown -o - | FileCheck -check-prefixes=AMDGCN %s3// Test that the kernels always use the SPIR calling convention4// to have unambiguous mapping of arguments to feasibly implement5// clSetKernelArg().6 7typedef struct int_single {8    int a;9} int_single;10 11typedef struct int_pair {12    long a;13    long b;14} int_pair;15 16typedef struct test_struct {17    int elementA;18    int elementB;19    long elementC;20    char elementD;21    long elementE;22    float elementF;23    short elementG;24    double elementH;25} test_struct;26 27kernel void test_single(int_single input, global int* output) {28// CHECK: spir_kernel29// AMDGCN: define{{.*}} amdgpu_kernel void @test_single30// CHECK: ptr {{.*}} byval(%struct.int_single) align 4 captures(none)31// CHECK: ptr noundef writeonly align 4 captures(none) initializes((0, 4)) %output32 output[0] = input.a;33}34 35kernel void test_pair(int_pair input, global int* output) {36// CHECK: spir_kernel37// AMDGCN: define{{.*}} amdgpu_kernel void @test_pair38// CHECK: ptr {{.*}} byval(%struct.int_pair) align 8 captures(none)39// CHECK: ptr noundef writeonly align 4 captures(none) initializes((0, 8)) %output40 output[0] = (int)input.a;41 output[1] = (int)input.b;42}43 44kernel void test_kernel(test_struct input, global int* output) {45// CHECK: spir_kernel46// AMDGCN: define{{.*}} amdgpu_kernel void @test_kernel47// CHECK: ptr {{.*}} byval(%struct.test_struct) align 8 captures(none)48// CHECK: ptr noundef writeonly align 4 captures(none) initializes((0, 32)) %output49 output[0] = input.elementA;50 output[1] = input.elementB;51 output[2] = (int)input.elementC;52 output[3] = (int)input.elementD;53 output[4] = (int)input.elementE;54 output[5] = (int)input.elementF;55 output[6] = (int)input.elementG;56 output[7] = (int)input.elementH;57};58 59void test_function(int_pair input, global int* output) {60// CHECK-NOT: spir_kernel61// AMDGCN-NOT: define{{.*}} amdgpu_kernel void @test_function62// CHECK: i64 %input.coerce0, i64 %input.coerce1, ptr noundef writeonly captures(none) initializes((0, 8)) %output63 output[0] = (int)input.a;64 output[1] = (int)input.b;65}66