[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGenOpenCL / builtins-amdgcn-gfx10.cl
bloba4054cba236dd2b38e055148e6f23a8a26fcd40d
1 // REQUIRES: amdgpu-registered-target
2 // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx1010 -emit-llvm -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx1011 -emit-llvm -o - %s | FileCheck %s
4 // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx1012 -emit-llvm -o - %s | FileCheck %s
5 // RUN: %clang_cc1 -triple spirv64-amd-amdhsa -emit-llvm -o - %s | FileCheck %s
7 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
9 typedef unsigned int uint;
10 typedef unsigned long ulong;
12 // CHECK-LABEL: @test_permlane16(
13 // CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.permlane16.i32(i32 %a, i32 %b, i32 %c, i32 %d, i1 false, i1 false)
14 void test_permlane16(global uint* out, uint a, uint b, uint c, uint d) {
15 *out = __builtin_amdgcn_permlane16(a, b, c, d, 0, 0);
18 // CHECK-LABEL: @test_permlanex16(
19 // CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.permlanex16.i32(i32 %a, i32 %b, i32 %c, i32 %d, i1 false, i1 false)
20 void test_permlanex16(global uint* out, uint a, uint b, uint c, uint d) {
21 *out = __builtin_amdgcn_permlanex16(a, b, c, d, 0, 0);
24 // CHECK-LABEL: @test_mov_dpp8_uint(
25 // CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.mov.dpp8.i32(i32 %a, i32 1)
26 // CHECK-NEXT: store i32 %0,
27 void test_mov_dpp8_uint(global uint* out, uint a) {
28 *out = __builtin_amdgcn_mov_dpp8(a, 1);
31 // CHECK-LABEL: @test_mov_dpp8_long(
32 // CHECK: {{.*}}call{{.*}} i64 @llvm.amdgcn.mov.dpp8.i64(i64 %a, i32 1)
33 // CHECK-NEXT: store i64 %0,
34 void test_mov_dpp8_long(global long* out, long a) {
35 *out = __builtin_amdgcn_mov_dpp8(a, 1);
38 // CHECK-LABEL: @test_mov_dpp8_float(
39 // CHECK: %0 = bitcast float %a to i32
40 // CHECK-NEXT: %1 = tail call{{.*}} i32 @llvm.amdgcn.mov.dpp8.i32(i32 %0, i32 1)
41 // CHECK-NEXT: store i32 %1,
42 void test_mov_dpp8_float(global float* out, float a) {
43 *out = __builtin_amdgcn_mov_dpp8(a, 1);
46 // CHECK-LABEL: @test_mov_dpp8_double
47 // CHECK: %0 = bitcast double %x to i64
48 // CHECK-NEXT: %1 = tail call{{.*}} i64 @llvm.amdgcn.mov.dpp8.i64(i64 %0, i32 1)
49 // CHECK-NEXT: store i64 %1,
50 void test_mov_dpp8_double(double x, global double *p) {
51 *p = __builtin_amdgcn_mov_dpp8(x, 1);
54 // CHECK-LABEL: @test_mov_dpp8_short
55 // CHECK: %0 = zext i16 %x to i32
56 // CHECK-NEXT: %1 = tail call{{.*}} i32 @llvm.amdgcn.mov.dpp8.i32(i32 %0, i32 1)
57 // CHECK-NEXT: %2 = trunc i32 %1 to i16
58 // CHECK-NEXT: store i16 %2,
59 void test_mov_dpp8_short(short x, global short *p) {
60 *p = __builtin_amdgcn_mov_dpp8(x, 1);
63 // CHECK-LABEL: @test_mov_dpp8_char
64 // CHECK: %0 = zext i8 %x to i32
65 // CHECK-NEXT: %1 = tail call{{.*}} i32 @llvm.amdgcn.mov.dpp8.i32(i32 %0, i32 1)
66 // CHECK-NEXT: %2 = trunc i32 %1 to i8
67 // CHECK-NEXT: store i8 %2,
68 void test_mov_dpp8_char(char x, global char *p) {
69 *p = __builtin_amdgcn_mov_dpp8(x, 1);
72 // CHECK-LABEL: @test_mov_dpp8_half
73 // CHECK: %0 = load i16,
74 // CHECK: %1 = zext i16 %0 to i32
75 // CHECK-NEXT: %2 = tail call{{.*}} i32 @llvm.amdgcn.mov.dpp8.i32(i32 %1, i32 1)
76 // CHECK-NEXT: %3 = trunc i32 %2 to i16
77 // CHECK-NEXT: store i16 %3,
78 void test_mov_dpp8_half(half *x, global half *p) {
79 *p = __builtin_amdgcn_mov_dpp8(*x, 1);
82 // CHECK-LABEL: @test_s_memtime
83 // CHECK: {{.*}}call{{.*}} i64 @llvm.amdgcn.s.memtime()
84 void test_s_memtime(global ulong* out)
86 *out = __builtin_amdgcn_s_memtime();
89 // CHECK-LABEL: @test_groupstaticsize
90 // CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.groupstaticsize()
91 void test_groupstaticsize(global uint* out)
93 *out = __builtin_amdgcn_groupstaticsize();
96 // CHECK-LABEL: @test_ballot_wave32(
97 // CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.ballot.i32(i1 %{{.+}})
98 void test_ballot_wave32(global uint* out, int a, int b)
100 *out = __builtin_amdgcn_ballot_w32(a == b);