| 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 |
| 6 |
|
| 7 |
typedef unsigned int uint; |
| 8 |
typedef unsigned long ulong; |
| 9 |
|
| 10 |
// CHECK-LABEL: @test_permlane16( |
| 11 |
// CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.permlane16.i32(i32 %a, i32 %b, i32 %c, i32 %d, i1 false, i1 false) |
| 12 |
void test_permlane16(global uint* out, uint a, uint b, uint c, uint d) { |
| 13 |
*out = __builtin_amdgcn_permlane16(a, b, c, d, 0, 0); |
| 14 |
} |
| 15 |
|
| 16 |
// CHECK-LABEL: @test_permlanex16( |
| 17 |
// CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.permlanex16.i32(i32 %a, i32 %b, i32 %c, i32 %d, i1 false, i1 false) |
| 18 |
void test_permlanex16(global uint* out, uint a, uint b, uint c, uint d) { |
| 19 |
*out = __builtin_amdgcn_permlanex16(a, b, c, d, 0, 0); |
| 20 |
} |
| 21 |
|
| 22 |
// CHECK-LABEL: @test_mov_dpp8( |
| 23 |
// CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.mov.dpp8.i32(i32 %a, i32 1) |
| 24 |
void test_mov_dpp8(global uint* out, uint a) { |
| 25 |
*out = __builtin_amdgcn_mov_dpp8(a, 1); |
| 26 |
} |
| 27 |
|
| 28 |
// CHECK-LABEL: @test_s_memtime |
| 29 |
// CHECK: {{.*}}call{{.*}} i64 @llvm.amdgcn.s.memtime() |
| 30 |
void test_s_memtime(global ulong* out) |
| 31 |
{ |
| 32 |
*out = __builtin_amdgcn_s_memtime(); |
| 33 |
} |
| 34 |
|
| 35 |
// CHECK-LABEL: @test_groupstaticsize |
| 36 |
// CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.groupstaticsize() |
| 37 |
void test_groupstaticsize(global uint* out) |
| 38 |
{ |
| 39 |
*out = __builtin_amdgcn_groupstaticsize(); |
| 40 |
} |
| 41 |
|
| 42 |
// CHECK-LABEL: @test_ballot_wave32( |
| 43 |
// CHECK: {{.*}}call{{.*}} i32 @llvm.amdgcn.ballot.i32(i1 %{{.+}}) |
| 44 |
void test_ballot_wave32(global uint* out, int a, int b) |
| 45 |
{ |
| 46 |
*out = __builtin_amdgcn_ballot_w32(a == b); |
| 47 |
} |