File: isspacep.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (277 lines) | stat: -rw-r--r-- 14,755 bytes parent folder | download | duplicates (2)
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -passes=instcombine -mtriple=nvptx64-nvidia-cuda -S | FileCheck %s
target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
target triple = "nvptx64-nvidia-cuda"

; Source data in different AS.
@shared_data = dso_local addrspace(3) global i32 undef, align 4
@global_data = dso_local addrspace(1) externally_initialized global i32 0, align 4
@const_data = dso_local addrspace(4) externally_initialized constant i32 3, align 4

; Results get stored here.
@gen = dso_local addrspace(1) externally_initialized global i8 0, align 1
@g1 = dso_local addrspace(1) externally_initialized global i8 0, align 1
@g2 = dso_local addrspace(1) externally_initialized global i8 0, align 1
@s1 = dso_local addrspace(1) externally_initialized global i8 0, align 1
@s2 = dso_local addrspace(1) externally_initialized global i8 0, align 1
@c1 = dso_local addrspace(1) externally_initialized global i8 0, align 1
@c2 = dso_local addrspace(1) externally_initialized global i8 0, align 1
@l = dso_local addrspace(1) externally_initialized global i8 0, align 1

declare i1 @llvm.nvvm.isspacep.global(ptr nocapture)
declare i1 @llvm.nvvm.isspacep.shared(ptr nocapture)
declare i1 @llvm.nvvm.isspacep.const(ptr nocapture)
declare i1 @llvm.nvvm.isspacep.local(ptr nocapture)

define dso_local void @check_global(ptr nocapture noundef readnone %out, ptr nocapture noundef readnone %genp,
; CHECK-LABEL: define dso_local void @check_global(
; CHECK-SAME: ptr nocapture noundef readnone [[OUT:%.*]], ptr nocapture noundef readnone [[GENP:%.*]], ptr addrspace(1) [[GP:%.*]], ptr addrspace(3) [[SP:%.*]], ptr addrspace(4) [[CP:%.*]], ptr addrspace(5) [[LP:%.*]]) local_unnamed_addr {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    [[GEN0:%.*]] = tail call i1 @llvm.nvvm.isspacep.global(ptr [[GENP]])
; CHECK-NEXT:    [[STOREDV:%.*]] = zext i1 [[GEN0]] to i8
; CHECK-NEXT:    store i8 [[STOREDV]], ptr addrspacecast (ptr addrspace(1) @gen to ptr), align 1
; CHECK-NEXT:    store i8 1, ptr addrspacecast (ptr addrspace(1) @g1 to ptr), align 1
; CHECK-NEXT:    store i8 1, ptr addrspacecast (ptr addrspace(1) @g2 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @s1 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @s2 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @c1 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @c2 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @l to ptr), align 1
; CHECK-NEXT:    ret void
;
  ptr addrspace(1) %gp,
  ptr addrspace(3) %sp,
  ptr addrspace(4) %cp,
  ptr addrspace(5) %lp) local_unnamed_addr {
entry:
  ; No constant folding for generic pointers of unknown origin.
  %gen0 = tail call i1 @llvm.nvvm.isspacep.global(ptr %genp)
  %storedv = zext i1 %gen0 to i8
  store i8 %storedv, ptr addrspacecast (ptr addrspace(1) @gen to ptr), align 1

  %isg1 = tail call i1 @llvm.nvvm.isspacep.global(ptr addrspacecast (ptr addrspace(1) @global_data to ptr))
  %isg18 = zext i1 %isg1 to i8
  store i8 %isg18, ptr addrspacecast (ptr addrspace(1) @g1 to ptr), align 1

  %gp_asc = addrspacecast ptr addrspace(1) %gp to ptr
  %isg2 = tail call i1 @llvm.nvvm.isspacep.global(ptr %gp_asc)
  %isg28 = zext i1 %isg2 to i8
  store i8 %isg28, ptr addrspacecast (ptr addrspace(1) @g2 to ptr), align 1

  %iss1 = tail call i1 @llvm.nvvm.isspacep.global(ptr addrspacecast (ptr addrspace(3) @shared_data to ptr))
  %iss18 = zext i1 %iss1 to i8
  store i8 %iss18, ptr addrspacecast (ptr addrspace(1) @s1 to ptr), align 1

  %sp_asc = addrspacecast ptr addrspace(3) %sp to ptr
  %iss2 = tail call i1 @llvm.nvvm.isspacep.global(ptr %sp_asc)
  %iss28 = zext i1 %iss2 to i8
  store i8 %iss28, ptr addrspacecast (ptr addrspace(1) @s2 to ptr), align 1

  %isc1 = tail call i1 @llvm.nvvm.isspacep.global(ptr addrspacecast (ptr addrspace(4) @const_data to ptr))
  %isc18 = zext i1 %isc1 to i8
  store i8 %isc18, ptr addrspacecast (ptr addrspace(1) @c1 to ptr), align 1

  %cp_asc = addrspacecast ptr addrspace(4) %cp to ptr
  %isc2 = tail call i1 @llvm.nvvm.isspacep.global(ptr %cp_asc)
  %isc28 = zext i1 %isc2 to i8
  store i8 %isc28, ptr addrspacecast (ptr addrspace(1) @c2 to ptr), align 1

  ; Local data can't ihave a constant address, so we can't have a constant ASC expression
  ; We can only use an ASC instruction.
  %lp_asc = addrspacecast ptr addrspace(5) %lp to ptr
  %isl = call i1 @llvm.nvvm.isspacep.global(ptr nonnull %lp_asc)
  %isl8 = zext i1 %isl to i8
  store i8 %isl8, ptr addrspacecast (ptr addrspace(1) @l to ptr), align 1

  ret void
}

define dso_local void @check_shared(ptr nocapture noundef readnone %out, ptr nocapture noundef readnone %genp,
; CHECK-LABEL: define dso_local void @check_shared(
; CHECK-SAME: ptr nocapture noundef readnone [[OUT:%.*]], ptr nocapture noundef readnone [[GENP:%.*]], ptr addrspace(1) [[GP:%.*]], ptr addrspace(3) [[SP:%.*]], ptr addrspace(4) [[CP:%.*]], ptr addrspace(5) [[LP:%.*]]) local_unnamed_addr {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    [[GEN0:%.*]] = tail call i1 @llvm.nvvm.isspacep.shared(ptr [[GENP]])
; CHECK-NEXT:    [[STOREDV:%.*]] = zext i1 [[GEN0]] to i8
; CHECK-NEXT:    store i8 [[STOREDV]], ptr addrspacecast (ptr addrspace(1) @gen to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @g1 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @g2 to ptr), align 1
; CHECK-NEXT:    store i8 1, ptr addrspacecast (ptr addrspace(1) @s1 to ptr), align 1
; CHECK-NEXT:    store i8 1, ptr addrspacecast (ptr addrspace(1) @s2 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @c1 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @c2 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @l to ptr), align 1
; CHECK-NEXT:    ret void
;
  ptr addrspace(1) %gp,
  ptr addrspace(3) %sp,
  ptr addrspace(4) %cp,
  ptr addrspace(5) %lp) local_unnamed_addr {
entry:
  ; No constant folding for generic pointers of unknown origin.
  %gen0 = tail call i1 @llvm.nvvm.isspacep.shared(ptr %genp)
  %storedv = zext i1 %gen0 to i8
  store i8 %storedv, ptr addrspacecast (ptr addrspace(1) @gen to ptr), align 1

  %isg1 = tail call i1 @llvm.nvvm.isspacep.shared(ptr addrspacecast (ptr addrspace(1) @global_data to ptr))
  %isg18 = zext i1 %isg1 to i8
  store i8 %isg18, ptr addrspacecast (ptr addrspace(1) @g1 to ptr), align 1

  %gp_asc = addrspacecast ptr addrspace(1) %gp to ptr
  %isg2 = tail call i1 @llvm.nvvm.isspacep.shared(ptr %gp_asc)
  %isg28 = zext i1 %isg2 to i8
  store i8 %isg28, ptr addrspacecast (ptr addrspace(1) @g2 to ptr), align 1

  %iss1 = tail call i1 @llvm.nvvm.isspacep.shared(ptr addrspacecast (ptr addrspace(3) @shared_data to ptr))
  %iss18 = zext i1 %iss1 to i8
  store i8 %iss18, ptr addrspacecast (ptr addrspace(1) @s1 to ptr), align 1

  %sp_asc = addrspacecast ptr addrspace(3) %sp to ptr
  %iss2 = tail call i1 @llvm.nvvm.isspacep.shared(ptr %sp_asc)
  %iss28 = zext i1 %iss2 to i8
  store i8 %iss28, ptr addrspacecast (ptr addrspace(1) @s2 to ptr), align 1

  %isc1 = tail call i1 @llvm.nvvm.isspacep.shared(ptr addrspacecast (ptr addrspace(4) @const_data to ptr))
  %isc18 = zext i1 %isc1 to i8
  store i8 %isc18, ptr addrspacecast (ptr addrspace(1) @c1 to ptr), align 1

  %cp_asc = addrspacecast ptr addrspace(4) %cp to ptr
  %isc2 = tail call i1 @llvm.nvvm.isspacep.shared(ptr %cp_asc)
  %isc28 = zext i1 %isc2 to i8
  store i8 %isc28, ptr addrspacecast (ptr addrspace(1) @c2 to ptr), align 1

  ; Local data can't have a constant address, so we can't have a constant ASC expression
  ; We can only use an ASC instruction.
  %lp_asc = addrspacecast ptr addrspace(5) %lp to ptr
  %isl = call i1 @llvm.nvvm.isspacep.shared(ptr nonnull %lp_asc)
  %isl8 = zext i1 %isl to i8
  store i8 %isl8, ptr addrspacecast (ptr addrspace(1) @l to ptr), align 1

  ret void
}

define dso_local void @check_const(ptr nocapture noundef readnone %out, ptr nocapture noundef readnone %genp,
; CHECK-LABEL: define dso_local void @check_const(
; CHECK-SAME: ptr nocapture noundef readnone [[OUT:%.*]], ptr nocapture noundef readnone [[GENP:%.*]], ptr addrspace(1) [[GP:%.*]], ptr addrspace(3) [[SP:%.*]], ptr addrspace(4) [[CP:%.*]], ptr addrspace(5) [[LP:%.*]]) local_unnamed_addr {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    [[GEN0:%.*]] = tail call i1 @llvm.nvvm.isspacep.const(ptr [[GENP]])
; CHECK-NEXT:    [[STOREDV:%.*]] = zext i1 [[GEN0]] to i8
; CHECK-NEXT:    store i8 [[STOREDV]], ptr addrspacecast (ptr addrspace(1) @gen to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @g1 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @g2 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @s1 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @s2 to ptr), align 1
; CHECK-NEXT:    store i8 1, ptr addrspacecast (ptr addrspace(1) @c1 to ptr), align 1
; CHECK-NEXT:    store i8 1, ptr addrspacecast (ptr addrspace(1) @c2 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @l to ptr), align 1
; CHECK-NEXT:    ret void
;
  ptr addrspace(1) %gp,
  ptr addrspace(3) %sp,
  ptr addrspace(4) %cp,
  ptr addrspace(5) %lp) local_unnamed_addr {
entry:
  ; No constant folding for generic pointers of unknown origin.
  %gen0 = tail call i1 @llvm.nvvm.isspacep.const(ptr %genp)
  %storedv = zext i1 %gen0 to i8
  store i8 %storedv, ptr addrspacecast (ptr addrspace(1) @gen to ptr), align 1

  %isg1 = tail call i1 @llvm.nvvm.isspacep.const(ptr addrspacecast (ptr addrspace(1) @global_data to ptr))
  %isg18 = zext i1 %isg1 to i8
  store i8 %isg18, ptr addrspacecast (ptr addrspace(1) @g1 to ptr), align 1

  %gp_asc = addrspacecast ptr addrspace(1) %gp to ptr
  %isg2 = tail call i1 @llvm.nvvm.isspacep.const(ptr %gp_asc)
  %isg28 = zext i1 %isg2 to i8
  store i8 %isg28, ptr addrspacecast (ptr addrspace(1) @g2 to ptr), align 1

  %iss1 = tail call i1 @llvm.nvvm.isspacep.const(ptr addrspacecast (ptr addrspace(3) @shared_data to ptr))
  %iss18 = zext i1 %iss1 to i8
  store i8 %iss18, ptr addrspacecast (ptr addrspace(1) @s1 to ptr), align 1

  %sp_asc = addrspacecast ptr addrspace(3) %sp to ptr
  %iss2 = tail call i1 @llvm.nvvm.isspacep.const(ptr %sp_asc)
  %iss28 = zext i1 %iss2 to i8
  store i8 %iss28, ptr addrspacecast (ptr addrspace(1) @s2 to ptr), align 1

  %isc1 = tail call i1 @llvm.nvvm.isspacep.const(ptr addrspacecast (ptr addrspace(4) @const_data to ptr))
  %isc18 = zext i1 %isc1 to i8
  store i8 %isc18, ptr addrspacecast (ptr addrspace(1) @c1 to ptr), align 1

  %cp_asc = addrspacecast ptr addrspace(4) %cp to ptr
  %isc2 = tail call i1 @llvm.nvvm.isspacep.const(ptr %cp_asc)
  %isc28 = zext i1 %isc2 to i8
  store i8 %isc28, ptr addrspacecast (ptr addrspace(1) @c2 to ptr), align 1

  ; Local data can't have a constant address, so we can't have a constant ASC expression
  ; We can only use an ASC instruction.
  %lp_asc = addrspacecast ptr addrspace(5) %lp to ptr
  %isl = call i1 @llvm.nvvm.isspacep.const(ptr nonnull %lp_asc)
  %isl8 = zext i1 %isl to i8
  store i8 %isl8, ptr addrspacecast (ptr addrspace(1) @l to ptr), align 1

  ret void
}

define dso_local void @check_local(ptr nocapture noundef readnone %out, ptr nocapture noundef readnone %genp,
; CHECK-LABEL: define dso_local void @check_local(
; CHECK-SAME: ptr nocapture noundef readnone [[OUT:%.*]], ptr nocapture noundef readnone [[GENP:%.*]], ptr addrspace(1) [[GP:%.*]], ptr addrspace(3) [[SP:%.*]], ptr addrspace(4) [[CP:%.*]], ptr addrspace(5) [[LP:%.*]]) local_unnamed_addr {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    [[GEN0:%.*]] = tail call i1 @llvm.nvvm.isspacep.local(ptr [[GENP]])
; CHECK-NEXT:    [[STOREDV:%.*]] = zext i1 [[GEN0]] to i8
; CHECK-NEXT:    store i8 [[STOREDV]], ptr addrspacecast (ptr addrspace(1) @gen to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @g1 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @g2 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @s1 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @s2 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @c1 to ptr), align 1
; CHECK-NEXT:    store i8 0, ptr addrspacecast (ptr addrspace(1) @c2 to ptr), align 1
; CHECK-NEXT:    store i8 1, ptr addrspacecast (ptr addrspace(1) @l to ptr), align 1
; CHECK-NEXT:    ret void
;
  ptr addrspace(1) %gp,
  ptr addrspace(3) %sp,
  ptr addrspace(4) %cp,
  ptr addrspace(5) %lp) local_unnamed_addr {
entry:
  ; No constant folding for generic pointers of unknown origin.
  %gen0 = tail call i1 @llvm.nvvm.isspacep.local(ptr %genp)
  %storedv = zext i1 %gen0 to i8
  store i8 %storedv, ptr addrspacecast (ptr addrspace(1) @gen to ptr), align 1

  %isg1 = tail call i1 @llvm.nvvm.isspacep.local(ptr addrspacecast (ptr addrspace(1) @global_data to ptr))
  %isg18 = zext i1 %isg1 to i8
  store i8 %isg18, ptr addrspacecast (ptr addrspace(1) @g1 to ptr), align 1

  %gp_asc = addrspacecast ptr addrspace(1) %gp to ptr
  %isg2 = tail call i1 @llvm.nvvm.isspacep.local(ptr %gp_asc)
  %isg28 = zext i1 %isg2 to i8
  store i8 %isg28, ptr addrspacecast (ptr addrspace(1) @g2 to ptr), align 1

  %iss1 = tail call i1 @llvm.nvvm.isspacep.local(ptr addrspacecast (ptr addrspace(3) @shared_data to ptr))
  %iss18 = zext i1 %iss1 to i8
  store i8 %iss18, ptr addrspacecast (ptr addrspace(1) @s1 to ptr), align 1

  %sp_asc = addrspacecast ptr addrspace(3) %sp to ptr
  %iss2 = tail call i1 @llvm.nvvm.isspacep.local(ptr %sp_asc)
  %iss28 = zext i1 %iss2 to i8
  store i8 %iss28, ptr addrspacecast (ptr addrspace(1) @s2 to ptr), align 1

  %isc1 = tail call i1 @llvm.nvvm.isspacep.local(ptr addrspacecast (ptr addrspace(4) @const_data to ptr))
  %isc18 = zext i1 %isc1 to i8
  store i8 %isc18, ptr addrspacecast (ptr addrspace(1) @c1 to ptr), align 1

  %cp_asc = addrspacecast ptr addrspace(4) %cp to ptr
  %isc2 = tail call i1 @llvm.nvvm.isspacep.local(ptr %cp_asc)
  %isc28 = zext i1 %isc2 to i8
  store i8 %isc28, ptr addrspacecast (ptr addrspace(1) @c2 to ptr), align 1

  ; Local data can't have a constant address, so we can't have a constant ASC expression
  ; We can only use an ASC instruction.
  %lp_asc = addrspacecast ptr addrspace(5) %lp to ptr
  %isl = call i1 @llvm.nvvm.isspacep.local(ptr nonnull %lp_asc)
  %isl8 = zext i1 %isl to i8
  store i8 %isl8, ptr addrspacecast (ptr addrspace(1) @l to ptr), align 1

  ret void
}