Path: blob/master/test/hotspot/jtreg/compiler/regalloc/TestVectorRegAlloc.java
41149 views
/*1* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 813196926* @summary assert in register allocation code when vector Phi for a loop is27* processed because code assumes all inputs already processed28*29* @run main/othervm -Xbatch compiler.regalloc.TestVectorRegAlloc30*/3132package compiler.regalloc;3334public class TestVectorRegAlloc {3536static int test_helper_i;37static boolean test_helper() {38test_helper_i++;39return (test_helper_i & 7) != 0;40}4142static void test(double[] src, double[] dst, boolean flag) {43double j = 0.0;44while(test_helper()) {45for (int i = 0; i < src.length; i++) {46dst[i] = src[i] + j;47}48// Loop will be unswitched and ReplicateD of zero will be49// split through the Phi of outer loop50for (int i = 0; i < src.length; i++) {51double k;52if (flag) {53k = j;54} else {55k = 0;56}57dst[i] = src[i] + k;58}59j++;60}61}6263static public void main(String[] args) {64double[] src = new double[10];65double[] dst = new double[10];66for (int i = 0; i < 20000; i++) {67test(src, dst, (i % 2) == 0);68}69}70}717273