Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reverse_int #262

Merged
merged 4 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions benchmarks/core/reverse.bril
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

@main{
input: int = const 123;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is OK, but to make the benchmark a little more reusable, you might consider making the input a parameter. Here's an example:

# ARGS: 407
@main(input : int) {

That is, you can make input a parameter to @main and then give it a value like # ARGS: 123 for benchmark automation purposes.

n: int = id input;
v0: int = const 0;
v1: int = const 10;
result: int = id v0;
v2: bool = const true;
notdone: bool = id v2;
.for.cond.3:
v4: bool = id notdone;
br v4 .for.body.3 .for.end.3;
.for.body.3:
v5: int = id n;
a: int = div v5 v1;
floor: int = mul a v1;
remainder: int = sub v5 floor;
result: int = mul result v1;
result: int = add result remainder;
n: int = id a;
comp1: bool = eq n v0;
br comp1 .if.body .for.incre;
.if.body:
notdone: bool = const false;
jmp .for.cond.3;
.for.incre:
jmp .for.cond.3;
.for.end.3:
print result;
}

1 change: 1 addition & 0 deletions benchmarks/core/reverse.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
321
1 change: 1 addition & 0 deletions benchmarks/core/reverse.prof
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
total_dyn_inst: 47