diff options
| author | Cliff Click <cliffc@acm.org> | 2026-08-10 11:11:18 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-11-15 11:20:40 -0800 |
| commit | 658289861e8d971cd9e449e66a749c9c2d65f623 (patch) | |
| tree | 209a32ef7fab1d27222121bc8b53a968ff4b6796 /src/test/java/com/seaofnodes/simple/SchedulingTest.java | |
| parent | 77ae05305a5653a2353709564705819f201e587f (diff) | |
| download | Simple-linear.tar.gz Simple-linear.zip | |
Chapter 31: Software Drawing, Time, and Graphical Gameslinear
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/SchedulingTest.java')
| -rw-r--r-- | src/test/java/com/seaofnodes/simple/SchedulingTest.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/test/java/com/seaofnodes/simple/SchedulingTest.java b/src/test/java/com/seaofnodes/simple/SchedulingTest.java new file mode 100644 index 00000000..16e12b0f --- /dev/null +++ b/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); + } +} |
