1 # NOTE: This file is Generic MIR translation of test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll test file
2 # RUN: llc -mtriple=amdgcn-- -run-pass=print-machine-uniformity -o - %s 2>&1 | FileCheck %s
7 ; CHECK-LABEL: MachineUniformityInfo for function: readfirstlane
8 ; CHECK: DIVERGENT: %{{[0-9]+}}
9 ; CHECK-SAME:llvm.amdgcn.workitem.id.x
10 ; CHECK-NOT: DIVERGENT: {{.*}}llvm.amdgcn.readfirstlane
11 %6:_(p1) = G_IMPLICIT_DEF
12 %4:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.x)
13 %5:_(s32) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.readfirstlane), %4(s32)
14 G_STORE %5(s32), %6(p1) :: (store (s32) into `ptr addrspace(1) undef`, addrspace 1)
22 ; CHECK-LABEL: MachineUniformityInfo for function: icmp
23 ; CHECK-NEXT: ALL VALUES UNIFORM
25 %3:_(p4) = COPY $sgpr4_sgpr5
26 %13:_(s32) = G_CONSTANT i32 0
27 %7:_(p4) = G_INTRINSIC intrinsic(@llvm.amdgcn.kernarg.segment.ptr)
28 %8:_(s32) = G_LOAD %7(p4) :: (dereferenceable invariant load (s32), align 16, addrspace 4)
29 %9:_(s64) = G_CONSTANT i64 8
30 %10:_(p4) = G_PTR_ADD %7, %9(s64)
31 %11:_(p1) = G_LOAD %10(p4) :: (dereferenceable invariant load (p1), addrspace 4)
32 %12:_(s64) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.icmp), %8(s32), %13(s32), 33
33 G_STORE %12(s64), %11(p1) :: (volatile store (s64) , addrspace 1)
42 ; CHECK-LABEL: MachineUniformityInfo for function: fcmp
43 ; CHECK-NEXT: ALL VALUES UNIFORM
45 %3:_(p4) = COPY $sgpr4_sgpr5
46 %10:_(s32) = G_CONSTANT i32 0
47 %12:_(s32) = G_CONSTANT i32 1
48 %16:_(p1) = G_IMPLICIT_DEF
49 %7:_(p4) = G_INTRINSIC intrinsic(@llvm.amdgcn.kernarg.segment.ptr)
50 %8:_(<2 x s32>) = G_LOAD %7(p4) :: (dereferenceable invariant load (<2 x s32>) , align 16, addrspace 4)
51 %9:_(s32) = G_EXTRACT_VECTOR_ELT %8(<2 x s32>), %10(s32)
52 %11:_(s32) = G_EXTRACT_VECTOR_ELT %8(<2 x s32>), %12(s32)
53 %13:_(s64) = G_CONSTANT i64 4
54 %14:_(p4) = G_PTR_ADD %7, %13(s64)
55 %15:_(s64) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.fcmp), %9(s32), %11(s32), 33
56 G_STORE %15(s64), %16(p1) :: (volatile store (s64) into `ptr addrspace(1) undef`, addrspace 1)
65 ; CHECK-LABEL: MachineUniformityInfo for function: ballot
66 ; CHECK-NEXT: ALL VALUES UNIFORM
68 %2:_(p4) = COPY $sgpr4_sgpr5
69 %10:_(p1) = G_IMPLICIT_DEF
70 %6:_(p4) = G_INTRINSIC intrinsic(@llvm.amdgcn.kernarg.segment.ptr)
71 %7:_(s32) = G_LOAD %6(p4) :: (dereferenceable invariant load (s32), align 16, addrspace 4)
72 %8:_(s1) = G_TRUNC %7(s32)
73 %9:_(s64) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.ballot), %8(s1)
74 G_STORE %9(s64), %10(p1) :: (volatile store (s64) into `ptr addrspace(1) undef`, addrspace 1)
81 - { id: 0, class: _, preferred-register: '' }
82 - { id: 1, class: sreg_32, preferred-register: '' }
83 - { id: 2, class: vgpr_32, preferred-register: '' }
84 - { id: 3, class: _, preferred-register: '' }
88 ; CHECK-LABEL: MachineUniformityInfo for function: asm_sgpr
89 ; CHECK-NOT: DIVERGENT: %1
91 %0:_(s32) = COPY $vgpr0
92 %2:vgpr_32 = COPY %0(s32)
93 INLINEASM &"; def $0, $1", 0 /* attdialect */, 1966090 /* regdef:SReg_32 */, def %1, 1835017 /* reguse:VGPR_32 */, %2
96 SI_RETURN implicit $vgpr0
101 name: asm_mixed_sgpr_vgpr
103 - { id: 0, class: _, preferred-register: '' }
104 - { id: 1, class: sreg_32, preferred-register: '' }
105 - { id: 2, class: vgpr_32, preferred-register: '' }
106 - { id: 3, class: vgpr_32, preferred-register: '' }
107 - { id: 4, class: _, preferred-register: '' }
108 - { id: 5, class: _, preferred-register: '' }
109 - { id: 6, class: _, preferred-register: '' }
115 ; CHECK-LABEL: MachineUniformityInfo for function: asm_mixed_sgpr_vgpr
116 ; CHECK: DIVERGENT: %0:
117 ; CHECK: DIVERGENT: %3:
118 ; CHECK-NOT: DIVERGENT: %1:
119 ; CHECK: DIVERGENT: %2:
120 ; CHECK-NOT: DIVERGENT: %4:
121 ; CHECK: DIVERGENT: %5:
122 %0:_(s32) = COPY $vgpr0
123 %6:_(p1) = G_IMPLICIT_DEF
124 %3:vgpr_32 = COPY %0(s32)
125 INLINEASM &"; def $0, $1, $2", 0 /* attdialect */, 1966090 /* regdef:SReg_32 */, def %1, 1835018 /* regdef:VGPR_32 */, def %2, 1835017 /* reguse:VGPR_32 */, %3
128 G_STORE %5(s32), %6(p1) :: (store (s32) into `ptr addrspace(1) undef`, addrspace 1)