[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / clang / test / CodeGenOpenCL / kernels-have-spir-cc-by-default.cl
blob2aeeb637795a9df44f425f399a1da65082b078cc
1 // RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s
2 // RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple amdgcn-unknown-unknown -o - | FileCheck -check-prefixes=AMDGCN %s
3 // Test that the kernels always use the SPIR calling convention
4 // to have unambiguous mapping of arguments to feasibly implement
5 // clSetKernelArg().
7 typedef struct int_single {
8 int a;
9 } int_single;
11 typedef struct int_pair {
12 long a;
13 long b;
14 } int_pair;
16 typedef 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;
27 kernel void test_single(int_single input, global int* output) {
28 // CHECK: spir_kernel
29 // AMDGCN: define{{.*}} amdgpu_kernel void @test_single
30 // CHECK: ptr nocapture {{.*}} byval(%struct.int_single)
31 // CHECK: ptr nocapture noundef writeonly align 4 initializes((0, 4)) %output
32 output[0] = input.a;
35 kernel void test_pair(int_pair input, global int* output) {
36 // CHECK: spir_kernel
37 // AMDGCN: define{{.*}} amdgpu_kernel void @test_pair
38 // CHECK: ptr nocapture {{.*}} byval(%struct.int_pair)
39 // CHECK: ptr nocapture noundef writeonly align 4 initializes((0, 8)) %output
40 output[0] = (int)input.a;
41 output[1] = (int)input.b;
44 kernel void test_kernel(test_struct input, global int* output) {
45 // CHECK: spir_kernel
46 // AMDGCN: define{{.*}} amdgpu_kernel void @test_kernel
47 // CHECK: ptr nocapture {{.*}} byval(%struct.test_struct)
48 // CHECK: ptr nocapture noundef writeonly align 4 initializes((0, 32)) %output
49 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;
59 void test_function(int_pair input, global int* output) {
60 // CHECK-NOT: spir_kernel
61 // AMDGCN-NOT: define{{.*}} amdgpu_kernel void @test_function
62 // CHECK: i64 %input.coerce0, i64 %input.coerce1, ptr nocapture noundef writeonly initializes((0, 8)) %output
63 output[0] = (int)input.a;
64 output[1] = (int)input.b;