aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.exp.row.ll
blob: 18923d3ed48811dc53693e142827e0f9f1400766 (plain)
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
166
167
168
169
170
171
172
173
174
175
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GFX11
; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GFX11
; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GFX12
; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GFX12

declare void @llvm.amdgcn.exp.row.i32(i32, i32, i32, i32, i32, i32, i1, i32)
declare void @llvm.amdgcn.exp.row.f32(i32, i32, float, float, float, float, i1, i32)
declare i32 @llvm.amdgcn.workitem.id.x()

define amdgpu_kernel void @undef_i32() #0 {
; GFX11-LABEL: undef_i32:
; GFX11:       ; %bb.0:
; GFX11-NEXT:    s_mov_b32 m0, 0
; GFX11-NEXT:    exp pos0 off, off, off, off row_en
; GFX11-NEXT:    exp pos1 off, off, off, off done row_en
; GFX11-NEXT:    s_endpgm
;
; GFX12-LABEL: undef_i32:
; GFX12:       ; %bb.0:
; GFX12-NEXT:    s_mov_b32 m0, 0
; GFX12-NEXT:    export pos0 off, off, off, off row_en
; GFX12-NEXT:    export pos1 off, off, off, off done row_en
; GFX12-NEXT:    s_endpgm
  call void @llvm.amdgcn.exp.row.i32(i32 12, i32 0, i32 poison, i32 poison, i32 poison, i32 poison, i1 false, i32 0)
  call void @llvm.amdgcn.exp.row.i32(i32 13, i32 0, i32 poison, i32 poison, i32 poison, i32 poison, i1 true, i32 0)
  ret void
}

define amdgpu_kernel void @undef_f32() #0 {
; GFX11-LABEL: undef_f32:
; GFX11:       ; %bb.0:
; GFX11-NEXT:    s_mov_b32 m0, 0
; GFX11-NEXT:    exp pos0 off, off, off, off row_en
; GFX11-NEXT:    exp pos1 off, off, off, off done row_en
; GFX11-NEXT:    s_endpgm
;
; GFX12-LABEL: undef_f32:
; GFX12:       ; %bb.0:
; GFX12-NEXT:    s_mov_b32 m0, 0
; GFX12-NEXT:    export pos0 off, off, off, off row_en
; GFX12-NEXT:    export pos1 off, off, off, off done row_en
; GFX12-NEXT:    s_endpgm
  call void @llvm.amdgcn.exp.row.f32(i32 12, i32 0, float poison, float poison, float poison, float poison, i1 false, i32 0)
  call void @llvm.amdgcn.exp.row.f32(i32 13, i32 0, float poison, float poison, float poison, float poison, i1 true, i32 0)
  ret void
}

define amdgpu_kernel void @zero_i32() #0 {
; GFX11-LABEL: zero_i32:
; GFX11:       ; %bb.0:
; GFX11-NEXT:    v_mov_b32_e32 v0, 0
; GFX11-NEXT:    s_mov_b32 m0, 0
; GFX11-NEXT:    exp pos0 v0, v0, v0, off row_en
; GFX11-NEXT:    exp pos1 v0, v0, v0, off done row_en
; GFX11-NEXT:    s_endpgm
;
; GFX12-LABEL: zero_i32:
; GFX12:       ; %bb.0:
; GFX12-NEXT:    v_mov_b32_e32 v0, 0
; GFX12-NEXT:    s_mov_b32 m0, 0
; GFX12-NEXT:    export pos0 v0, v0, v0, off row_en
; GFX12-NEXT:    export pos1 v0, v0, v0, off done row_en
; GFX12-NEXT:    s_endpgm
  call void @llvm.amdgcn.exp.row.i32(i32 12, i32 7, i32 0, i32 0, i32 0, i32 poison, i1 false, i32 0)
  call void @llvm.amdgcn.exp.row.i32(i32 13, i32 7, i32 0, i32 0, i32 0, i32 poison, i1 true, i32 0)
  ret void
}

define amdgpu_kernel void @one_f32() #0 {
; GFX11-LABEL: one_f32:
; GFX11:       ; %bb.0:
; GFX11-NEXT:    v_mov_b32_e32 v0, 1.0
; GFX11-NEXT:    s_mov_b32 m0, 0
; GFX11-NEXT:    exp pos0 v0, v0, v0, off row_en
; GFX11-NEXT:    exp pos1 v0, v0, v0, off done row_en
; GFX11-NEXT:    s_endpgm
;
; GFX12-LABEL: one_f32:
; GFX12:       ; %bb.0:
; GFX12-NEXT:    v_mov_b32_e32 v0, 1.0
; GFX12-NEXT:    s_mov_b32 m0, 0
; GFX12-NEXT:    export pos0 v0, v0, v0, off row_en
; GFX12-NEXT:    export pos1 v0, v0, v0, off done row_en
; GFX12-NEXT:    s_endpgm
  call void @llvm.amdgcn.exp.row.f32(i32 12, i32 7, float 1.0, float 1.0, float 1.0, float poison, i1 false, i32 0)
  call void @llvm.amdgcn.exp.row.f32(i32 13, i32 7, float 1.0, float 1.0, float 1.0, float poison, i1 true, i32 0)
  ret void
}

define amdgpu_kernel void @id_i32() #0 {
; GFX11-LABEL: id_i32:
; GFX11:       ; %bb.0:
; GFX11-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
; GFX11-NEXT:    s_mov_b32 m0, 0
; GFX11-NEXT:    exp pos0 v0, off, off, off done row_en
; GFX11-NEXT:    s_endpgm
;
; GFX12-LABEL: id_i32:
; GFX12:       ; %bb.0:
; GFX12-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
; GFX12-NEXT:    s_mov_b32 m0, 0
; GFX12-NEXT:    export pos0 v0, off, off, off done row_en
; GFX12-NEXT:    s_endpgm
  %id = call i32 @llvm.amdgcn.workitem.id.x()
  call void @llvm.amdgcn.exp.row.i32(i32 12, i32 1, i32 %id, i32 poison, i32 poison, i32 poison, i1 true, i32 0)
  ret void
}

define amdgpu_kernel void @id_arg_i32(i32 %row) #0 {
; GFX11-LABEL: id_arg_i32:
; GFX11:       ; %bb.0:
; GFX11-NEXT:    s_load_b32 s0, s[4:5], 0x24
; GFX11-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
; GFX11-NEXT:    s_waitcnt lgkmcnt(0)
; GFX11-NEXT:    s_mov_b32 m0, s0
; GFX11-NEXT:    exp pos0 v0, off, off, off done row_en
; GFX11-NEXT:    s_endpgm
;
; GFX12-LABEL: id_arg_i32:
; GFX12:       ; %bb.0:
; GFX12-NEXT:    s_load_b32 s0, s[4:5], 0x24
; GFX12-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
; GFX12-NEXT:    s_wait_kmcnt 0x0
; GFX12-NEXT:    s_mov_b32 m0, s0
; GFX12-NEXT:    export pos0 v0, off, off, off done row_en
; GFX12-NEXT:    s_endpgm
  %id = call i32 @llvm.amdgcn.workitem.id.x()
  call void @llvm.amdgcn.exp.row.i32(i32 12, i32 1, i32 %id, i32 poison, i32 poison, i32 poison, i1 true, i32 %row)
  ret void
}

; Divergent row number just causes a readfirstlane for now.
define amdgpu_kernel void @id_row_i32() #0 {
; GFX11-SDAG-LABEL: id_row_i32:
; GFX11-SDAG:       ; %bb.0:
; GFX11-SDAG-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
; GFX11-SDAG-NEXT:    s_delay_alu instid0(VALU_DEP_1)
; GFX11-SDAG-NEXT:    v_readfirstlane_b32 s0, v0
; GFX11-SDAG-NEXT:    v_mov_b32_e32 v0, 0x63
; GFX11-SDAG-NEXT:    s_mov_b32 m0, s0
; GFX11-SDAG-NEXT:    exp pos0 v0, off, off, off done row_en
; GFX11-SDAG-NEXT:    s_endpgm
;
; GFX11-GISEL-LABEL: id_row_i32:
; GFX11-GISEL:       ; %bb.0:
; GFX11-GISEL-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
; GFX11-GISEL-NEXT:    v_mov_b32_e32 v1, 0x63
; GFX11-GISEL-NEXT:    s_delay_alu instid0(VALU_DEP_2)
; GFX11-GISEL-NEXT:    v_readfirstlane_b32 m0, v0
; GFX11-GISEL-NEXT:    exp pos0 v1, off, off, off done row_en
; GFX11-GISEL-NEXT:    s_endpgm
;
; GFX12-SDAG-LABEL: id_row_i32:
; GFX12-SDAG:       ; %bb.0:
; GFX12-SDAG-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
; GFX12-SDAG-NEXT:    s_delay_alu instid0(VALU_DEP_1)
; GFX12-SDAG-NEXT:    v_readfirstlane_b32 s0, v0
; GFX12-SDAG-NEXT:    v_mov_b32_e32 v0, 0x63
; GFX12-SDAG-NEXT:    s_mov_b32 m0, s0
; GFX12-SDAG-NEXT:    export pos0 v0, off, off, off done row_en
; GFX12-SDAG-NEXT:    s_endpgm
;
; GFX12-GISEL-LABEL: id_row_i32:
; GFX12-GISEL:       ; %bb.0:
; GFX12-GISEL-NEXT:    v_and_b32_e32 v0, 0x3ff, v0
; GFX12-GISEL-NEXT:    v_mov_b32_e32 v1, 0x63
; GFX12-GISEL-NEXT:    s_delay_alu instid0(VALU_DEP_2)
; GFX12-GISEL-NEXT:    v_readfirstlane_b32 m0, v0
; GFX12-GISEL-NEXT:    export pos0 v1, off, off, off done row_en
; GFX12-GISEL-NEXT:    s_endpgm
  %id = call i32 @llvm.amdgcn.workitem.id.x()
  call void @llvm.amdgcn.exp.row.i32(i32 12, i32 1, i32 99, i32 poison, i32 poison, i32 poison, i1 true, i32 %id)
  ret void
}