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

adding squares of even and odd numbers.txt #337

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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/addsqevenodd.bril
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@main {
sum_even: int = const 0;
sum_odd: int = const 0;
i: int = const 1;
limit: int = const 10;
one: int = const 1;
two: int = const 2;

.loop:
square: int = mul i i;
half: int = div i two;
check: int = mul half two;
is_even: bool = eq check i;
br is_even .even_case .odd_case;

.even_case:
sum_even: int = add sum_even square;
jmp .increment;

.odd_case:
sum_odd: int = add sum_odd square;

.increment:
i: int = add i one;
cond: bool = le i limit;
br cond .loop .exit;

.exit:
print sum_even;
print sum_odd;
}
2 changes: 2 additions & 0 deletions benchmarks/core/addsqevenodd.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
220
165
1 change: 1 addition & 0 deletions benchmarks/core/addsqevenodd.prof
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
total_dyn_inst: 103