8282432: Optimize masked "test" Vector API with predicate feature

Reviewed-by: psandoz
This commit is contained in:
Xiaohong Gong 2022-03-09 01:02:25 +00:00 committed by Ningsheng Jian
parent 49245131e9
commit 12693a6cf3
70 changed files with 1314 additions and 751 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Byte128Vector extends ByteVector {
return super.testTemplate(Byte128Mask.class, op); // specialize
}
@Override
@ForceInline
public final Byte128Mask test(Test op, VectorMask<Byte> m) {
return super.testTemplate(Byte128Mask.class, op, (Byte128Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Byte256Vector extends ByteVector {
return super.testTemplate(Byte256Mask.class, op); // specialize
}
@Override
@ForceInline
public final Byte256Mask test(Test op, VectorMask<Byte> m) {
return super.testTemplate(Byte256Mask.class, op, (Byte256Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Byte512Vector extends ByteVector {
return super.testTemplate(Byte512Mask.class, op); // specialize
}
@Override
@ForceInline
public final Byte512Mask test(Test op, VectorMask<Byte> m) {
return super.testTemplate(Byte512Mask.class, op, (Byte512Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Byte64Vector extends ByteVector {
return super.testTemplate(Byte64Mask.class, op); // specialize
}
@Override
@ForceInline
public final Byte64Mask test(Test op, VectorMask<Byte> m) {
return super.testTemplate(Byte64Mask.class, op, (Byte64Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class ByteMaxVector extends ByteVector {
return super.testTemplate(ByteMaxMask.class, op); // specialize
}
@Override
@ForceInline
public final ByteMaxMask test(Test op, VectorMask<Byte> m) {
return super.testTemplate(ByteMaxMask.class, op, (ByteMaxMask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -1855,12 +1855,11 @@ public abstract class ByteVector extends AbstractVector<Byte> {
M testTemplate(Class<M> maskType, Test op) {
ByteSpecies vsp = vspecies();
if (opKind(op, VO_SPECIAL)) {
ByteVector bits = this.viewAsIntegralLanes();
VectorMask<Byte> m;
if (op == IS_DEFAULT) {
m = bits.compare(EQ, (byte) 0);
m = compare(EQ, (byte) 0);
} else if (op == IS_NEGATIVE) {
m = bits.compare(LT, (byte) 0);
m = compare(LT, (byte) 0);
}
else {
throw new AssertionError(op);
@ -1875,11 +1874,31 @@ public abstract class ByteVector extends AbstractVector<Byte> {
* {@inheritDoc} <!--workaround-->
*/
@Override
@ForceInline
public final
public abstract
VectorMask<Byte> test(VectorOperators.Test op,
VectorMask<Byte> m) {
return test(op).and(m);
VectorMask<Byte> m);
/*package-private*/
@ForceInline
final
<M extends VectorMask<Byte>>
M testTemplate(Class<M> maskType, Test op, M mask) {
ByteSpecies vsp = vspecies();
mask.check(maskType, this);
if (opKind(op, VO_SPECIAL)) {
VectorMask<Byte> m = mask;
if (op == IS_DEFAULT) {
m = compare(EQ, (byte) 0, m);
} else if (op == IS_NEGATIVE) {
m = compare(LT, (byte) 0, m);
}
else {
throw new AssertionError(op);
}
return maskType.cast(m);
}
int opc = opCode(op);
throw new AssertionError(op);
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -357,6 +357,12 @@ final class Double128Vector extends DoubleVector {
return super.testTemplate(Double128Mask.class, op); // specialize
}
@Override
@ForceInline
public final Double128Mask test(Test op, VectorMask<Double> m) {
return super.testTemplate(Double128Mask.class, op, (Double128Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -357,6 +357,12 @@ final class Double256Vector extends DoubleVector {
return super.testTemplate(Double256Mask.class, op); // specialize
}
@Override
@ForceInline
public final Double256Mask test(Test op, VectorMask<Double> m) {
return super.testTemplate(Double256Mask.class, op, (Double256Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -357,6 +357,12 @@ final class Double512Vector extends DoubleVector {
return super.testTemplate(Double512Mask.class, op); // specialize
}
@Override
@ForceInline
public final Double512Mask test(Test op, VectorMask<Double> m) {
return super.testTemplate(Double512Mask.class, op, (Double512Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -357,6 +357,12 @@ final class Double64Vector extends DoubleVector {
return super.testTemplate(Double64Mask.class, op); // specialize
}
@Override
@ForceInline
public final Double64Mask test(Test op, VectorMask<Double> m) {
return super.testTemplate(Double64Mask.class, op, (Double64Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -357,6 +357,12 @@ final class DoubleMaxVector extends DoubleVector {
return super.testTemplate(DoubleMaxMask.class, op); // specialize
}
@Override
@ForceInline
public final DoubleMaxMask test(Test op, VectorMask<Double> m) {
return super.testTemplate(DoubleMaxMask.class, op, (DoubleMaxMask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -1715,7 +1715,7 @@ public abstract class DoubleVector extends AbstractVector<Double> {
else {
throw new AssertionError(op);
}
return maskType.cast(m.cast(this.vspecies()));
return maskType.cast(m.cast(vsp));
}
int opc = opCode(op);
throw new AssertionError(op);
@ -1725,11 +1725,48 @@ public abstract class DoubleVector extends AbstractVector<Double> {
* {@inheritDoc} <!--workaround-->
*/
@Override
@ForceInline
public final
public abstract
VectorMask<Double> test(VectorOperators.Test op,
VectorMask<Double> m) {
return test(op).and(m);
VectorMask<Double> m);
/*package-private*/
@ForceInline
final
<M extends VectorMask<Double>>
M testTemplate(Class<M> maskType, Test op, M mask) {
DoubleSpecies vsp = vspecies();
mask.check(maskType, this);
if (opKind(op, VO_SPECIAL)) {
LongVector bits = this.viewAsIntegralLanes();
VectorMask<Long> m = mask.cast(LongVector.species(shape()));
if (op == IS_DEFAULT) {
m = bits.compare(EQ, (long) 0, m);
} else if (op == IS_NEGATIVE) {
m = bits.compare(LT, (long) 0, m);
}
else if (op == IS_FINITE ||
op == IS_NAN ||
op == IS_INFINITE) {
// first kill the sign:
bits = bits.and(Long.MAX_VALUE);
// next find the bit pattern for infinity:
long infbits = (long) toBits(Double.POSITIVE_INFINITY);
// now compare:
if (op == IS_FINITE) {
m = bits.compare(LT, infbits, m);
} else if (op == IS_NAN) {
m = bits.compare(GT, infbits, m);
} else {
m = bits.compare(EQ, infbits, m);
}
}
else {
throw new AssertionError(op);
}
return maskType.cast(m.cast(vsp));
}
int opc = opCode(op);
throw new AssertionError(op);
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -357,6 +357,12 @@ final class Float128Vector extends FloatVector {
return super.testTemplate(Float128Mask.class, op); // specialize
}
@Override
@ForceInline
public final Float128Mask test(Test op, VectorMask<Float> m) {
return super.testTemplate(Float128Mask.class, op, (Float128Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -357,6 +357,12 @@ final class Float256Vector extends FloatVector {
return super.testTemplate(Float256Mask.class, op); // specialize
}
@Override
@ForceInline
public final Float256Mask test(Test op, VectorMask<Float> m) {
return super.testTemplate(Float256Mask.class, op, (Float256Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -357,6 +357,12 @@ final class Float512Vector extends FloatVector {
return super.testTemplate(Float512Mask.class, op); // specialize
}
@Override
@ForceInline
public final Float512Mask test(Test op, VectorMask<Float> m) {
return super.testTemplate(Float512Mask.class, op, (Float512Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -357,6 +357,12 @@ final class Float64Vector extends FloatVector {
return super.testTemplate(Float64Mask.class, op); // specialize
}
@Override
@ForceInline
public final Float64Mask test(Test op, VectorMask<Float> m) {
return super.testTemplate(Float64Mask.class, op, (Float64Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -357,6 +357,12 @@ final class FloatMaxVector extends FloatVector {
return super.testTemplate(FloatMaxMask.class, op); // specialize
}
@Override
@ForceInline
public final FloatMaxMask test(Test op, VectorMask<Float> m) {
return super.testTemplate(FloatMaxMask.class, op, (FloatMaxMask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -1727,7 +1727,7 @@ public abstract class FloatVector extends AbstractVector<Float> {
else {
throw new AssertionError(op);
}
return maskType.cast(m.cast(this.vspecies()));
return maskType.cast(m.cast(vsp));
}
int opc = opCode(op);
throw new AssertionError(op);
@ -1737,11 +1737,48 @@ public abstract class FloatVector extends AbstractVector<Float> {
* {@inheritDoc} <!--workaround-->
*/
@Override
@ForceInline
public final
public abstract
VectorMask<Float> test(VectorOperators.Test op,
VectorMask<Float> m) {
return test(op).and(m);
VectorMask<Float> m);
/*package-private*/
@ForceInline
final
<M extends VectorMask<Float>>
M testTemplate(Class<M> maskType, Test op, M mask) {
FloatSpecies vsp = vspecies();
mask.check(maskType, this);
if (opKind(op, VO_SPECIAL)) {
IntVector bits = this.viewAsIntegralLanes();
VectorMask<Integer> m = mask.cast(IntVector.species(shape()));
if (op == IS_DEFAULT) {
m = bits.compare(EQ, (int) 0, m);
} else if (op == IS_NEGATIVE) {
m = bits.compare(LT, (int) 0, m);
}
else if (op == IS_FINITE ||
op == IS_NAN ||
op == IS_INFINITE) {
// first kill the sign:
bits = bits.and(Integer.MAX_VALUE);
// next find the bit pattern for infinity:
int infbits = (int) toBits(Float.POSITIVE_INFINITY);
// now compare:
if (op == IS_FINITE) {
m = bits.compare(LT, infbits, m);
} else if (op == IS_NAN) {
m = bits.compare(GT, infbits, m);
} else {
m = bits.compare(EQ, infbits, m);
}
}
else {
throw new AssertionError(op);
}
return maskType.cast(m.cast(vsp));
}
int opc = opCode(op);
throw new AssertionError(op);
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Int128Vector extends IntVector {
return super.testTemplate(Int128Mask.class, op); // specialize
}
@Override
@ForceInline
public final Int128Mask test(Test op, VectorMask<Integer> m) {
return super.testTemplate(Int128Mask.class, op, (Int128Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Int256Vector extends IntVector {
return super.testTemplate(Int256Mask.class, op); // specialize
}
@Override
@ForceInline
public final Int256Mask test(Test op, VectorMask<Integer> m) {
return super.testTemplate(Int256Mask.class, op, (Int256Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Int512Vector extends IntVector {
return super.testTemplate(Int512Mask.class, op); // specialize
}
@Override
@ForceInline
public final Int512Mask test(Test op, VectorMask<Integer> m) {
return super.testTemplate(Int512Mask.class, op, (Int512Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Int64Vector extends IntVector {
return super.testTemplate(Int64Mask.class, op); // specialize
}
@Override
@ForceInline
public final Int64Mask test(Test op, VectorMask<Integer> m) {
return super.testTemplate(Int64Mask.class, op, (Int64Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class IntMaxVector extends IntVector {
return super.testTemplate(IntMaxMask.class, op); // specialize
}
@Override
@ForceInline
public final IntMaxMask test(Test op, VectorMask<Integer> m) {
return super.testTemplate(IntMaxMask.class, op, (IntMaxMask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -1854,12 +1854,11 @@ public abstract class IntVector extends AbstractVector<Integer> {
M testTemplate(Class<M> maskType, Test op) {
IntSpecies vsp = vspecies();
if (opKind(op, VO_SPECIAL)) {
IntVector bits = this.viewAsIntegralLanes();
VectorMask<Integer> m;
if (op == IS_DEFAULT) {
m = bits.compare(EQ, (int) 0);
m = compare(EQ, (int) 0);
} else if (op == IS_NEGATIVE) {
m = bits.compare(LT, (int) 0);
m = compare(LT, (int) 0);
}
else {
throw new AssertionError(op);
@ -1874,11 +1873,31 @@ public abstract class IntVector extends AbstractVector<Integer> {
* {@inheritDoc} <!--workaround-->
*/
@Override
@ForceInline
public final
public abstract
VectorMask<Integer> test(VectorOperators.Test op,
VectorMask<Integer> m) {
return test(op).and(m);
VectorMask<Integer> m);
/*package-private*/
@ForceInline
final
<M extends VectorMask<Integer>>
M testTemplate(Class<M> maskType, Test op, M mask) {
IntSpecies vsp = vspecies();
mask.check(maskType, this);
if (opKind(op, VO_SPECIAL)) {
VectorMask<Integer> m = mask;
if (op == IS_DEFAULT) {
m = compare(EQ, (int) 0, m);
} else if (op == IS_NEGATIVE) {
m = compare(LT, (int) 0, m);
}
else {
throw new AssertionError(op);
}
return maskType.cast(m);
}
int opc = opCode(op);
throw new AssertionError(op);
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -365,6 +365,12 @@ final class Long128Vector extends LongVector {
return super.testTemplate(Long128Mask.class, op); // specialize
}
@Override
@ForceInline
public final Long128Mask test(Test op, VectorMask<Long> m) {
return super.testTemplate(Long128Mask.class, op, (Long128Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -365,6 +365,12 @@ final class Long256Vector extends LongVector {
return super.testTemplate(Long256Mask.class, op); // specialize
}
@Override
@ForceInline
public final Long256Mask test(Test op, VectorMask<Long> m) {
return super.testTemplate(Long256Mask.class, op, (Long256Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -365,6 +365,12 @@ final class Long512Vector extends LongVector {
return super.testTemplate(Long512Mask.class, op); // specialize
}
@Override
@ForceInline
public final Long512Mask test(Test op, VectorMask<Long> m) {
return super.testTemplate(Long512Mask.class, op, (Long512Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -365,6 +365,12 @@ final class Long64Vector extends LongVector {
return super.testTemplate(Long64Mask.class, op); // specialize
}
@Override
@ForceInline
public final Long64Mask test(Test op, VectorMask<Long> m) {
return super.testTemplate(Long64Mask.class, op, (Long64Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -365,6 +365,12 @@ final class LongMaxVector extends LongVector {
return super.testTemplate(LongMaxMask.class, op); // specialize
}
@Override
@ForceInline
public final LongMaxMask test(Test op, VectorMask<Long> m) {
return super.testTemplate(LongMaxMask.class, op, (LongMaxMask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -1767,12 +1767,11 @@ public abstract class LongVector extends AbstractVector<Long> {
M testTemplate(Class<M> maskType, Test op) {
LongSpecies vsp = vspecies();
if (opKind(op, VO_SPECIAL)) {
LongVector bits = this.viewAsIntegralLanes();
VectorMask<Long> m;
if (op == IS_DEFAULT) {
m = bits.compare(EQ, (long) 0);
m = compare(EQ, (long) 0);
} else if (op == IS_NEGATIVE) {
m = bits.compare(LT, (long) 0);
m = compare(LT, (long) 0);
}
else {
throw new AssertionError(op);
@ -1787,11 +1786,31 @@ public abstract class LongVector extends AbstractVector<Long> {
* {@inheritDoc} <!--workaround-->
*/
@Override
@ForceInline
public final
public abstract
VectorMask<Long> test(VectorOperators.Test op,
VectorMask<Long> m) {
return test(op).and(m);
VectorMask<Long> m);
/*package-private*/
@ForceInline
final
<M extends VectorMask<Long>>
M testTemplate(Class<M> maskType, Test op, M mask) {
LongSpecies vsp = vspecies();
mask.check(maskType, this);
if (opKind(op, VO_SPECIAL)) {
VectorMask<Long> m = mask;
if (op == IS_DEFAULT) {
m = compare(EQ, (long) 0, m);
} else if (op == IS_NEGATIVE) {
m = compare(LT, (long) 0, m);
}
else {
throw new AssertionError(op);
}
return maskType.cast(m);
}
int opc = opCode(op);
throw new AssertionError(op);
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Short128Vector extends ShortVector {
return super.testTemplate(Short128Mask.class, op); // specialize
}
@Override
@ForceInline
public final Short128Mask test(Test op, VectorMask<Short> m) {
return super.testTemplate(Short128Mask.class, op, (Short128Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Short256Vector extends ShortVector {
return super.testTemplate(Short256Mask.class, op); // specialize
}
@Override
@ForceInline
public final Short256Mask test(Test op, VectorMask<Short> m) {
return super.testTemplate(Short256Mask.class, op, (Short256Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Short512Vector extends ShortVector {
return super.testTemplate(Short512Mask.class, op); // specialize
}
@Override
@ForceInline
public final Short512Mask test(Test op, VectorMask<Short> m) {
return super.testTemplate(Short512Mask.class, op, (Short512Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class Short64Vector extends ShortVector {
return super.testTemplate(Short64Mask.class, op); // specialize
}
@Override
@ForceInline
public final Short64Mask test(Test op, VectorMask<Short> m) {
return super.testTemplate(Short64Mask.class, op, (Short64Mask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -370,6 +370,12 @@ final class ShortMaxVector extends ShortVector {
return super.testTemplate(ShortMaxMask.class, op); // specialize
}
@Override
@ForceInline
public final ShortMaxMask test(Test op, VectorMask<Short> m) {
return super.testTemplate(ShortMaxMask.class, op, (ShortMaxMask) m); // specialize
}
// Specialized comparisons
@Override

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -1855,12 +1855,11 @@ public abstract class ShortVector extends AbstractVector<Short> {
M testTemplate(Class<M> maskType, Test op) {
ShortSpecies vsp = vspecies();
if (opKind(op, VO_SPECIAL)) {
ShortVector bits = this.viewAsIntegralLanes();
VectorMask<Short> m;
if (op == IS_DEFAULT) {
m = bits.compare(EQ, (short) 0);
m = compare(EQ, (short) 0);
} else if (op == IS_NEGATIVE) {
m = bits.compare(LT, (short) 0);
m = compare(LT, (short) 0);
}
else {
throw new AssertionError(op);
@ -1875,11 +1874,31 @@ public abstract class ShortVector extends AbstractVector<Short> {
* {@inheritDoc} <!--workaround-->
*/
@Override
@ForceInline
public final
public abstract
VectorMask<Short> test(VectorOperators.Test op,
VectorMask<Short> m) {
return test(op).and(m);
VectorMask<Short> m);
/*package-private*/
@ForceInline
final
<M extends VectorMask<Short>>
M testTemplate(Class<M> maskType, Test op, M mask) {
ShortSpecies vsp = vspecies();
mask.check(maskType, this);
if (opKind(op, VO_SPECIAL)) {
VectorMask<Short> m = mask;
if (op == IS_DEFAULT) {
m = compare(EQ, (short) 0, m);
} else if (op == IS_NEGATIVE) {
m = compare(LT, (short) 0, m);
}
else {
throw new AssertionError(op);
}
return maskType.cast(m);
}
int opc = opCode(op);
throw new AssertionError(op);
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -2128,12 +2128,14 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
M testTemplate(Class<M> maskType, Test op) {
$Type$Species vsp = vspecies();
if (opKind(op, VO_SPECIAL)) {
#if[FP]
$Bitstype$Vector bits = this.viewAsIntegralLanes();
#end[FP]
VectorMask<$Boxbitstype$> m;
if (op == IS_DEFAULT) {
m = bits.compare(EQ, ($bitstype$) 0);
m = {#if[FP]?bits.}compare(EQ, ($bitstype$) 0);
} else if (op == IS_NEGATIVE) {
m = bits.compare(LT, ($bitstype$) 0);
m = {#if[FP]?bits.}compare(LT, ($bitstype$) 0);
}
#if[FP]
else if (op == IS_FINITE ||
@ -2156,7 +2158,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
else {
throw new AssertionError(op);
}
return maskType.cast(m{#if[FP]?.cast(this.vspecies())});
return maskType.cast(m{#if[FP]?.cast(vsp)});
}
int opc = opCode(op);
throw new AssertionError(op);
@ -2166,11 +2168,54 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
* {@inheritDoc} <!--workaround-->
*/
@Override
@ForceInline
public final
public abstract
VectorMask<$Boxtype$> test(VectorOperators.Test op,
VectorMask<$Boxtype$> m) {
return test(op).and(m);
VectorMask<$Boxtype$> m);
/*package-private*/
@ForceInline
final
<M extends VectorMask<$Boxtype$>>
M testTemplate(Class<M> maskType, Test op, M mask) {
$Type$Species vsp = vspecies();
mask.check(maskType, this);
if (opKind(op, VO_SPECIAL)) {
#if[FP]
$Bitstype$Vector bits = this.viewAsIntegralLanes();
VectorMask<$Boxbitstype$> m = mask.cast($Bitstype$Vector.species(shape()));
#else[FP]
VectorMask<$Boxbitstype$> m = mask;
#end[FP]
if (op == IS_DEFAULT) {
m = {#if[FP]?bits.}compare(EQ, ($bitstype$) 0, m);
} else if (op == IS_NEGATIVE) {
m = {#if[FP]?bits.}compare(LT, ($bitstype$) 0, m);
}
#if[FP]
else if (op == IS_FINITE ||
op == IS_NAN ||
op == IS_INFINITE) {
// first kill the sign:
bits = bits.and($Boxbitstype$.MAX_VALUE);
// next find the bit pattern for infinity:
$bitstype$ infbits = ($bitstype$) toBits($Boxtype$.POSITIVE_INFINITY);
// now compare:
if (op == IS_FINITE) {
m = bits.compare(LT, infbits, m);
} else if (op == IS_NAN) {
m = bits.compare(GT, infbits, m);
} else {
m = bits.compare(EQ, infbits, m);
}
}
#end[FP]
else {
throw new AssertionError(op);
}
return maskType.cast(m{#if[FP]?.cast(vsp)});
}
int opc = opCode(op);
throw new AssertionError(op);
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -374,6 +374,12 @@ final class $vectortype$ extends $abstractvectortype$ {
return super.testTemplate($masktype$.class, op); // specialize
}
@Override
@ForceInline
public final $masktype$ test(Test op, VectorMask<$Boxtype$> m) {
return super.testTemplate($masktype$.class, op, ($masktype$) m); // specialize
}
// Specialized comparisons
@Override