diff options
| author | Cliff Click <cliffc@acm.org> | 2026-11-15 11:20:40 -0800 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-11-15 11:20:40 -0800 |
| commit | f0a6c6757a795b8e186de0076836a87acef59fa7 (patch) | |
| tree | ef45c1b58093420bbd2de6647274139e46539bfe /chapter31/src/test/java/com/seaofnodes/simple/SchedulingTest.java | |
| parent | 7e66b7ae6b00a2e1652db32f01f0bf480508ef05 (diff) | |
| download | Simple-main.tar.gz Simple-main.zip | |
Graphics now allow resizemain
Reorganize docs.
Fix bugs X86 LOad+cmp scheduling.
Math intrinsics
Diffstat (limited to 'chapter31/src/test/java/com/seaofnodes/simple/SchedulingTest.java')
| -rw-r--r-- | chapter31/src/test/java/com/seaofnodes/simple/SchedulingTest.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/chapter31/src/test/java/com/seaofnodes/simple/SchedulingTest.java b/chapter31/src/test/java/com/seaofnodes/simple/SchedulingTest.java new file mode 100644 index 00000000..16e12b0f --- /dev/null +++ b/chapter31/src/test/java/com/seaofnodes/simple/SchedulingTest.java @@ -0,0 +1,47 @@ +package com.seaofnodes.simple; + +import org.junit.Test; + +public class SchedulingTest { + @Test public void nativeFoldedLoadsWithLaterOperands() throws Exception { + TestC.runSYS(""" + val compare_noInline={ i64[] a, int flag -> + i64 x=a[0]; + i64 y=flag ? a[1] : a[2]; + return x==y; + }; + val add_noInline={ i64[] a, int flag -> + i64 x=a[0]; + i64 y=flag ? a[1] : a[2]; + return x+y; + }; + val main={ -> + val a=new i64[3]; a[0]=17; a[1]=17; a[2]=23; + if(!compare_noInline(a,1) || compare_noInline(a,0)) return 1; + if(add_noInline(a,1)!=34 || add_noInline(a,0)!=40) return 2; + return 0; + }; + ""","scheduleLaterOperands","",-1); + } + + @Test public void nativeLoadsAcrossWrites() throws Exception { + TestC.runSYS(""" + val change_noInline={ i64[] a -> a[0]=a[1]; return a[0]; }; + val compare_noInline={ i64[] a -> + i64 x=a[0]; + return x==change_noInline(a); + }; + val add_noInline={ i64[] a -> + i64 x=a[0]; + return x+change_noInline(a); + }; + val main={ -> + val a=new i64[2]; a[0]=17; a[1]=23; + if(compare_noInline(a)) return 1; + a[0]=17; a[1]=29; + if(add_noInline(a)!=46) return 2; + return 0; + }; + ""","scheduleAcrossWrites","",-1); + } +} |
