Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.sl.test/tests/LoopCall.sl @ 17116:dced35fd40f7
[SPARC] fix the floatingpoint loading of constant +0.0 and -0.0, changed ArraysCompare more to the C2 implementation.
author | Stefan Anzinger <stefan.anzinger@oracle.com> |
---|---|
date | Tue, 16 Sep 2014 15:36:00 -0700 |
parents | afd6fa5e8229 |
children |
rev | line source |
---|---|
13836
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
1 function add(a, b) { |
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
2 return a + b; |
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
3 } |
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
4 |
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
5 function loop(n) { |
13882
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13836
diff
changeset
|
6 i = 0; |
13836
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
7 while (i < n) { |
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
8 i = add(i, 1); |
13882
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13836
diff
changeset
|
9 } |
13836
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
10 return i; |
13882
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13836
diff
changeset
|
11 } |
13836
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
12 |
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
13 function main() { |
13882
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13836
diff
changeset
|
14 i = 0; |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13836
diff
changeset
|
15 while (i < 20) { |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13836
diff
changeset
|
16 loop(1000); |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13836
diff
changeset
|
17 i = i + 1; |
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13836
diff
changeset
|
18 } |
13836
64c77f0577bb
More documentation and improvements of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
19 println(loop(1000)); |
13882
afd6fa5e8229
SL: Feedback from reviewers
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13836
diff
changeset
|
20 } |