mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-16 07:28:52 +00:00
Add tests
This commit is contained in:
34
examples/ir3/simple_if.ir
Normal file
34
examples/ir3/simple_if.ir
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
fun i32 @fibonacci (i32) {
|
||||
init:
|
||||
bid: b0
|
||||
allocations:
|
||||
|
||||
|
||||
block b0:
|
||||
%b0:i0:u1 = cmp lt %b0:p0:i32 2:i32
|
||||
br %b0:i0:u1, b1(), b3(%b0:p0:i32)
|
||||
|
||||
block b1:
|
||||
%b1:i0:i32 = add %b0:p0:i32 2:i32
|
||||
j b3(%b1:i0:i32)
|
||||
|
||||
block b3:
|
||||
%b3:p0:i32:n
|
||||
%b3:i0:i32 = sub %b3:p0:i32 2:i32
|
||||
%b3:i1:i32 = call @fibonacci:*[ret:i32 params:(i32)](%b3:i0:i32)
|
||||
%b3:i2:i32 = sub %b3:p0:i32 1:i32
|
||||
%b3:i3:i32 = call @fibonacci:*[ret:i32 params:(i32)](%b3:i2:i32)
|
||||
%b3:i4:i32 = add %b3:i1:i32 %b3:i3:i32
|
||||
ret %b3:i4:i32
|
||||
}
|
||||
|
||||
fun i32 @main () {
|
||||
init:
|
||||
bid: b0
|
||||
allocations:
|
||||
|
||||
|
||||
block b0:
|
||||
ret 1:i32
|
||||
}
|
||||
Reference in New Issue
Block a user