| 1 |
// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-feature +wavefrontsize64 -emit-llvm -o - %s | FileCheck -enable-var-scope %s |
| 2 |
// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu gfx900 -emit-llvm -o - %s | FileCheck -enable-var-scope %s |
| 3 |
// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu gfx900 -target-feature +wavefrontsize64 -emit-llvm -o - %s | FileCheck -enable-var-scope %s |
| 4 |
// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu gfx1010 -target-feature +wavefrontsize64 -emit-llvm -o - %s | FileCheck -enable-var-scope %s |
| 5 |
// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu gfx1100 -target-feature +wavefrontsize64 -emit-llvm -o - %s | FileCheck -enable-var-scope %s |
| 6 |
|
| 7 |
typedef unsigned long ulong; |
| 8 |
|
| 9 |
// CHECK-LABEL: @test_ballot_wave64( |
| 10 |
// CHECK: call i64 @llvm.amdgcn.ballot.i64(i1 %{{.+}}) |
| 11 |
void test_ballot_wave64(global ulong* out, int a, int b) |
| 12 |
{ |
| 13 |
*out = __builtin_amdgcn_ballot_w64(a == b); |
| 14 |
} |
| 15 |
|
| 16 |
// CHECK: declare i64 @llvm.amdgcn.ballot.i64(i1) #[[$NOUNWIND_READONLY:[0-9]+]] |
| 17 |
|
| 18 |
// CHECK-LABEL: @test_ballot_wave64_target_attr( |
| 19 |
// CHECK: call i64 @llvm.amdgcn.ballot.i64(i1 %{{.+}}) |
| 20 |
__attribute__((target("wavefrontsize64"))) |
| 21 |
void test_ballot_wave64_target_attr(global ulong* out, int a, int b) |
| 22 |
{ |
| 23 |
*out = __builtin_amdgcn_ballot_w64(a == b); |
| 24 |
} |
| 25 |
|
| 26 |
// CHECK-LABEL: @test_inverse_ballot_wave64( |
| 27 |
// CHECK: call i1 @llvm.amdgcn.inverse.ballot.i64(i64 %{{.+}}) |
| 28 |
void test_inverse_ballot_wave64(global bool* out, ulong a) |
| 29 |
{ |
| 30 |
*out = __builtin_amdgcn_inverse_ballot_w64(a); |
| 31 |
} |
| 32 |
|
| 33 |
// CHECK-LABEL: @test_read_exec( |
| 34 |
// CHECK: call i64 @llvm.amdgcn.ballot.i64(i1 true) |
| 35 |
void test_read_exec(global ulong* out) { |
| 36 |
*out = __builtin_amdgcn_read_exec(); |
| 37 |
} |
| 38 |
|
| 39 |
// CHECK-LABEL: @test_read_exec_lo( |
| 40 |
// CHECK: call i32 @llvm.amdgcn.ballot.i32(i1 true) |
| 41 |
void test_read_exec_lo(global ulong* out) { |
| 42 |
*out = __builtin_amdgcn_read_exec_lo(); |
| 43 |
} |
| 44 |
|
| 45 |
// CHECK: declare i32 @llvm.amdgcn.ballot.i32(i1) #[[$NOUNWIND_READONLY:[0-9]+]] |
| 46 |
|
| 47 |
// CHECK-LABEL: @test_read_exec_hi( |
| 48 |
// CHECK: call i64 @llvm.amdgcn.ballot.i64(i1 true) |
| 49 |
// CHECK: lshr i64 [[A:%.*]], 32 |
| 50 |
void test_read_exec_hi(global ulong* out) { |
| 51 |
*out = __builtin_amdgcn_read_exec_hi(); |
| 52 |
} |