-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
45 additions
and
2 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,40 @@ | ||
@main { | ||
pi: float = const 0; | ||
# denominator | ||
denom: float = const 1; | ||
is_even: bool = const false; | ||
i: int = const 1; | ||
end: int = const 1000000; | ||
|
||
.for.start: | ||
b: bool = lt i end; | ||
br b .for.body .for.end; | ||
|
||
.for.body: | ||
fone: float = const 1; | ||
br is_even .if.true .if.false; | ||
|
||
.if.true: | ||
f1: float = fdiv fone denom; | ||
pi: float = fsub pi f1; | ||
jmp .if.end; | ||
|
||
.if.false: | ||
f2: float = fdiv fone denom; | ||
pi: float = fadd pi f2; | ||
|
||
.if.end: | ||
two: float = const 2; | ||
denom: float= fadd denom two; | ||
|
||
# step | ||
is_even: bool = not is_even; | ||
one: int = const 1; | ||
i: int = add i one; | ||
jmp .for.start; | ||
|
||
.for.end: | ||
four: float = const 4; | ||
pi: float = fmul pi four; | ||
print pi; | ||
} |
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 @@ | ||
3.14159365359077425 |
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 @@ | ||
total_dyn_inst: 12499997 |
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