hotspot/test/compiler/regalloc/TestVectorRegAlloc.java
author lana
Thu, 23 Feb 2017 17:30:12 +0000
changeset 44011 5eea3031ae7b
parent 41705 332239c052cc
permissions -rw-r--r--
Merge
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
 * @test
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    26
 * @bug 8131969
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 32398
diff changeset
    27
 * @summary assert in register allocation code when vector Phi for a loop is
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 32398
diff changeset
    28
 * processed because code assumes all inputs already processed
32398
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    29
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 32398
diff changeset
    30
 * @run main/othervm -Xbatch compiler.regalloc.TestVectorRegAlloc
32398
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
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 32398
diff changeset
    33
package compiler.regalloc;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 32398
diff changeset
    34
32398
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    35
public class TestVectorRegAlloc {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    36
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    37
    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
    38
    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
    39
        test_helper_i++;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    40
        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
    41
    }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    42
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    43
    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
    44
        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
    45
        while(test_helper()) {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    46
            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
    47
                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
    48
            }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    49
            // 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
    50
            // 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
    51
            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
    52
                double k;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    53
                if (flag) {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    54
                    k = j;
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    55
                } else {
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    56
                    k = 0;
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
                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
    59
            }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    60
            j++;
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
    }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    63
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    64
    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
    65
        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
    66
        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
    67
        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
    68
            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
    69
        }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    70
    }
eed59c1cd49b 8131969: jit/FloatingPoint/gen_math/Loops05 assert(2 <= size && size <= 16) failed: update low bits table
roland
parents:
diff changeset
    71
}