File: never-uniform.mir

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (165 lines) | stat: -rw-r--r-- 4,850 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# RUN: llc -mtriple=amdgcn-- -mcpu=gfx900 -run-pass=print-machine-uniformity -o - %s 2>&1 | FileCheck %s
# loads from flat non uniform
---
name:            flatloads
tracksRegLiveness: true
machineFunctionInfo:
  isEntryFunction: true

body:             |
  bb.0:
    ; CHECK-LABEL: MachineUniformityInfo for function: flatloads
    ; CHECK: DIVERGENT: %1
    ; CHECK-NOT: DIVERGENT: %2
    %0:vreg_64 = IMPLICIT_DEF
    %1:vgpr_32(s32) = FLAT_LOAD_DWORD %0, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32))
    %2:vgpr_32(s32) = FLAT_LOAD_DWORD %0, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32), addrspace 1)
    %3:sreg_32 = V_READFIRSTLANE_B32 %1(s32), implicit $exec
    S_ENDPGM 0
...

# loads from scratch non uniform
---
name:            scratchloads
tracksRegLiveness: true
machineFunctionInfo:
  isEntryFunction: true

body:             |
  bb.0:
    ; CHECK-LABEL: MachineUniformityInfo for function: scratchloads
    ; CHECK: DIVERGENT: %1
    %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
    %1:vgpr_32 = SCRATCH_LOAD_DWORD %0, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32), addrspace 5)
    S_ENDPGM 0
...

# Global load
---
name:            globalloads
tracksRegLiveness: true
machineFunctionInfo:
  isEntryFunction: true

body:             |
  bb.0:
    ; CHECK-LABEL: MachineUniformityInfo for function: globalloads
    ; CHECK: DIVERGENT: %2
    ; CHECK-NOT: DIVERGENT: %3
    %0:vreg_64 = IMPLICIT_DEF
    %1:vreg_64 = IMPLICIT_DEF
    %2:vgpr_32(s32) = GLOBAL_LOAD_DWORD %0, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32))
    %3:vreg_64 = GLOBAL_LOAD_DWORDX2 %1, 0, 0, implicit $exec :: (load (s64), addrspace 1)
    %4:sreg_32 = V_READFIRSTLANE_B32 %2(s32), implicit $exec
    S_ENDPGM 0
...

# FIXME:: ADDTID might instruction incorrectly marked uniform
---
name:            dsreads
tracksRegLiveness: true
machineFunctionInfo:
  isEntryFunction: true

body:             |
  bb.0:
    ; CHECK-LABEL: MachineUniformityInfo for function: dsreads
    ; CHECK-NEXT: ALL VALUES UNIFORM
    %0:vreg_64 = IMPLICIT_DEF
    $m0 = S_MOV_B32 0
    %1:vgpr_32 = DS_READ_ADDTID_B32 0, 0, implicit $m0, implicit $exec
    S_ENDPGM 0
...

# copy source == $sgpr => uniform, $vgpr => divergent
---
name:            sgprcopy
tracksRegLiveness: true
machineFunctionInfo:
  isEntryFunction: true
body:             |
  bb.0:
    ; CHECK-LABEL: MachineUniformityInfo for function: sgprcopy
    ; CHECK: DIVERGENT: %2
    liveins: $sgpr0,$sgpr1,$vgpr0
    %0:sgpr_32 = COPY $sgpr0
    %1:vgpr_32 = COPY $sgpr1
    %2:vgpr_32 = COPY $vgpr0
    S_ENDPGM 0
...

# writelane is not uniform
---
name:            writelane
machineFunctionInfo:
  isEntryFunction: true
body:             |
  bb.0:
    ; CHECK-LABEL: MachineUniformityInfo for function: writelane
    ; CHECK: DIVERGENT: %4

    ; Note how %5 is the result of a vector compare, but it is reported as
    ; uniform because it is stored in an sreg.
    ; CHECK-NOT: DIVERGENT: %5

    %0:vgpr_32 = IMPLICIT_DEF
    %1:vgpr_32 = IMPLICIT_DEF
    %2:sgpr_32 = V_READFIRSTLANE_B32 %0, implicit $exec
    %3:sgpr_32 = V_READLANE_B32 %1, 0, implicit $exec
    $sgpr0 = V_READFIRSTLANE_B32 $vgpr0, implicit $exec
    $sgpr1 = V_READLANE_B32 $vgpr1, $sgpr0, implicit $exec

    %4:vgpr_32 = V_WRITELANE_B32 0, 0, %0, implicit $exec
    %5:sreg_64 = V_CMP_EQ_U32_e64 %0, %4, implicit $exec
    S_CBRANCH_VCCZ %bb.1, implicit $vcc

  bb.1:
    %16:vgpr_32 = IMPLICIT_DEF
    S_ENDPGM 0
...
# Directly reading physical vgpr not uniform
---
name:            physicalreg
tracksRegLiveness: true
body:             |
  bb.0:
    ; CHECK-LABEL: MachineUniformityInfo for function: physicalreg
    ; CHECK: DIVERGENT: %0
    ; CHECK: DIVERGENT: %1
    ; CHECK: DIVERGENT: %2
    ; CHECK: DIVERGENT: %3
    ; CHECK: DIVERGENT: %4
    ; CHECK-NOT: DIVERGENT
    ; CHECK: DIVERGENT: %5
    liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5
    %0:vgpr_32 = COPY $vgpr0
    %1:vgpr_32 = COPY $vgpr1
    %2:vgpr_32 = V_AND_B32_e32 %1, $vgpr3, implicit $exec
    %3:vgpr_32 = V_ADD_U32_e32 $vgpr2, $vgpr3, implicit $exec
    %4:vgpr_32 = V_SUB_CO_U32_e32 $vgpr2, $vgpr3, implicit $exec, implicit-def $vcc
    %5:vgpr_32 = V_AND_B32_e32 $vgpr4, $vgpr5, implicit $exec
    S_ENDPGM 0
...
# mbcnt instructions are not uniform
---
name:            mbcnt_lo
machineFunctionInfo:
  isEntryFunction: true
body:             |
  bb.0:
    ; CHECK-LABEL: MachineUniformityInfo for function: mbcnt_lo
    ; CHECK: DIVERGENT: %0
    %0:vgpr_32 = V_MBCNT_LO_U32_B32_e64 -1, 0, implicit $exec
    S_ENDPGM 0
...
---
name:            mbcnt_hi
machineFunctionInfo:
  isEntryFunction: true
body:             |
  bb.0:
    ; CHECK-LABEL: MachineUniformityInfo for function: mbcnt_hi
    ; CHECK: DIVERGENT: %0
    %0:vgpr_32 = V_MBCNT_HI_U32_B32_e64 -1, 0, implicit $exec
    S_ENDPGM 0
...