mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-14 18:03:44 +00:00
8367333: C2: Vector math operation intrinsification failure
Reviewed-by: epeter, shade, jbhateja
This commit is contained in:
parent
919f5faa46
commit
aa36799acb
@ -592,6 +592,25 @@ int VectorSupport::vop2ideal(jint id, BasicType bt) {
|
||||
break;
|
||||
}
|
||||
|
||||
case VECTOR_OP_TAN: // fall-through
|
||||
case VECTOR_OP_TANH: // fall-through
|
||||
case VECTOR_OP_SIN: // fall-through
|
||||
case VECTOR_OP_SINH: // fall-through
|
||||
case VECTOR_OP_COS: // fall-through
|
||||
case VECTOR_OP_COSH: // fall-through
|
||||
case VECTOR_OP_ASIN: // fall-through
|
||||
case VECTOR_OP_ACOS: // fall-through
|
||||
case VECTOR_OP_ATAN: // fall-through
|
||||
case VECTOR_OP_ATAN2: // fall-through
|
||||
case VECTOR_OP_CBRT: // fall-through
|
||||
case VECTOR_OP_LOG: // fall-through
|
||||
case VECTOR_OP_LOG10: // fall-through
|
||||
case VECTOR_OP_LOG1P: // fall-through
|
||||
case VECTOR_OP_POW: // fall-through
|
||||
case VECTOR_OP_EXP: // fall-through
|
||||
case VECTOR_OP_EXPM1: // fall-through
|
||||
case VECTOR_OP_HYPOT: return 0; // not supported; should be handled in Java code
|
||||
|
||||
default: fatal("unknown op: %d", vop);
|
||||
}
|
||||
return 0; // Unimplemented
|
||||
|
||||
@ -101,6 +101,25 @@ class VectorSupport : AllStatic {
|
||||
VECTOR_OP_COMPRESS_BITS = 33,
|
||||
VECTOR_OP_EXPAND_BITS = 34,
|
||||
|
||||
VECTOR_OP_TAN = 101,
|
||||
VECTOR_OP_TANH = 102,
|
||||
VECTOR_OP_SIN = 103,
|
||||
VECTOR_OP_SINH = 104,
|
||||
VECTOR_OP_COS = 105,
|
||||
VECTOR_OP_COSH = 106,
|
||||
VECTOR_OP_ASIN = 107,
|
||||
VECTOR_OP_ACOS = 108,
|
||||
VECTOR_OP_ATAN = 109,
|
||||
VECTOR_OP_ATAN2 = 110,
|
||||
VECTOR_OP_CBRT = 111,
|
||||
VECTOR_OP_LOG = 112,
|
||||
VECTOR_OP_LOG10 = 113,
|
||||
VECTOR_OP_LOG1P = 114,
|
||||
VECTOR_OP_POW = 115,
|
||||
VECTOR_OP_EXP = 116,
|
||||
VECTOR_OP_EXPM1 = 117,
|
||||
VECTOR_OP_HYPOT = 118,
|
||||
|
||||
VECTOR_OP_SADD = 119,
|
||||
VECTOR_OP_SSUB = 120,
|
||||
VECTOR_OP_SUADD = 121,
|
||||
|
||||
129
test/hotspot/jtreg/compiler/vectorapi/TestVectorMathLib.java
Normal file
129
test/hotspot/jtreg/compiler/vectorapi/TestVectorMathLib.java
Normal file
@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (c) 2025, 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.
|
||||
*/
|
||||
|
||||
package compiler.vectorapi;
|
||||
|
||||
import jdk.incubator.vector.FloatVector;
|
||||
import jdk.incubator.vector.VectorOperators;
|
||||
import jdk.incubator.vector.VectorSpecies;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8367333
|
||||
* @requires vm.compiler2.enabled
|
||||
* @modules jdk.incubator.vector
|
||||
* @library /test/lib
|
||||
*
|
||||
* @run main/othervm -Xbatch -XX:-TieredCompilation -XX:+StressIncrementalInlining -XX:CompileCommand=quiet
|
||||
* -XX:CompileCommand=compileonly,compiler.vectorapi.TestVectorMathLib::test*
|
||||
* compiler.vectorapi.TestVectorMathLib
|
||||
*/
|
||||
|
||||
public class TestVectorMathLib {
|
||||
private static final VectorSpecies SPECIES = FloatVector.SPECIES_PREFERRED;
|
||||
|
||||
static FloatVector testTAN(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.TAN);
|
||||
}
|
||||
static FloatVector testTANH(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.TANH);
|
||||
}
|
||||
static FloatVector testSIN(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.SIN);
|
||||
}
|
||||
static FloatVector testSINH(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.SINH);
|
||||
}
|
||||
static FloatVector testCOS(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.COS);
|
||||
}
|
||||
static FloatVector testCOSH(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.COSH);
|
||||
}
|
||||
static FloatVector testASIN(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.ASIN);
|
||||
}
|
||||
static FloatVector testACOS(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.ACOS);
|
||||
}
|
||||
static FloatVector testATAN(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.ATAN);
|
||||
}
|
||||
static FloatVector testATAN2(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.ATAN2, fv);
|
||||
}
|
||||
static FloatVector testCBRT(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.CBRT);
|
||||
}
|
||||
static FloatVector testLOG(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.LOG);
|
||||
}
|
||||
static FloatVector testLOG10(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.LOG10);
|
||||
}
|
||||
static FloatVector testLOG1P(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.LOG1P);
|
||||
}
|
||||
static FloatVector testPOW(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.POW, fv);
|
||||
}
|
||||
static FloatVector testEXP(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.EXP);
|
||||
}
|
||||
static FloatVector testEXPM1(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.EXPM1);
|
||||
}
|
||||
static FloatVector testHYPOT(FloatVector fv) {
|
||||
return fv.lanewise(VectorOperators.HYPOT, fv);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
FloatVector z = FloatVector.zero(SPECIES);
|
||||
for (int i = 0; i < 20_000; i++) {
|
||||
z.neg(); // unary
|
||||
z.add(z); // binary
|
||||
|
||||
testTAN(z);
|
||||
testTANH(z);
|
||||
testSIN(z);
|
||||
testSINH(z);
|
||||
testCOS(z);
|
||||
testCOSH(z);
|
||||
testASIN(z);
|
||||
testACOS(z);
|
||||
testATAN(z);
|
||||
testATAN2(z);
|
||||
testCBRT(z);
|
||||
testLOG(z);
|
||||
testLOG10(z);
|
||||
testLOG1P(z);
|
||||
testPOW(z);
|
||||
testEXP(z);
|
||||
testEXPM1(z);
|
||||
testHYPOT(z);
|
||||
}
|
||||
|
||||
System.out.println("TEST PASSED");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user