/* * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * @test * @bug 6340864 * @summary Implement vectorization optimizations in hotspot-server * * @run main/othervm -Xbatch -XX:CompileCommand=exclude,*::test() -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UseSignumIntrinsic compiler.c2.cr6340864.TestFloatVect * @run main/othervm -Xbatch -XX:CompileCommand=exclude,*::test() -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UseSignumIntrinsic -XX:MaxVectorSize=8 compiler.c2.cr6340864.TestFloatVect * @run main/othervm -Xbatch -XX:CompileCommand=exclude,*::test() -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UseSignumIntrinsic -XX:MaxVectorSize=16 compiler.c2.cr6340864.TestFloatVect * @run main/othervm -Xbatch -XX:CompileCommand=exclude,*::test() -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UseSignumIntrinsic -XX:MaxVectorSize=32 compiler.c2.cr6340864.TestFloatVect */ package compiler.c2.cr6340864; public class TestFloatVect { private static final int ARRLEN = 997; private static final int ITERS = 11000; private static final float ADD_INIT = -7500.f; private static final float VALUE = 15.f; public static void main(String args[]) { System.out.println("Testing Float vectors"); int errn = test(); if (errn > 0) { System.err.println("FAILED: " + errn + " errors"); System.exit(97); } System.out.println("PASSED"); } static int test() { float[] a0 = new float[ARRLEN]; int[] i0 = new int[ARRLEN]; float[] a1 = new float[ARRLEN]; float[] a2 = new float[ARRLEN]; float[] a3 = new float[ARRLEN]; // Initialize float gold_sum = 0; for (int i=0; i 0.0f ? 1.0f : -1.0f)); } a1[6] = +0x1.fffffep-2f; a1[7] = +0x1.0p-1f; a1[8] = +0x1.000002p-1f; a1[9] = -0x1.fffffep-2f; a1[10] = -0x1.0p-1f; a1[11] = -0x1.000002p-1f; a1[12] = 3.4028235E10f; a1[13] = -3.4028235E10f; test_round(i0, a1); errn += verify("test_round: ", 0, i0[0], 0); errn += verify("test_round: ", 1, i0[1], Integer.MAX_VALUE); errn += verify("test_round: ", 2, i0[2], Integer.MIN_VALUE); errn += verify("test_round: ", 3, i0[3], Integer.MAX_VALUE); errn += verify("test_round: ", 4, i0[4], 0); errn += verify("test_round: ", 5, i0[5], 0); errn += verify("test_round: ", 6, i0[6], 0); errn += verify("test_round: ", 7, i0[7], 1); errn += verify("test_round: ", 8, i0[8], 1); errn += verify("test_round: ", 9, i0[9], 0); errn += verify("test_round: ", 10, i0[10], 0); errn += verify("test_round: ", 11, i0[11], -1); errn += verify("test_round: ", 12, i0[12], Integer.MAX_VALUE); errn += verify("test_round: ", 13, i0[13], Integer.MIN_VALUE); for (int i=14; i 0) return errn; System.out.println("Time"); long start, end; start = System.currentTimeMillis(); for (int i=0; i