1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=+wavefrontsize32,-wavefrontsize64 < %s | FileCheck %s
4 declare i32 @llvm.amdgcn.ballot.i32(i1)
8 define amdgpu_cs i32 @constant_false() {
9 ; CHECK-LABEL: constant_false:
11 ; CHECK-NEXT: s_mov_b32 s0, 0
12 ; CHECK-NEXT: ; return to shader part epilog
13 %ballot = call i32 @llvm.amdgcn.ballot.i32(i1 0)
19 define amdgpu_cs i32 @constant_true() {
20 ; CHECK-LABEL: constant_true:
22 ; CHECK-NEXT: s_mov_b32 s0, exec_lo
23 ; CHECK-NEXT: ; return to shader part epilog
24 %ballot = call i32 @llvm.amdgcn.ballot.i32(i1 1)
28 ; Test ballot of a non-comparison operation
30 define amdgpu_cs i32 @non_compare(i32 %x) {
31 ; CHECK-LABEL: non_compare:
33 ; CHECK-NEXT: v_and_b32_e32 v0, 1, v0
34 ; CHECK-NEXT: v_cmp_ne_u32_e64 s0, 0, v0
35 ; CHECK-NEXT: ; return to shader part epilog
36 %trunc = trunc i32 %x to i1
37 %ballot = call i32 @llvm.amdgcn.ballot.i32(i1 %trunc)
41 ; Test ballot of comparisons
43 define amdgpu_cs i32 @compare_ints(i32 %x, i32 %y) {
44 ; CHECK-LABEL: compare_ints:
46 ; CHECK-NEXT: v_cmp_eq_u32_e64 s0, v0, v1
47 ; CHECK-NEXT: ; return to shader part epilog
48 %cmp = icmp eq i32 %x, %y
49 %ballot = call i32 @llvm.amdgcn.ballot.i32(i1 %cmp)
53 define amdgpu_cs i32 @compare_int_with_constant(i32 %x) {
54 ; CHECK-LABEL: compare_int_with_constant:
56 ; CHECK-NEXT: v_cmp_lt_i32_e64 s0, 0x62, v0
57 ; CHECK-NEXT: ; return to shader part epilog
58 %cmp = icmp sge i32 %x, 99
59 %ballot = call i32 @llvm.amdgcn.ballot.i32(i1 %cmp)
63 define amdgpu_cs i32 @compare_floats(float %x, float %y) {
64 ; CHECK-LABEL: compare_floats:
66 ; CHECK-NEXT: v_cmp_gt_f32_e64 s0, v0, v1
67 ; CHECK-NEXT: ; return to shader part epilog
68 %cmp = fcmp ogt float %x, %y
69 %ballot = call i32 @llvm.amdgcn.ballot.i32(i1 %cmp)