hotspot/test/compiler/regalloc/TestVectorRegAlloc.java
author stuefe
Thu, 28 Apr 2016 15:40:45 +0200
changeset 38215 fe1677e95252
parent 32398 eed59c1cd49b
child 40059 c2304140ed64
permissions -rw-r--r--
8155639: Remove STEP numbers from error reporting Reviewed-by: coleenp, twisti
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32398
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
     1
/*
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
     4
 *
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
     8
 *
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    13
 * accompanied this code).
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    14
 *
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    18
 *
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    21
 * questions.
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    22
 *
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    23
 */
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    24
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    25
/**
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    26
 * @test
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    27
 * @bug 8131969
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    28
 * @summary assert in register allocation code when vector Phi for a loop is processed because code assumes all inputs already processed
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    29
 * @run main/othervm -Xbatch TestVectorRegAlloc
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    30
 *
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    31
 */
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    32
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    33
public class TestVectorRegAlloc {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    34
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    35
    static int test_helper_i;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    36
    static boolean test_helper() {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    37
        test_helper_i++;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    38
        return (test_helper_i & 7) != 0;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    39
    }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    40
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    41
    static void test(double[] src, double[] dst, boolean flag) {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    42
        double j = 0.0;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    43
        while(test_helper()) {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    44
            for (int i = 0; i < src.length; i++) {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    45
                dst[i] = src[i] + j;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    46
            }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    47
            // Loop will be unswitched and ReplicateD of zero will be
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    48
            // split through the Phi of outer loop
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    49
            for (int i = 0; i < src.length; i++) {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    50
                double k;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    51
                if (flag) {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    52
                    k = j;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    53
                } else {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    54
                    k = 0;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    55
                }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    56
                dst[i] = src[i] + k;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    57
            }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    58
            j++;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    59
        }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    60
    }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    61
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    62
    static public void main(String[] args) {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    63
        double[] src = new double[10];
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    64
        double[] dst = new double[10];
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    65
        for (int i = 0; i < 20000; i++) {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    66
            test(src, dst, (i % 2) == 0);
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    67
        }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    68
    }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    69
}