WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

instructions.uir 14.6 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
.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 ()
Kunshan Wang's avatar
Kunshan Wang committed
25
.typedef @npnr_func = funcref<@npnr_sig>
Kunshan Wang's avatar
Kunshan Wang committed
26
27

.funcsig @iii_sig  = @i64 (@i64 @i64)
Kunshan Wang's avatar
Kunshan Wang committed
28
.typedef @iii_func = funcref<@iii_sig>
Kunshan Wang's avatar
Kunshan Wang committed
29

Kunshan Wang's avatar
Kunshan Wang committed
30
31
.typedef @thread    = threadref
.typedef @stack     = stackref
Kunshan Wang's avatar
Kunshan Wang committed
32
33
34
.typedef @tagref64  = tagref64

.typedef @4xfloat   = vector <@float 4>
Kunshan Wang's avatar
Kunshan Wang committed
35
.typedef @4xi32     = vector <@i32 4>
Kunshan Wang's avatar
Kunshan Wang committed
36
37
.typedef @2xdouble  = vector <@double 2>

Kunshan Wang's avatar
Kunshan Wang committed
38
39
40
41
42
.typedef @pv    = uptr<@void>
.typedef @pi32  = uptr<@i32>
.typedef @pi64  = uptr<@i64>
.typedef @npnr_fp = ufuncptr<@npnr_sig>
.typedef @iii_fp  = ufuncptr<@iii_sig>
43

Kunshan Wang's avatar
Kunshan Wang committed
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.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

Kunshan Wang's avatar
Kunshan Wang committed
68
69
70
71
72
.const @VOID <@void> = NULL

.funcsig @intBinOpTest.sig = @void (@i32 @i32)
.funcdef @intBinOpTest VERSION %v1 <@intBinOpTest.sig> {
    %entry(<@i32> %p0 <@i32> %p1):
Kunshan Wang's avatar
Kunshan Wang committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
        %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
        
Kunshan Wang's avatar
Kunshan Wang committed
87
        RET @VOID
Kunshan Wang's avatar
Kunshan Wang committed
88
89
}

Kunshan Wang's avatar
Kunshan Wang committed
90
91
92
.funcsig @fpBinOpTest.sig = @void (@double @double)
.funcdef @fpBinOpTest VERSION %v1 <@fpBinOpTest.sig> {
    %entry(<@double> %p0 <@double> %p1):
Kunshan Wang's avatar
Kunshan Wang committed
93
94
95
96
97
98
        %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
        
Kunshan Wang's avatar
Kunshan Wang committed
99
        RET @VOID
Kunshan Wang's avatar
Kunshan Wang committed
100
101
}

Kunshan Wang's avatar
Kunshan Wang committed
102
103
104
.funcsig @intCmpTest.sig = @void (@i64 @i64)
.funcdef @intCmpTest VERSION %v1 <@intCmpTest.sig> {
    %entry(<@i64> %p0 <@i64> %p1):
Kunshan Wang's avatar
Kunshan Wang committed
105
106
107
108
109
110
111
112
113
114
115
        %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
        
Kunshan Wang's avatar
Kunshan Wang committed
116
        RET @VOID
Kunshan Wang's avatar
Kunshan Wang committed
117
118
}

Kunshan Wang's avatar
Kunshan Wang committed
119
120
121
.funcsig @fpCmpTest.sig = @void (@float @float)
.funcdef @fpCmpTest VERSION %v1 <@fpCmpTest.sig> {
    %entry(<@float> %p0 <@float> %p1):
Kunshan Wang's avatar
Kunshan Wang committed
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
        %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
        
Kunshan Wang's avatar
Kunshan Wang committed
139
        RET @VOID
Kunshan Wang's avatar
Kunshan Wang committed
140
141
}

Kunshan Wang's avatar
Kunshan Wang committed
142
143
144
.funcsig @convTest.sig = @void (@i32 @i64 @float @double)
.funcdef @convTest VERSION %v1 <@convTest.sig> {
    %entry(<@i32> %p0 <@i64> %p1 <@float> %p2 <@double> %p3):
Kunshan Wang's avatar
Kunshan Wang committed
145
146
147
        %trunc  = TRUNC <@i64 @i32> %p1
        %zext   = ZEXT  <@i32 @i64> %p0
        %sext   = SEXT  <@i32 @i64> %p0
Kunshan Wang's avatar
Kunshan Wang committed
148

Kunshan Wang's avatar
Kunshan Wang committed
149
150
        %fptrunc = FPTRUNC <@double @float> %p3
        %fpext   = FPEXT   <@float @double> %p2
Kunshan Wang's avatar
Kunshan Wang committed
151

Kunshan Wang's avatar
Kunshan Wang committed
152
153
154
155
        %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
156

Kunshan Wang's avatar
Kunshan Wang committed
157
158
159
160
        %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
161

Kunshan Wang's avatar
Kunshan Wang committed
162
        RET @VOID
Kunshan Wang's avatar
Kunshan Wang committed
163
164
}

Kunshan Wang's avatar
Kunshan Wang committed
165
166
167
.funcsig @refCastTest.sig = @void (@rv @irv @npnr_func)
.funcdef @refCastTest VERSION %v1 <@refCastTest.sig> {
    %entry(<@rv> %p0 <@irv> %p1 <@npnr_func> %p2):
Kunshan Wang's avatar
Kunshan Wang committed
168
169
170
171
        %refcast  = REFCAST <@rv @ri32> %p0
        %irefcast = REFCAST <@irv @ii64> %p1
        %funccast = REFCAST <@npnr_func @iii_func> %p2
        
Kunshan Wang's avatar
Kunshan Wang committed
172
        RET @VOID
Kunshan Wang's avatar
Kunshan Wang committed
173
174
}

Kunshan Wang's avatar
Kunshan Wang committed
175
176
177
.funcsig @ptrCastTest.sig = @void (@i64)
.funcdef @ptrCastTest VERSION %v1 <@ptrCastTest.sig> {
    %entry(<@i64> %p0):
178
179
        %ptrcast = PTRCAST <@i64 @pi64> %p0
        
Kunshan Wang's avatar
Kunshan Wang committed
180
        RET @VOID
181
182
}

Kunshan Wang's avatar
Kunshan Wang committed
183
184
185
.funcsig @select.sig = @void ()
.funcdef @select VERSION %v1 <@select.sig> {
    %entry():
186
187
        %select  = SELECT <@i1 @i32> @TRUE @I32_0 @I32_1

Kunshan Wang's avatar
Kunshan Wang committed
188
        RET @VOID
189
190
}

Kunshan Wang's avatar
Kunshan Wang committed
191
192
193
194
.funcsig @ctrlFlow.sig = @void (@i32)
.funcdef @ctrlFlow VERSION %v1 <@ctrlFlow.sig> {
    %entry(<@i32> %p0):
        %br1 = BRANCH %head(%p0)
Kunshan Wang's avatar
Kunshan Wang committed
195
    
Kunshan Wang's avatar
Kunshan Wang committed
196
197
198
    %head(<@i32> %x):
        %zero = EQ <@i32> %x @I32_0
        %br2 = BRANCH2 %zero %body(%x) %exit()
Kunshan Wang's avatar
Kunshan Wang committed
199
        
Kunshan Wang's avatar
Kunshan Wang committed
200
201
202
203
204
205
206
207
208
209
210
    %body(<@i32> %x):
        %switch = SWITCH <@i32> %x %other(%x) { @I32_1 %one(%x) @I32_2 %two(%x) }
    %one(<@i32> %x):
        %br3 = BRANCH %next(%x)
    %two(<@i32> %x):
        %br4 = BRANCH %next(%x)
    %other(<@i32> %x):
        %br5 = BRANCH %next(%x)
    %next(<@i32> %x):
        %i2 = SUB <@i32> %x @I32_1
        %br6 = BRANCH %head(%i2)
Kunshan Wang's avatar
Kunshan Wang committed
211
        
Kunshan Wang's avatar
Kunshan Wang committed
212
213
    %exit():
        RET @VOID
Kunshan Wang's avatar
Kunshan Wang committed
214
215
216
}


Kunshan Wang's avatar
Kunshan Wang committed
217
.funcdecl @callee1 <@npnr_sig>
Kunshan Wang's avatar
Kunshan Wang committed
218

Kunshan Wang's avatar
Kunshan Wang committed
219
220
.funcdef @callee2 VERSION %v1 <@iii_sig> {
    %entry(<@i64> %p0 <@i64> %p1):
Kunshan Wang's avatar
Kunshan Wang committed
221
        %rv = ADD <@i64> %p0 %p1
Kunshan Wang's avatar
Kunshan Wang committed
222
        %ret = RET %rv
Kunshan Wang's avatar
Kunshan Wang committed
223
224
}

Kunshan Wang's avatar
Kunshan Wang committed
225
226
.funcdef @callee3 VERSION %v1 <@iii_sig> {
    %entry(<@i64> %p0 <@i64> %p1):
Kunshan Wang's avatar
Kunshan Wang committed
227
228
        %exc = NEW <@double>
        %throw = THROW %exc
Kunshan Wang's avatar
Kunshan Wang committed
229
230
}

Kunshan Wang's avatar
Kunshan Wang committed
231
232
.funcdef @caller1 VERSION %v1 <@npnr_sig> {
    %entry():
Kunshan Wang's avatar
Kunshan Wang committed
233
        %v1 = CALL <@npnr_sig> @callee1 ()
Kunshan Wang's avatar
Kunshan Wang committed
234
        %v2 = CALL <@iii_sig> @callee2 (@I64_1 @I64_2)
Kunshan Wang's avatar
Kunshan Wang committed
235
        %v3 = CALL <@iii_sig> @callee3 (@I64_1 @I64_2) EXC(%cont(%v2 %v3) %catch())
Kunshan Wang's avatar
Kunshan Wang committed
236

Kunshan Wang's avatar
Kunshan Wang committed
237
    %cont(<@i64> %v2 <@i64> %v3):
Kunshan Wang's avatar
Kunshan Wang committed
238
        %v4 = CALL <@npnr_sig> @callee1 () KEEPALIVE(%v2 %v3)
Kunshan Wang's avatar
Kunshan Wang committed
239
        %v5 = CALL <@iii_sig> @callee3 (%v3 %v3) EXC(%cont2() %catch()) KEEPALIVE(%v2)
Kunshan Wang's avatar
Kunshan Wang committed
240

Kunshan Wang's avatar
Kunshan Wang committed
241
242
    %cont2():
        %retv = RET @VOID
Kunshan Wang's avatar
Kunshan Wang committed
243

Kunshan Wang's avatar
Kunshan Wang committed
244
245
    %catch() [%exc]:
        RET @VOID
Kunshan Wang's avatar
Kunshan Wang committed
246
247
}

Kunshan Wang's avatar
Kunshan Wang committed
248
249
.funcdef @caller2 VERSION %v1 <@iii_sig> {
    %entry(<@i64> %p0 <@i64> %p1):
Kunshan Wang's avatar
Kunshan Wang committed
250
        %tc = TAILCALL <@iii_sig> @callee2 (%p0 %p1)
Kunshan Wang's avatar
Kunshan Wang committed
251
252
}

Kunshan Wang's avatar
Kunshan Wang committed
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
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
.typedef @sid = struct <@i64 @double>
.typedef @rsid = ref<@sid>
.const @sid1 <@sid> = {@I64_1 @D_1}

.const @v1 <@4xfloat> = {@F_0 @F_0 @F_0 @F_0}
.const @v2 <@4xfloat> = {@F_1 @F_1 @F_1 @F_1}

.const @I32_4 <@i32> = 4
.const @I32_6 <@i32> = 6
.const @vshf <@4xi32> = {@I32_0 @I32_2 @I32_4 @I32_6}

.funcdef @aggregate VERSION %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
        %sv0 = SHUFFLEVECTOR  <@4xfloat @4xi32> @v1 @v2 @vshf
    
        RET @VOID
}

.typedef @al = array <@i64 10>
.typedef @ral = ref<@al>
.typedef @hic = hybrid <@i64 @i8>
.typedef @rhic = ref<@hic>

.typedef @irefi64 = iref<@i64>
.typedef @irhic = iref<@hic>

.funcsig @memops.sig = @void (@i64 @i64)
.funcdef @memops VERSION %v1 <@memops.sig> {
    %entry(<@i64> %p0 <@i64> %p1):
        %new            = NEW <@i64>
        %newhybrid      = NEWHYBRID <@hic @i64> %p0
        %alloca         = ALLOCA <@i64>
        %allocahybrid   = ALLOCAHYBRID <@hic @i64> %p0

        %new_s          = NEW <@i64> EXC(%bb2(%alloca %allocahybrid %p0 %p1) %handler())
    %bb2(<@irefi64> %alloca <@irhic> %allocahybrid <@i64> %p0 <@i64> %p1):
        %newhybrid_s    = NEWHYBRID <@hic @i64> %p0 EXC(%bb3(%alloca %allocahybrid %p0 %p1) %handler())
    %bb3(<@irefi64> %alloca <@irhic> %allocahybrid <@i64> %p0 <@i64> %p1):
        %alloca_s       = ALLOCA <@i64 > EXC(%bb4(%alloca %allocahybrid %p0 %p1) %handler())
    %bb4(<@irefi64> %alloca <@irhic> %allocahybrid <@i64> %p0 <@i64> %p1):
        %allocahybrid_s = ALLOCAHYBRID <@hic @i64> %p0 EXC(%bb5(%alloca %allocahybrid %p1) %handler())

    %bb5(<@irefi64> %alloca <@irhic> %allocahybrid <@i64> %p1):
        %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(%alloca) %handler())
    %bb6(<@irefi64> %alloca ):
        %store_s    = STORE <@i64> %alloca @I64_42 EXC(%bb7(%alloca) %handler())
    %bb7(<@irefi64> %alloca ):
        %cmpxchg_s  = CMPXCHG SEQ_CST SEQ_CST <@i64> %alloca @I64_42 @I64_0 EXC(%bb8(%alloca) %handler())
    %bb8(<@irefi64> %alloca ):
        %atomicrmw_s= ATOMICRMW SEQ_CST ADD <@i64> %alloca @I64_43 EXC(%bb9() %handler())
        //BRANCH %bb9()

    %bb9():
        %fence = FENCE SEQ_CST
        
        RET @VOID

    %handler() [%exc]:
        RET @VOID
}

.funcsig @memops_ptr.sig = @void (@i64 @i64)
.funcdef @memops_ptr VERSION %v1 <@memops_ptr.sig> {
    %entry(<@i64> %p0 <@i64> %p1):
        %new            = NEW <@i64>
        %newhybrid      = NEWHYBRID <@hic @i64> %p0
        %new2           = NEW <@sid>
        %new3           = NEW <@al>

        %p              = COMMINST @uvm.native.pin <@ri64> (%new)
        %ph             = COMMINST @uvm.native.pin <@rhic> (%newhybrid)
        %p2             = COMMINST @uvm.native.pin <@rsid> (%new2)
        %p3             = COMMINST @uvm.native.pin <@ral>  (%new3)
        
        %getfieldiref   = GETFIELDIREF PTR <@sid 0>   %p2
        %getelemiref    = GETELEMIREF  PTR <@al @i64> %p3 %p1
        
        %getfixedpartiref   = GETFIXEDPARTIREF PTR <@hic> %ph
        %getvarpartiref     = GETVARPARTIREF   PTR <@hic> %ph
        
        %shiftiref      = SHIFTIREF PTR <@i8 @i64> %getvarpartiref %p1
        
        %load       = LOAD  PTR <@i64> %p
        %store      = STORE PTR <@i64> %p @I64_42
        %cmpxchg    = CMPXCHG PTR SEQ_CST SEQ_CST <@i64> %p @I64_42 @I64_0
        %atomicrmw  = ATOMICRMW PTR SEQ_CST ADD <@i64> %p @I64_43
        
        RET @VOID
}


.funcsig @memorder.sig = @void (@ii64)
.funcdef @memorder VERSION %v1 <@memorder.sig> {
    %entry(<@ii64> %p0):
        %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 ACQUIRE   <@i64> %p0 @I64_42 @I64_43
        %l6 = LOAD SEQ_CST      <@i64> %p0

        RET @VOID
}

.funcsig @atomicrmwops.sig = @void (@ii64 @i64)
.funcdef @atomicrmwops VERSION %v1 <@atomicrmwops.sig> {
    %entry(<@ii64> %p0 <@i64> %p1):
        %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

        RET @VOID
}

.funcdef @traps VERSION %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

        %tp     = TRAP <@i32> KEEPALIVE(%a)
        %tp_s   = TRAP <@i64> EXC(%tp_s_cont(%a %b) %tp_s_exc()) KEEPALIVE(%b)

    %tp_s_cont(<@i64> %a <@i64> %b):
        %wp     = WATCHPOINT 1 <@float> %wp_dis_cont(%b) %wp_ena_cont() KEEPALIVE(%a)
    
    %wp_dis_cont(<@i64> %b):
        %wp_s   = WATCHPOINT 2 <@double> %wp_s_dis_cont() %wp_s_ena_cont() WPEXC(%wp_s_exc()) KEEPALIVE(%b)

    %wp_ena_cont():
        RET @VOID

    %wp_s_dis_cont():
        RET @VOID

    %wp_s_ena_cont():
        RET @VOID
    
    %tp_s_exc() [%exc]:
        THROW %exc
        
    %wp_s_exc() [%exc]:
        THROW %exc
}

.funcsig @ccall_callee_sig = @void (@double)
.typedef @ccall_callee_fp = ufuncptr<@ccall_callee_sig>

.funcsig @ccall.sig = @void (@ccall_callee_fp)
.funcdef @ccall VERSION %v1 <@ccall.sig> {
    %entry(<@ccall_callee_fp> %p0):
        %rv = CCALL #DEFAULT <@ccall_callee_fp @ccall_callee_sig> %p0 (@D_1)
        
        RET @VOID
}

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

.funcdef @swapstack VERSION %v1 <@npnr_sig> {
    %entry():
        %curstack = COMMINST @uvm.current_stack
        %coro = NEWSTACK <@iii_sig> @callee2 (%curstack) EXC(%cont(%curstack %coro) %exc())
        
    %cont(<@stack> %curstack <@stack> %coro):
        %ss1 = SWAPSTACK %coro RET_WITH <@i64> PASS_VALUE <@void> @VOID KEEPALIVE(%curstack)
        %ss2 = SWAPSTACK %coro RET_WITH <@i64> PASS_VALUE <@void> @VOID EXC(%nor() %exc())

    %nor():
        RET @VOID
    %exc() [%exc]:
        RET @VOID
}

.funcdef @comminst VERSION %v1 <@npnr_sig> {
    %entry():
        %curstack = COMMINST @uvm.current_stack
        %sta = NEWSTACK <@iii_sig> @callee2 (%curstack)
        %thr = COMMINST @uvm.new_thread (%sta)

        %ex = COMMINST @uvm.native.expose [#DEFAULT] <[@npnr_sig]> (@swapstack)

        %th_ex = COMMINST @uvm.thread_exit
        RET @VOID
}