Add tests

This commit is contained in:
Jeehoon Kang
2020-06-09 14:45:11 +00:00
parent ea97330e03
commit ea9e6afcf8
258 changed files with 149921 additions and 26 deletions

45
examples/ir3/array3.ir Normal file
View File

@@ -0,0 +1,45 @@
fun *i32 @foo (*i32) {
init:
bid: b0
allocations:
block b0:
ret %b0:p0:*i32
}
fun i32 @main () {
init:
bid: b0
allocations:
%l0:[10 x i32]:a
block b0:
j b2(0:i32)
block b2:
%b2:p0:i32:i
%b2:i0:u1 = cmp lt %b2:p0:i32 10:i32
br %b2:i0:u1, b3(), b5()
block b3:
%b3:i0:*i32 = getelementptr %l0:*[10 x i32] offset 0:i32
%b3:i1:*i32 = call @foo:*[ret:*i32 params:(*i32)](%b3:i0:*i32)
%b3:i2:i64 = typecast %b2:p0:i32 to i64
%b3:i3:i64 = mul %b3:i2:i64 4:i64
%b3:i4:*i32 = getelementptr %b3:i1:*i32 offset %b3:i3:i64
%b3:i5:unit = store %b2:p0:i32 %b3:i4:*i32
%b3:i6:i32 = add %b2:p0:i32 1:i32
j b2(%b3:i6:i32)
block b5:
%b5:i0:*i32 = getelementptr %l0:*[10 x i32] offset 0:i32
%b5:i1:i64 = typecast 5:i32 to i64
%b5:i2:i64 = mul %b5:i1:i64 4:i64
%b5:i3:*i32 = getelementptr %b5:i0:*i32 offset %b5:i2:i64
%b5:i4:i32 = load %b5:i3:*i32
%b5:i5:u1 = cmp eq %b5:i4:i32 5:i32
%b5:i6:i32 = typecast %b5:i5:u1 to i32
ret %b5:i6:i32
}