< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop.test/src/org/graalvm/compiler/loop/test/LoopPartialUnrollTest.java

Print this page
rev 56282 : [mq]: graal


 126         int b = 0;
 127         int c = 0;
 128 
 129         for (int i = 0; branchProbability(0.99, i < iterations); i += 2) {
 130             int t1 = volatileInt;
 131             int t2 = a + b;
 132             c = b;
 133             b = a;
 134             a = t1 + t2;
 135             t1 = volatileInt;
 136             t2 = a + b;
 137             c = b;
 138             b = a;
 139             a = t1 + t2;
 140         }
 141 
 142         return c;
 143     }
 144 
 145     @Test





























 146     public void testLoopCarried2() {
 147         for (int i = -1; i < 64; i++) {
 148             for (int j = -1; j < 64; j++) {
 149                 test("testLoopCarried2Snippet", i, j);
 150             }
 151         }
 152         test("testLoopCarried2Snippet", Integer.MAX_VALUE - 32, Integer.MAX_VALUE);
 153         test("testLoopCarried2Snippet", Integer.MAX_VALUE - 4, Integer.MAX_VALUE);
 154         test("testLoopCarried2Snippet", Integer.MAX_VALUE, 0);
 155         test("testLoopCarried2Snippet", Integer.MIN_VALUE, Integer.MIN_VALUE + 32);
 156         test("testLoopCarried2Snippet", Integer.MIN_VALUE, Integer.MIN_VALUE + 4);
 157         test("testLoopCarried2Snippet", 0, Integer.MIN_VALUE);
 158     }
 159 
 160     public static int testLoopCarried2Snippet(int start, int end) {
 161         int a = 0;
 162         int b = 0;
 163         int c = 0;
 164 
 165         for (int i = start; branchProbability(0.99, i < end); i++) {




 126         int b = 0;
 127         int c = 0;
 128 
 129         for (int i = 0; branchProbability(0.99, i < iterations); i += 2) {
 130             int t1 = volatileInt;
 131             int t2 = a + b;
 132             c = b;
 133             b = a;
 134             a = t1 + t2;
 135             t1 = volatileInt;
 136             t2 = a + b;
 137             c = b;
 138             b = a;
 139             a = t1 + t2;
 140         }
 141 
 142         return c;
 143     }
 144 
 145     @Test
 146     @Ignore
 147     public void testUnsignedLoopCarried() {
 148         for (int i = -1; i < 64; i++) {
 149             for (int j = 0; j < 64; j++) {
 150                 test("testUnsignedLoopCarriedSnippet", i, j);
 151             }
 152         }
 153         test("testUnsignedLoopCarriedSnippet", -1 - 32, -1);
 154         test("testUnsignedLoopCarriedSnippet", -1 - 4, -1);
 155         test("testUnsignedLoopCarriedSnippet", -1 - 32, 0);
 156     }
 157 
 158     public static int testUnsignedLoopCarriedSnippet(int start, int end) {
 159         int a = 0;
 160         int b = 0;
 161         int c = 0;
 162 
 163         for (int i = start; branchProbability(0.99, Integer.compareUnsigned(i, end) < 0); i++) {
 164             int t1 = volatileInt;
 165             int t2 = a + b;
 166             c = b;
 167             b = a;
 168             a = t1 + t2;
 169         }
 170 
 171         return c;
 172     }
 173 
 174     @Test
 175     public void testLoopCarried2() {
 176         for (int i = -1; i < 64; i++) {
 177             for (int j = -1; j < 64; j++) {
 178                 test("testLoopCarried2Snippet", i, j);
 179             }
 180         }
 181         test("testLoopCarried2Snippet", Integer.MAX_VALUE - 32, Integer.MAX_VALUE);
 182         test("testLoopCarried2Snippet", Integer.MAX_VALUE - 4, Integer.MAX_VALUE);
 183         test("testLoopCarried2Snippet", Integer.MAX_VALUE, 0);
 184         test("testLoopCarried2Snippet", Integer.MIN_VALUE, Integer.MIN_VALUE + 32);
 185         test("testLoopCarried2Snippet", Integer.MIN_VALUE, Integer.MIN_VALUE + 4);
 186         test("testLoopCarried2Snippet", 0, Integer.MIN_VALUE);
 187     }
 188 
 189     public static int testLoopCarried2Snippet(int start, int end) {
 190         int a = 0;
 191         int b = 0;
 192         int c = 0;
 193 
 194         for (int i = start; branchProbability(0.99, i < end); i++) {


< prev index next >