2018-08-07 15:49:04 +08:00
|
|
|
// REQUIRES: amdgpu-registered-target
|
2019-09-05 11:00:43 +08:00
|
|
|
// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -triple amdgcn-unknown-unknown -target-cpu hawaii -S -emit-llvm -o - %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -triple amdgcn-unknown-unknown -target-cpu fiji -S -emit-llvm -o - %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -triple amdgcn-unknown-unknown -target-cpu gfx906 -S -emit-llvm -o - %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -triple amdgcn-unknown-unknown -target-cpu gfx1010 -S -emit-llvm -o - %s | FileCheck %s
|
2018-08-07 15:49:04 +08:00
|
|
|
|
2019-06-21 05:33:57 +08:00
|
|
|
typedef unsigned int uint;
|
2021-02-25 07:14:30 +08:00
|
|
|
typedef unsigned long ulong;
|
2019-06-21 05:33:57 +08:00
|
|
|
|
2018-08-07 15:49:04 +08:00
|
|
|
// CHECK-LABEL: @test_s_dcache_inv_vol
|
|
|
|
// CHECK: call void @llvm.amdgcn.s.dcache.inv.vol(
|
|
|
|
void test_s_dcache_inv_vol()
|
|
|
|
{
|
|
|
|
__builtin_amdgcn_s_dcache_inv_vol();
|
|
|
|
}
|
|
|
|
|
2018-08-10 06:18:37 +08:00
|
|
|
// CHECK-LABEL: @test_buffer_wbinvl1_vol
|
|
|
|
// CHECK: call void @llvm.amdgcn.buffer.wbinvl1.vol()
|
|
|
|
void test_buffer_wbinvl1_vol()
|
|
|
|
{
|
|
|
|
__builtin_amdgcn_buffer_wbinvl1_vol();
|
|
|
|
}
|
|
|
|
|
2019-06-21 05:33:57 +08:00
|
|
|
// CHECK-LABEL: @test_gws_sema_release_all(
|
2019-09-05 11:00:43 +08:00
|
|
|
// CHECK: call void @llvm.amdgcn.ds.gws.sema.release.all(i32 %{{[0-9]+}})
|
2019-06-21 05:33:57 +08:00
|
|
|
void test_gws_sema_release_all(uint id)
|
|
|
|
{
|
|
|
|
__builtin_amdgcn_ds_gws_sema_release_all(id);
|
|
|
|
}
|
2019-09-05 11:00:43 +08:00
|
|
|
|
2021-02-25 07:14:30 +08:00
|
|
|
// CHECK-LABEL: @test_s_memtime
|
|
|
|
// CHECK: call i64 @llvm.amdgcn.s.memtime()
|
|
|
|
void test_s_memtime(global ulong* out)
|
|
|
|
{
|
|
|
|
*out = __builtin_amdgcn_s_memtime();
|
|
|
|
}
|
|
|
|
|
2019-09-05 11:00:43 +08:00
|
|
|
// CHECK-LABEL: @test_is_shared(
|
|
|
|
// CHECK: [[CAST:%[0-9]+]] = bitcast i32* %{{[0-9]+}} to i8*
|
|
|
|
// CHECK: call i1 @llvm.amdgcn.is.shared(i8* [[CAST]]
|
|
|
|
int test_is_shared(const int* ptr) {
|
|
|
|
return __builtin_amdgcn_is_shared(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_is_private(
|
|
|
|
// CHECK: [[CAST:%[0-9]+]] = bitcast i32* %{{[0-9]+}} to i8*
|
|
|
|
// CHECK: call i1 @llvm.amdgcn.is.private(i8* [[CAST]]
|
|
|
|
int test_is_private(const int* ptr) {
|
|
|
|
return __builtin_amdgcn_is_private(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_is_shared_global(
|
|
|
|
// CHECK: [[CAST:%[0-9]+]] = addrspacecast i32 addrspace(1)* %{{[0-9]+}} to i8*
|
|
|
|
// CHECK: call i1 @llvm.amdgcn.is.shared(i8* [[CAST]]
|
|
|
|
int test_is_shared_global(const global int* ptr) {
|
|
|
|
return __builtin_amdgcn_is_shared(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test_is_private_global(
|
|
|
|
// CHECK: [[CAST:%[0-9]+]] = addrspacecast i32 addrspace(1)* %{{[0-9]+}} to i8*
|
|
|
|
// CHECK: call i1 @llvm.amdgcn.is.private(i8* [[CAST]]
|
|
|
|
int test_is_private_global(const global int* ptr) {
|
|
|
|
return __builtin_amdgcn_is_private(ptr);
|
|
|
|
}
|
2021-05-13 03:53:47 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: @test_groupstaticsize
|
|
|
|
// CHECK: call i32 @llvm.amdgcn.groupstaticsize()
|
|
|
|
void test_groupstaticsize(global uint* out) {
|
|
|
|
*out = __builtin_amdgcn_groupstaticsize();
|
|
|
|
}
|