// RUN: %clang_cc1 -no-opaque-pointers %s -cl-std=CL1.2 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s
// RUN: %clang_cc1 -no-opaque-pointers %s -cl-std=CL1.2 -emit-llvm -triple amdgcn-unknown-unknown -o - | FileCheck -check-prefixes=AMDGCN %s
// Test that the kernels always use the SPIR calling convention
// to have unambiguous mapping of arguments to feasibly implement
// clSetKernelArg;
} int_single;
typedef struct int_pair {
long a;
long b;
} int_pair;
typedef struct test_struct {
int elementA;
int elementB;
long elementC;
char elementD;
long elementE;
float elementF;
short elementG;
double elementH;
} test_struct;
kernel void test_single {
// CHECK: spir_kernel
// AMDGCN: define{{.*}} amdgpu_kernel void @test_single
// CHECK: struct.int_single* nocapture {{.*}} byval
// CHECK: i32* nocapture noundef writeonly align 4 %output
output[0] = input.a;
}
kernel void test_pair {
// CHECK: spir_kernel
// AMDGCN: define{{.*}} amdgpu_kernel void @test_pair
// CHECK: struct.int_pair* nocapture {{.*}} byval
// CHECK: i32* nocapture noundef writeonly align 4 %output
output[0] = input.a;
output[1] = input.b;
}
kernel void test_kernel {
// CHECK: spir_kernel
// AMDGCN: define{{.*}} amdgpu_kernel void @test_kernel
// CHECK: struct.test_struct* nocapture {{.*}} byval
// CHECK: i32* nocapture noundef writeonly align 4 %output
output[0] = input.elementA;
output[1] = input.elementB;
output[2] = input.elementC;
output[3] = input.elementD;
output[4] = input.elementE;
output[5] = input.elementF;
output[6] = input.elementG;
output[7] = input.elementH;
};
void test_function {
// CHECK-NOT: spir_kernel
// AMDGCN-NOT: define{{.*}} amdgpu_kernel void @test_function
// CHECK: i64 %input.coerce0, i64 %input.coerce1, i32* nocapture noundef writeonly %output
output[0] = input.a;
output[1] = input.b;
}
.
typedef struct int_single {
int a