To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

instructions.uir 11.8 KB
Newer Older
Kunshan Wang's avatar
Kunshan Wang committed
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
.typedef @i1  = int<1>
.typedef @i8  = int<8>
.typedef @i16 = int<16>
.typedef @i32 = int<32>
.typedef @i64 = int<64>

.typedef @float  = float
.typedef @double = double

.typedef @void = void

.typedef @rv  = ref<@void>
.typedef @irv = iref<@void>
.typedef @wrv = weakref<@void>

.typedef @ri32 = ref<@i32>
.typedef @ri64 = ref<@i64>
.typedef @ii32 = iref<@i32>
.typedef @ii64 = iref<@i64>

.typedef @ii8 = iref<@i8>
.typedef @iii8 = iref<@ii8>

.funcsig @npnr_sig  = @void ()
.typedef @npnr_func = func<@npnr_sig>

.funcsig @iii_sig  = @i64 (@i64 @i64)
.typedef @iii_func = func<@iii_sig>

.typedef @thread    = thread
.typedef @stack     = stack
.typedef @tagref64  = tagref64

.typedef @4xfloat   = vector <@float 4>
.typedef @4xi32     = vector <@int 4>
.typedef @2xdouble  = vector <@double 2>

.const @I8_0    <@i8>       = 0
.const @I16_0   <@i16>      = 0
.const @I32_0   <@i32>      = 0
.const @I64_0   <@i64>      = 0
.const @F_0     <@float>    = 0.0f
.const @D_0     <@float>    = 0.0d
.const @I8_1    <@i8>       = 1
.const @I16_1   <@i16>      = 1
.const @I32_1   <@i32>      = 1
.const @I64_1   <@i64>      = 1
.const @F_1     <@float>    = 1.0f
.const @D_1     <@float>    = 1.0d

.const @I32_2   <@i32>      = 2
.const @I64_2   <@i32>      = 2

.const @I64_42  <@i32>      = 42
.const @I64_43  <@i32>      = 43

.const @FALSE <@i1> = 0
.const @TRUE  <@i1> = 1

.const @NULLREF <@rv> = NULL

.funcsig @intBinOpTest_sig = @void (@i32 @i32)
.funcdef @intBinOpTest VERSION @intBinOpTest_v1 <@intBinOpTest_sig> (%p0 %p1) {
    %entry:
        %add  = ADD  <@i32> %p0 %p1
        %sub  = SUB  <@i32> %p0 %p1
        %mul  = MUL  <@i32> %p0 %p1
        %udiv = UDIV <@i32> %p0 %p1
        %sdiv = SDIV <@i32> %p0 %p1
        %urem = UREM <@i32> %p0 %p1
        %srem = SREM <@i32> %p0 %p1
        %shl  = SHL  <@i32> %p0 %p1
        %lshr = LSHR <@i32> %p0 %p1
        %ashr = ASHR <@i32> %p0 %p1
        %and  = AND  <@i32> %p0 %p1
        %or   = OR   <@i32> %p0 %p1
        %xor  = XOR  <@i32> %p0 %p1
        
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
80
81
}

Kunshan Wang's avatar
Kunshan Wang committed
82
83
84
85
86
87
88
89
90
91
.funcsig @fpBinOpTest_sig = @void (@double @double)
.funcdef @fpBinOpTest VERSION @fpBinOpTest_v1 <@fpBinOpTest_sig> (%p0 %p1) {
    %entry:
        %fadd = FADD <@double> %p0 %p1
        %fsub = FSUB <@double> %p0 %p1
        %fmul = FMUL <@double> %p0 %p1
        %fdiv = FDIV <@double> %p0 %p1
        %frem = FREM <@double> %p0 %p1
        
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
92
93
}

Kunshan Wang's avatar
Kunshan Wang committed
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
.funcsig @intCmpTest_sig = @void (@i64 @i64)
.funcdef @intCmpTest VERSION @intCmpTest_v1 <@intCmpTest_sig> (%p0 %p1) {
    %entry:
        %eq  = EQ  <@i64> %p0 %p1
        %ne  = NE  <@i64> %p0 %p1
        %ult = ULT <@i64> %p0 %p1
        %ule = ULE <@i64> %p0 %p1
        %ugt = UGT <@i64> %p0 %p1
        %uge = UGE <@i64> %p0 %p1
        %slt = SLT <@i64> %p0 %p1
        %sle = SLE <@i64> %p0 %p1
        %sgt = SGT <@i64> %p0 %p1
        %sge = SGE <@i64> %p0 %p1
        
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
109
110
}

Kunshan Wang's avatar
Kunshan Wang committed
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
.funcsig @fpCmpTest_sig = @void (@float @float)
.funcdef @fpCmpTest VERSION @fpCmpTest_v1 <@fpCmpTest_sig> (%p0 %p1) {
    %entry:
        %ftrue  = FTRUE  <@float> %p0 %p1
        %ffalse = FFALSE <@float> %p0 %p1
        %ford = FORD <@float> %p0 %p1
        %foeq = FOEQ <@float> %p0 %p1
        %fone = FONE <@float> %p0 %p1
        %folt = FOLT <@float> %p0 %p1
        %fole = FOLE <@float> %p0 %p1
        %fogt = FOGT <@float> %p0 %p1
        %foge = FOGE <@float> %p0 %p1
        %funo = FUNO <@float> %p0 %p1
        %fueq = FUEQ <@float> %p0 %p1
        %fune = FUNE <@float> %p0 %p1
        %fult = FULT <@float> %p0 %p1
        %fule = FULE <@float> %p0 %p1
        %fugt = FUGT <@float> %p0 %p1
        %fuge = FUGE <@float> %p0 %p1
        
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
132
133
}

Kunshan Wang's avatar
Kunshan Wang committed
134
135
136
137
138
139
.funcsig @convTest_sig = @void (@i32 @i64 @float @double)
.funcdef @convTest VERSION @convTest_v1 <@convTest_sig> (%p0 %p1 %p2 %p3) {
    %entry:
        %trunc  = TRUNC <@i64 @i32> %p1
        %zext   = ZEXT  <@i32 @i64> %p0
        %sext   = SEXT  <@i32 @i64> %p0
Kunshan Wang's avatar
Kunshan Wang committed
140

Kunshan Wang's avatar
Kunshan Wang committed
141
142
        %fptrunc = FPTRUNC <@double @float> %p3
        %fpext   = FPEXT   <@float @double> %p2
Kunshan Wang's avatar
Kunshan Wang committed
143

Kunshan Wang's avatar
Kunshan Wang committed
144
145
146
147
        %fptoui = FPTOUI <@double @i64> %p3
        %fptosi = FPTOSI <@double @i64> %p3
        %uitofp = UITOFP <@i64 @double> %p1
        %sitofp = SITOFP <@i64 @double> %p1
Kunshan Wang's avatar
Kunshan Wang committed
148

Kunshan Wang's avatar
Kunshan Wang committed
149
150
151
152
        %bitcast0 = BITCAST <@i32 @float>  %p0
        %bitcast1 = BITCAST <@i64 @double> %p1
        %bitcast2 = BITCAST <@float @i32>  %p2
        %bitcast3 = BITCAST <@double @i64> %p3
Kunshan Wang's avatar
Kunshan Wang committed
153

Kunshan Wang's avatar
Kunshan Wang committed
154
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
155
156
}

Kunshan Wang's avatar
Kunshan Wang committed
157
158
159
160
161
162
163
164
.funcsig @refCastTest_sig @void (@rv @irv @npnr_func)
.funcdef @refCastTest VERSION @refCastTest_v1 <@refCastTest_sig> (%p0 %p1 %p2) {
    %entry:
        %refcast  = REFCAST <@rv @ri32> %p0
        %irefcast = REFCAST <@irv @ii64> %p1
        %funccast = REFCAST <@npnr_func @iii_func> %p2
        
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
165
166
}

Kunshan Wang's avatar
Kunshan Wang committed
167
168
.funcsig @ctrlFlow_sig = @void (@i32)
.funcdef @ctrlFlow VERSION @ctrlFlow_v1 <@ctrlFlow_sig> (%p0) {
Kunshan Wang's avatar
Kunshan Wang committed
169
170
171
172
    %entry:
        %br1 = BRANCH %head
    
    %head:
Kunshan Wang's avatar
Kunshan Wang committed
173
174
        %phi  = PHI <@i32> { %entry: @I32_0; %next: %i2; }
        %zero = EQ <@i32> %p0 @I32_0
Kunshan Wang's avatar
Kunshan Wang committed
175
176
177
        %br2 = BRANCH2 %zero %body %exit
        
    %body:
Kunshan Wang's avatar
Kunshan Wang committed
178
        %switch = SWITCH <@i32> %phi %other { @I32_1: %one; @I32_2: %two; }
Kunshan Wang's avatar
Kunshan Wang committed
179
180
181
182
183
184
185
    %one:
        %br3 = BRANCH %next
    %two:
        %br4 = BRANCH %next
    %other:
        %br5 = BRANCH %next
    %next:
Kunshan Wang's avatar
Kunshan Wang committed
186
        %i2 = SUB <@i32> %phi @I32_1
Kunshan Wang's avatar
Kunshan Wang committed
187
188
189
190
191
192
193
        %br6 = BRANCH %head
        
    %exit:
        RETVOID
}


Kunshan Wang's avatar
Kunshan Wang committed
194
.funcdecl @callee1 <@npnr_sig>
Kunshan Wang's avatar
Kunshan Wang committed
195

Kunshan Wang's avatar
Kunshan Wang committed
196
197
198
199
.funcdef @callee2 VERSION @callee2_v1 <@iiisig> (%p0 %p1) {
    %entry:
        %rv = ADD <@i64> %p0 %p1
        %ret = RET <@i64> %rv
Kunshan Wang's avatar
Kunshan Wang committed
200
201
}

Kunshan Wang's avatar
Kunshan Wang committed
202
203
204
205
.funcdef @callee3 VERSION @callee3_v1 <@iiisig> (%p0 %p1) {
    %entry:
        %exc = NEW <@double>
        %throw = THROW %exc
Kunshan Wang's avatar
Kunshan Wang committed
206
207
}

Kunshan Wang's avatar
Kunshan Wang committed
208
209
210
211
212
.funcdef @caller1 VERSION @caller1_v1 <@npnr_sig> () {
    %entry:
        %v1 = CALL <@npnr_sig> @callee1 ()
        %v2 = CALL <@iiisig> @callee2 (@I64_1 @I64_2)
        %v3 = CALL <@iiisig> @callee3 (@I64_1 @I64_2) EXC(%cont %catch)
Kunshan Wang's avatar
Kunshan Wang committed
213
214

    %cont:
Kunshan Wang's avatar
Kunshan Wang committed
215
216
        %v4 = CALL <@npnr_sig> @callee1 () KEEPALIVE(%v2 %v3)
        %v5 = CALL <@iiisig> @callee3 (%v3 %v3) EXC(%cont2 %catch) KEEPALIVE(%v2)
Kunshan Wang's avatar
Kunshan Wang committed
217
218
219
220
221
222
223
224
225

    %cont2:
        %retv = RETVOID

    %catch:
        %exc = LANDINGPAD
        RETVOID
}

Kunshan Wang's avatar
Kunshan Wang committed
226
227
228
.funcdef @caller2 VERSION @caller2_v1 <@iiisig> (%p0 %p1) {
    %entry:
        %tc = TAILCALL <@iiisig> @callee2 (%p0 %p1)
Kunshan Wang's avatar
Kunshan Wang committed
229
230
}

Kunshan Wang's avatar
Kunshan Wang committed
231
232
.typedef @sid = struct <@i64 @double>
.const @sid1 <@sid> = {@I64_1 @D_1}
Kunshan Wang's avatar
Kunshan Wang committed
233

Kunshan Wang's avatar
Kunshan Wang committed
234
235
.const @v1 <@4xfloat> = {@F_0 @F_0 @F_0 @F_0}
.const @v2 <@4xfloat> = {@F_1 @F_1 @F_1 @F_1}
Kunshan Wang's avatar
Kunshan Wang committed
236

Kunshan Wang's avatar
Kunshan Wang committed
237
238
239
.const @I32_4 <@i32> = 4
.const @I32_6 <@i32> = 6
.const @vshf <@4xi32> = {@I32_0 @I32_2 @I32_4 @I32_6}
Kunshan Wang's avatar
Kunshan Wang committed
240

Kunshan Wang's avatar
Kunshan Wang committed
241
242
243
244
245
246
247
248
249
.funcdef @aggregate VERSION @aggregate_v1 <@npnr_sig> () {
    %entry:
        %e0 = EXTRACTVALUE <@sid 0> @sid1
        %e1 = EXTRACTVALUE <@sid 1> @sid1
        %i0 = INSERTVALUE  <@sid 0> @sid1 @I64_0
        %i1 = INSERTVALUE  <@sid 1> @sid1 @D_0
        %ee0 = EXTRACTELEMENT <@4xfloat @i32> @v1 @I32_0
        %ie0 = INSERTELEMENT  <@4xfloat @i32> @v1 @I32_1 @F_1
        %fv0 = SHUFFLEVECTOR  <@4xfloat @4xi32> @v1 @v2 @vshf
Kunshan Wang's avatar
Kunshan Wang committed
250
    
Kunshan Wang's avatar
Kunshan Wang committed
251
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
252
253
}

Kunshan Wang's avatar
Kunshan Wang committed
254
255
.typedef @al = array <@i64 10>
.typedef @hic = hybrid <@i64 @i8>
Kunshan Wang's avatar
Kunshan Wang committed
256

Kunshan Wang's avatar
Kunshan Wang committed
257
258
259
260
261
262
263
.funcsig @memops_sig = @void <@i64 @i64>
.funcdef @memops VERSION @memops_v1 <@memops_sig> (%p0 %p1) {
    %entry:
        %new            = NEW <@i64>
        %newhybrid      = NEWHYBRID <@hic> %p0
        %alloca         = ALLOCA <@i64 >
        %allocahybrid   = ALLOCAHYBRID <@hic> %p0
Kunshan Wang's avatar
Kunshan Wang committed
264

Kunshan Wang's avatar
Kunshan Wang committed
265
266
267
268
269
270
271
        %new_s          = NEW <@i64> EXC(%bb2 %handler)
    %bb2:
        %newhybrid_s    = NEWHYBRID <@hic> %p0 EXC(%bb3 %handler)
    %bb3:
        %alloca_s       = ALLOCA <@i64 > EXC(%bb4 %handler)
    %bb4:
        %allocahybrid_s = ALLOCAHYBRID <@hic> %p0 EXC(%bb5 %handler)
Kunshan Wang's avatar
Kunshan Wang committed
272

Kunshan Wang's avatar
Kunshan Wang committed
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
    %bb5:
        %new2           = NEW <@sid>
        %alloca2        = ALLOCA <@al>
        
        %getiref        = GETIREF <@sid> %new2
        
        %getfieldiref   = GETFIELDIREF <@sid 0> %getiref
        %getelemiref    = GETELEMIREF <@al @i64> %alloca2 %p1
        
        %getfixedpartiref   = GETFIXEDPARTIREF <@hic> %allocahybrid
        %getvarpartiref     = GETVARPARTIREF <@hic> %allocahybrid
        
        %shiftiref      = SHIFTIREF <@i8 @i64> %getvarpartiref %p1
        
        %load       = LOAD  <@i64> %alloca
        %store      = STORE <@i64> %alloca @I64_42
        %cmpxchg    = CMPXCHG SEQ_CST SEQ_CST <@i64> %alloca @I64_42 @I64_0
        %cmpxchg_w  = CMPXCHG WEAK SEQ_CST SEQ_CST <@i64> %alloca @I64_42 @I64_0
        %atomicrmw  = ATOMICRMW SEQ_CST ADD <@i64> %alloca @I64_43

        %load_s     = LOAD  <@i64> %alloca EXC(%bb6 %handler)
    %bb6
        %store_s    = STORE <@i64> %alloca @I64_42 EXC(%bb7 %handler)
    %bb7
        %cmpxchg_s  = CMPXCHG SEQ_CST SEQ_CST <@i64> %alloca @I64_42 @I64_0 EXC(%bb8 %handler)
    %bb8
        %atomicrmw_s= ATOMICRMW SEQ_CST ADD <@i64> %alloca @I64_43 EXC(%bb9 %handler)

    %bb9
        %fence = FENCE SEQ_CST
Kunshan Wang's avatar
Kunshan Wang committed
303
304
305
        
        RETVOID

Kunshan Wang's avatar
Kunshan Wang committed
306
307
    %handler:
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
308
309
310
}


Kunshan Wang's avatar
Kunshan Wang committed
311
312
313
314
315
316
317
318
319
320
321
.funcsig @memorder_sig = @void (@ii64)
.funcdef @memorder VERSION @memorder_v1 <@memorder_sig> (%p0) {
    %entry:
        %l0 = LOAD NOT_ATOMIC   <@i64> %p0
        %l1 = LOAD RELAXED      <@i64> %p0
        %l2 = LOAD CONSUME      <@i64> %p0
        %l3 = LOAD ACQUIRE      <@i64> %p0
        %s4 = STORE RELEASE     <@i64> %p0 @I64_42
        %c5 = CMPXCHG ACQ_REL   <@i64> %p0 @I64_42 @I64_43
        %l6 = LOAD SEQ_CST      <@i64> %p0

Kunshan Wang's avatar
Kunshan Wang committed
322
323
324
        RETVOID
}

Kunshan Wang's avatar
Kunshan Wang committed
325
326
327
328
329
330
331
332
333
334
335
336
337
338
.funcsig @atomicrmwops_sig = @void (@ii64 @i64)
.funcdef @atomicrmwops VERSION @atomicrmwops_v1 <@atomicrmwops_sig> (%p0 %p1) {
    %entry:
        %old0 = ATOMICRMW ACQ_REL XCHG  <@i64> %p0 %p1
        %old1 = ATOMICRMW ACQ_REL ADD   <@i64> %p0 %p1
        %old2 = ATOMICRMW ACQ_REL SUB   <@i64> %p0 %p1
        %old3 = ATOMICRMW ACQ_REL AND   <@i64> %p0 %p1
        %old4 = ATOMICRMW ACQ_REL NAND  <@i64> %p0 %p1
        %old5 = ATOMICRMW ACQ_REL OR    <@i64> %p0 %p1
        %old6 = ATOMICRMW ACQ_REL XOR   <@i64> %p0 %p1
        %old7 = ATOMICRMW ACQ_REL MAX   <@i64> %p0 %p1
        %old8 = ATOMICRMW ACQ_REL MIN   <@i64> %p0 %p1
        %old9 = ATOMICRMW ACQ_REL UMAX  <@i64> %p0 %p1
        %olda = ATOMICRMW ACQ_REL UMIN  <@i64> %p0 %p1
Kunshan Wang's avatar
Kunshan Wang committed
339

Kunshan Wang's avatar
Kunshan Wang committed
340
341
        RETVOID
}
Kunshan Wang's avatar
Kunshan Wang committed
342

Kunshan Wang's avatar
Kunshan Wang committed
343
344
345
346
347
.funcdef @traps VERSION @traps_v1 <@npnr_sig> () {
    %entry:
        %a  = ADD <@i64> @I64_42 @I64_43
        %b  = SUB <@i64> @I64_42 @I64_43
        %c  = MUL <@i64> @I64_42 @I64_43
Kunshan Wang's avatar
Kunshan Wang committed
348

Kunshan Wang's avatar
Kunshan Wang committed
349
350
        %tp     = TRAP <@i32> KEEPALIVE(%a)
        %tp_s   = TRAP <@i64> EXC(%tp_s_cont %tp_s_exc) KEEPALIVE(%b)
Kunshan Wang's avatar
Kunshan Wang committed
351

Kunshan Wang's avatar
Kunshan Wang committed
352
353
354
355
356
    %tp_s_cont:
        %wp     = WATCHPOINT 1 <@float> %wp_dis_cont %wp_ena_cont KEEPALIVE(%a)
    
    %wp_dis_cont:
        %wp_s   = WATCHPOINT 2 <@double> %wp_s_dis_cont %wp_s_ena_cont WPEXC(%wp_s_exc) KEEPALIVE(%b)
Kunshan Wang's avatar
Kunshan Wang committed
357

Kunshan Wang's avatar
Kunshan Wang committed
358
359
    %wp_ena_cont:
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
360

Kunshan Wang's avatar
Kunshan Wang committed
361
362
    %wp_s_dis_cont:
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
363

Kunshan Wang's avatar
Kunshan Wang committed
364
365
    %wp_s_ena_cont:
        RETVOID
Kunshan Wang's avatar
Kunshan Wang committed
366
    
Kunshan Wang's avatar
Kunshan Wang committed
367
368
369
    %tp_s_exc:
        %exc = LANDINGPAD
        THROW %exc
Kunshan Wang's avatar
Kunshan Wang committed
370
        
Kunshan Wang's avatar
Kunshan Wang committed
371
372
373
374
375
376
377
378
379
380
381
    %wp_s_exc:
        %exc2 = LANDINGPAD
        THROW %exc2
}

.funcsig @ccall_callee_sig = @void (@double)

.funcsig @ccall_sig = @void (@i64)
.funcdef @ccall VERSION @ccall_v1 <@ccall_sig> (%p0) {
    %entry:
        %rv = CCALL DEFAULT <@ccall_callee_sig @i64> %p0 (@D_1)
Kunshan Wang's avatar
Kunshan Wang committed
382
383
384
        
        RETVOID
}
Kunshan Wang's avatar
Kunshan Wang committed
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414

.funcsig @gen_sig = @void (@stack)
.funcdef @gen VERSION @gen_v1 <@npnr_sig> (%main) {
    %entry:
        %ss1 = SWAPSTACK %main RET_WITH<@void> PASS_VALUE(@i64_0)
        %ss2 = SWAPSTACK %main KILL_OLD THROW_EXC(@NULLREF)
        THROW @NULLREF // unreachable
}

.funcdef @swapstack VERSION @swapstack_v1 <@npnr_sig> () {
    %entry:
        %curstack = COMMINST @uvm.cur_stack
        %coro = NEWSTACK <@iiisig> @callee2 (%curstack)
        %ss1 = SWAPSTACK %coro RET_WITH<@i64> PASS_VOID
        %ss2 = SWAPSTACK %coro RET_WITH<@i64> PASS_VOID EXC(%nor %exc)

    %nor:
        RETVOID
    %exc:
        RETVOID
}

.funcdef @comminst VERSION @comminst_v1 <@npnr_sig> () {
    %entry:
        %curstack = COMMINST @uvm.cur_stack
        %sta = NEWSTACK <@iiisig> @callee2 (%curstack)
        %thr = COMMINST @new_stack (%sta)
        %th_ex = COMMINST @thread_exit
        RETVOID
}