From d08925c1ff212e2157356eacbd748e679b80954d Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Sat, 12 Apr 2025 11:41:58 -0700 Subject: 2 more encoding bugs Missing constant NIL, arm CAST --- .../src/test/java/com/seaofnodes/simple/Chapter21Test.java | 8 ++++++++ .../src/test/java/com/seaofnodes/simple/progs/antiDep1.smp | 11 +++++++++++ 2 files changed, 19 insertions(+) create mode 100644 chapter21/src/test/java/com/seaofnodes/simple/progs/antiDep1.smp (limited to 'chapter21/src/test/java/com') diff --git a/chapter21/src/test/java/com/seaofnodes/simple/Chapter21Test.java b/chapter21/src/test/java/com/seaofnodes/simple/Chapter21Test.java index 0610d294..e584f9bc 100644 --- a/chapter21/src/test/java/com/seaofnodes/simple/Chapter21Test.java +++ b/chapter21/src/test/java/com/seaofnodes/simple/Chapter21Test.java @@ -64,6 +64,14 @@ public class Chapter21Test { testCPU(src,"arm" , "SystemV",19,null); } + @Test + public void testAntiDeps1() throws IOException { + String src = Files.readString(Path.of("src/test/java/com/seaofnodes/simple/progs/antiDep1.smp")); + testCPU(src,"x86_64_v2", "SystemV", 3,"return mov(mov(S));"); + testCPU(src,"riscv" , "SystemV",10,"return mov(mov(S));"); + testCPU(src,"arm" , "SystemV",10,"return mov(mov(S));"); + } + @Test public void testNewtonExport() throws IOException { String result = """ 0 0.000000 diff --git a/chapter21/src/test/java/com/seaofnodes/simple/progs/antiDep1.smp b/chapter21/src/test/java/com/seaofnodes/simple/progs/antiDep1.smp new file mode 100644 index 00000000..b18dfd16 --- /dev/null +++ b/chapter21/src/test/java/com/seaofnodes/simple/progs/antiDep1.smp @@ -0,0 +1,11 @@ +// -*- mode: java; -*- +struct S { int f; }; +var v0 = new S; +S? v1; +if (arg) v1 = new S; +if (v1) { + v0.f = v1.f; +} else { + v0.f = 2; +} +return v0; -- cgit v1.2.3