mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-16 07:28:52 +00:00
Add tests
This commit is contained in:
21
examples/ir0/unary.ir
Normal file
21
examples/ir0/unary.ir
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
fun i32 @main () {
|
||||
init:
|
||||
bid: b0
|
||||
allocations:
|
||||
%l0:u8:temp
|
||||
|
||||
block b0:
|
||||
%b0:i0:u8 = typecast 0:i64 to u8
|
||||
%b0:i1:unit = store %b0:i0:u8 %l0:*u8
|
||||
%b0:i2:u8 = load %l0:*u8
|
||||
%b0:i3:u8 = sub %b0:i2:u8 1:u8
|
||||
%b0:i4:unit = store %b0:i3:u8 %l0:*u8
|
||||
%b0:i5:i32 = typecast %b0:i3:u8 to i32
|
||||
%b0:i6:u1 = cmp gt 1:i32 %b0:i5:i32
|
||||
%b0:i7:i32 = typecast %b0:i6:u1 to i32
|
||||
ret %b0:i7:i32
|
||||
|
||||
block b1:
|
||||
ret 0:i32
|
||||
}
|
||||
Reference in New Issue
Block a user