-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add peggy benchmark files and snapshots
- Loading branch information
Showing
34 changed files
with
1,242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@main: int { | ||
five: int = const 5; | ||
one: int = const 1; | ||
j: int = const 0; | ||
i: int = id five; | ||
|
||
.loop_test: | ||
cond: bool = eq i five; | ||
br cond .loop_body .loop_end; | ||
|
||
.loop_body: | ||
j: int = add one j; | ||
jmp .loop_test; | ||
|
||
.loop_end: | ||
ret j; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# ARGS: 0 | ||
@main(n: int) { | ||
zero: int = const 0; | ||
x: int = id zero; | ||
y: int = id zero; | ||
fivehundred: int = const 500; | ||
|
||
.pred: | ||
whilecond: bool = lt y fivehundred; | ||
br whilecond .loopbody .end; | ||
|
||
.loopbody: | ||
two: int = const 2; | ||
ifcond: bool = eq n zero; | ||
br ifcond .thn .els; | ||
|
||
.thn: | ||
x: int = mul y two; | ||
jmp .ifend; | ||
|
||
.els: | ||
three: int = const 3; | ||
x: int = mul y three; | ||
|
||
.ifend: | ||
one: int = const 1; | ||
y: int = add one y; | ||
|
||
jmp .pred; | ||
|
||
.end: | ||
print x; | ||
} |
28 changes: 28 additions & 0 deletions
28
tests/passing/small/peggy_comparison/conditional_constant_folding.bril
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# ARGS: 4 | ||
@main(x: int) { | ||
five: int = const 5; | ||
four: int = const 4; | ||
twenty: int = const 20; | ||
cond: bool = eq x five; | ||
br cond .if .else_if_check; | ||
|
||
.if: | ||
res: int = mul four x; | ||
jmp .end; | ||
|
||
.else_if_check: | ||
cond: bool = eq x four; | ||
br cond .else_if .else; | ||
jmp .end; | ||
|
||
.else_if: | ||
res: int = mul five x; | ||
jmp .end; | ||
|
||
.else: | ||
res: int = id twenty; | ||
jmp .end; | ||
|
||
.end: | ||
print res; | ||
} |
20 changes: 20 additions & 0 deletions
20
tests/passing/small/peggy_comparison/dead_loop_deletion.bril
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@main { | ||
j: int = const 3; | ||
i: int = const 0; | ||
forty: int = const 40; | ||
one: int = const 1; | ||
|
||
.loop_test: | ||
cond: bool = lt i forty; | ||
br cond .loop_body .loop_end; | ||
|
||
.loop_body: | ||
j: int = add j one; | ||
i: int = add i one; | ||
jmp .loop_test; | ||
|
||
.loop_end: | ||
j: int = const 2; | ||
|
||
print j; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# ARGS: 20 | ||
@main(x: int) { | ||
cond: bool = const true; | ||
br cond .thn .els; | ||
|
||
.thn: | ||
print x; | ||
|
||
.els: | ||
one: int = const 1; | ||
res: int = sub x one; | ||
print res; | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/passing/small/peggy_comparison/loop_based_code_motion.bril
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@main { | ||
x: int = const 0; | ||
three: int = const 3; | ||
|
||
.loop_test: | ||
cond: bool = lt x three; | ||
br cond .loop_body .loop_end; | ||
|
||
.loop_body: | ||
one: int = const 1; | ||
x: int = add x one; | ||
jmp .loop_test; | ||
|
||
.loop_end: | ||
five: int = const 5; | ||
x: int = mul x five; | ||
|
||
print x; | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/passing/small/peggy_comparison/loop_invariant_code_motion.bril
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# ARGS: 30 10 | ||
@main(n: int, m: int) { | ||
i: int = const 0; | ||
twenty: int = const 20; | ||
one: int = const 1; | ||
|
||
.loop_test: | ||
cond: bool = lt i twenty; | ||
br cond .loop_body .loop_end; | ||
|
||
.loop_body: | ||
j: int = mul n twenty; | ||
if_cond: bool = lt j m; | ||
br if_cond .thn .end_if; | ||
|
||
.thn: | ||
j: int = add j one; | ||
|
||
.end_if: | ||
output: int = mul i j; | ||
print output; | ||
i: int = add i one; | ||
jmp .loop_test; | ||
|
||
.loop_end: | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# ARGS: 5 | ||
@main(n: int) { | ||
x: int = const 0; | ||
i: int = const 0; | ||
|
||
.loop_test: | ||
cond: bool = lt i n; | ||
br cond .loop_body .loop_end; | ||
|
||
.loop_body: | ||
five: int = const 5; | ||
one: int = const 1; | ||
x: int = add x five; | ||
i: int = add i one; | ||
jmp .loop_test; | ||
|
||
.loop_end: | ||
print x; | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/passing/small/peggy_comparison/loop_strength_reduction.bril
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@main { | ||
i: int = const 0; | ||
d: int = const 0; | ||
three_hundred: int = const 300; | ||
five: int = const 5; | ||
one: int = const 1; | ||
|
||
.loop_test: | ||
cond: bool = lt d three_hundred; | ||
br cond .loop_body .loop_end; | ||
|
||
.loop_body: | ||
out: int = mul i five; | ||
print out; | ||
|
||
i: int = add i one; | ||
d: int = add d one; | ||
jmp .loop_test; | ||
|
||
.loop_end: | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/passing/small/peggy_comparison/loop_strength_reduction_modified.bril
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@main { | ||
i: int = const 0; | ||
d: int = const 0; | ||
three_hundred: int = const 300; | ||
three: int = const 3; | ||
five: int = const 5; | ||
one: int = const 1; | ||
one_hundred_fifty: int = const 150; | ||
|
||
.loop_test: | ||
cond: bool = lt d three_hundred; | ||
br cond .loop_body .loop_end; | ||
|
||
.loop_body: | ||
out: int = mul i five; | ||
print out; | ||
|
||
i: int = add i one; | ||
if_cond: bool = eq d one_hundred_fifty; | ||
br if_cond .if_then .end_if; | ||
|
||
.if_then: | ||
i: int = add i three; | ||
|
||
.end_if: | ||
d: int = add d one; | ||
|
||
jmp .loop_test; | ||
|
||
.loop_end: | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@main { | ||
i: int = const 0; | ||
one: int = const 1; | ||
|
||
.loop_test: | ||
cond: bool = lt i one; | ||
br cond .loop_body .loop_end; | ||
|
||
.loop_body: | ||
i: int = add one i; | ||
jmp .loop_test; | ||
|
||
.loop_end: | ||
print i; | ||
} |
28 changes: 28 additions & 0 deletions
28
tests/passing/small/peggy_comparison/simple_loop_unswitch.bril
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# ARGS: 40 | ||
@main(n: int) { | ||
one: int = const 1; | ||
zero: int = const 0; | ||
i: int = id zero; | ||
j: int = id zero; | ||
|
||
.loop_test: | ||
cond: bool = lt i n; | ||
br cond .loop_body .loop_end; | ||
|
||
.loop_body: | ||
print i; | ||
|
||
cond: bool = lt n zero; | ||
br cond .thn .ifend; | ||
|
||
.thn: | ||
j: int = const 2; | ||
|
||
.ifend: | ||
j: int = add one j; | ||
i: int = add one i; | ||
jmp .loop_test; | ||
|
||
.loop_end: | ||
print j; | ||
} |
64 changes: 64 additions & 0 deletions
64
tests/snapshots/files__branch_hoisting-optimize-sequential.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
source: tests/files.rs | ||
expression: visualization.result | ||
--- | ||
# ARGS: 0 | ||
@main(v0: int) { | ||
.b1_: | ||
c2_: int = const 0; | ||
c3_: int = const 500; | ||
v4_: int = id c2_; | ||
v5_: int = id c2_; | ||
v6_: int = id v0; | ||
v7_: int = id c2_; | ||
v8_: int = id c3_; | ||
.b9_: | ||
v10_: bool = lt v5_ v8_; | ||
v11_: int = id v4_; | ||
v12_: int = id v5_; | ||
v13_: int = id v6_; | ||
v14_: int = id v7_; | ||
v15_: int = id v8_; | ||
br v10_ .b16_ .b17_; | ||
.b16_: | ||
v18_: bool = eq v6_ v7_; | ||
c19_: int = const 2; | ||
br v18_ .b20_ .b21_; | ||
.b20_: | ||
v22_: int = mul c19_ v5_; | ||
v23_: int = id v22_; | ||
v24_: int = id v5_; | ||
v25_: int = id v6_; | ||
v26_: int = id v6_; | ||
v27_: int = id v8_; | ||
.b28_: | ||
c29_: int = const 1; | ||
v30_: int = add c29_ v5_; | ||
v11_: int = id v23_; | ||
v12_: int = id v30_; | ||
v13_: int = id v6_; | ||
v14_: int = id v7_; | ||
v15_: int = id v8_; | ||
v4_: int = id v11_; | ||
v5_: int = id v12_; | ||
v6_: int = id v13_; | ||
v7_: int = id v14_; | ||
v8_: int = id v15_; | ||
jmp .b9_; | ||
.b21_: | ||
c31_: int = const 3; | ||
v32_: int = mul c31_ v5_; | ||
v23_: int = id v32_; | ||
v24_: int = id v5_; | ||
v25_: int = id v6_; | ||
v26_: int = id v7_; | ||
v27_: int = id v8_; | ||
jmp .b28_; | ||
.b17_: | ||
v4_: int = id v11_; | ||
v5_: int = id v12_; | ||
v6_: int = id v13_; | ||
v7_: int = id v14_; | ||
v8_: int = id v15_; | ||
print v4_; | ||
} |
Oops, something went wrong.