summaryrefslogtreecommitdiff
path: root/src/test/java/com/seaofnodes/simple/Chapter10Test.java
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-08-10 11:11:18 -0700
committerCliff Click <cliffc@acm.org>2026-11-16 16:23:52 -0800
commit0b263f550d5e54d050f58f6b315b092944c9eff9 (patch)
treeaff564cf11711c41a6f94f17ffbc480e1b228da1 /src/test/java/com/seaofnodes/simple/Chapter10Test.java
parent790268f4a1f6122376c34059f1633c1017436363 (diff)
downloadSimple-linear-chapter32.tar.gz
Simple-linear-chapter32.zip
Chapter 32: Compiler Internal Speedupslinear-chapter32linear
Co-authored-by: Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: fuhsnn <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: Symious <14933944+symious@users.noreply.github.com> Co-authored-by: Jun Kawasaki <jun784@gmail.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/test/java/com/seaofnodes/simple/Chapter10Test.java')
-rw-r--r--src/test/java/com/seaofnodes/simple/Chapter10Test.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/java/com/seaofnodes/simple/Chapter10Test.java b/src/test/java/com/seaofnodes/simple/Chapter10Test.java
index 559def2f..13950789 100644
--- a/src/test/java/com/seaofnodes/simple/Chapter10Test.java
+++ b/src/test/java/com/seaofnodes/simple/Chapter10Test.java
@@ -197,7 +197,9 @@ while (arg) {
return bar.a;
""");
code.driver(CodeGen.Phase.FinalizeIR);
- assertEquals("Stop[ return ((Phi(Loop,0,(Sar+2))<<32)>>32); return Test.Bar; ]", code.print());
+ assertEquals("Stop[ return Phi(Loop,0,(((Phi_a+2)<<32)>>32)); return Test.Bar; ]", code.print());
+ assertEquals("0",Eval2.eval(code,0));
+ assertEquals("6",Eval2.eval(code,-3));
}
@Test
@@ -319,7 +321,9 @@ while( i.x < i.len ) {
return sum;
""");
code.driver(CodeGen.Phase.FinalizeIR);
- assertEquals("Stop[ return Phi(Loop,0,(((Phi_sum+((Phi(Loop,0,(((Sar+1)<<32)>>32))<<32)>>32))<<32)>>32)); return Test.Iter; ]", code.print());
+ assertEquals("Stop[ return Phi(Loop,0,(((Phi_sum+((Phi(Loop,0,(Sar+1))<<32)>>32))<<32)>>32)); return Test.Iter; ]", code.print());
+ assertEquals("0",Eval2.eval(code,0));
+ assertEquals("45",Eval2.eval(code,10));
}