summaryrefslogtreecommitdiff
path: root/chapter14/src/test/java/com/seaofnodes
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2024-09-05 09:03:15 -0700
committerThalia Archibald <thalia@archibald.dev>2024-09-07 10:54:48 -0700
commit489598387697dcefee1ec2aa5e356b3134722a9a (patch)
treeb2305cfa27fe19fef6b847c16664c89927a003af /chapter14/src/test/java/com/seaofnodes
parentb5294c3dae75a036c57278aa80f7928717a1e22c (diff)
downloadSimple-489598387697dcefee1ec2aa5e356b3134722a9a.tar.gz
Simple-489598387697dcefee1ec2aa5e356b3134722a9a.zip
And-masking sharpens narrowed ints
Needed to recognize narrowed expressions
Diffstat (limited to 'chapter14/src/test/java/com/seaofnodes')
-rw-r--r--chapter14/src/test/java/com/seaofnodes/simple/Chapter14Test.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/chapter14/src/test/java/com/seaofnodes/simple/Chapter14Test.java b/chapter14/src/test/java/com/seaofnodes/simple/Chapter14Test.java
index 682eff15..8b3c3c9a 100644
--- a/chapter14/src/test/java/com/seaofnodes/simple/Chapter14Test.java
+++ b/chapter14/src/test/java/com/seaofnodes/simple/Chapter14Test.java
@@ -49,6 +49,19 @@ return b;
assertEquals(67L, Evaluator.evaluate(stop, 0));
}
+
+ @Test
+ public void testU8While() {
+ Parser parser = new Parser(
+"""
+u8 b = 123;
+while( b ) b = b + 456;// Truncate
+return b;
+""");
+ StopNode stop = parser.parse(false).iterate(false);
+ assertEquals("return Phi(Loop9,123,((Phi_b+456)&255));", stop.toString());
+ }
+
@Test
public void testU1() {
Parser parser = new Parser(