Skip to content

Commit d066dd4

Browse files
committed
[GR-64794] Vector API: Implement Vector::compress/expand
PullRequest: graal/21050
2 parents 9227013 + 266aa4f commit d066dd4

15 files changed

+577
-3
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/asm/amd64/AMD64Assembler.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,7 @@ private enum EVEXFeatureAssertion {
12391239
AVX512F_DQ_512(null, null, EnumSet.of(AVX512F, AVX512DQ)),
12401240
AVX512F_512(null, null, EnumSet.of(AVX512F)),
12411241
AVX512_VBMI_VL(EnumSet.of(CPUFeature.AVX512_VBMI, CPUFeature.AVX512VL), EnumSet.of(CPUFeature.AVX512_VBMI, CPUFeature.AVX512VL), EnumSet.of(CPUFeature.AVX512_VBMI)),
1242+
AVX512_VBMI2_VL(EnumSet.of(CPUFeature.AVX512_VBMI2, CPUFeature.AVX512VL), EnumSet.of(CPUFeature.AVX512_VBMI2, CPUFeature.AVX512VL), EnumSet.of(CPUFeature.AVX512_VBMI2)),
12421243
CLMUL_AVX512F_VL(EnumSet.of(CPUFeature.AVX512VL, CPUFeature.CLMUL), EnumSet.of(CPUFeature.AVX512VL, CPUFeature.CLMUL), EnumSet.of(CPUFeature.AVX512F, CPUFeature.CLMUL)),
12431244
GFNI_AVX512F_VL(EnumSet.of(CPUFeature.AVX512VL, CPUFeature.GFNI), EnumSet.of(CPUFeature.AVX512VL, CPUFeature.GFNI), EnumSet.of(CPUFeature.AVX512F, CPUFeature.GFNI));
12441245

@@ -1338,6 +1339,7 @@ private enum VEXOpAssertion {
13381339
AVX512F_512ONLY(null, EVEXFeatureAssertion.AVX512F_512, XMM, XMM, XMM),
13391340
AVX512DQ_512ONLY(null, EVEXFeatureAssertion.AVX512F_DQ_512, XMM, XMM, XMM),
13401341
AVX512_VBMI_VL(null, EVEXFeatureAssertion.AVX512_VBMI_VL, XMM, XMM, XMM),
1342+
AVX512_VBMI2_VL(null, EVEXFeatureAssertion.AVX512_VBMI2_VL, XMM, XMM, XMM),
13411343

13421344
AVX512F_CPU_OR_MASK(VEXFeatureAssertion.AVX512F_L0, null, CPU_OR_MASK, null, CPU_OR_MASK),
13431345
AVX512BW_CPU_OR_MASK(VEXFeatureAssertion.AVX512BW_L0, null, CPU_OR_MASK, null, CPU_OR_MASK),
@@ -1398,6 +1400,7 @@ public enum VectorFeatureAssertion {
13981400
AVX512F_VL(VEXOpAssertion.AVX512F_VL),
13991401
AVX512BW_VL(VEXOpAssertion.AVX512BW_VL),
14001402
AVX512DQ_VL(VEXOpAssertion.AVX512DQ_VL),
1403+
AVX512_VBMI2_VL(VEXOpAssertion.AVX512_VBMI2_VL),
14011404
FMA(VEXOpAssertion.FMA);
14021405

14031406
private final VEXOpAssertion opAssertion;
@@ -1722,6 +1725,10 @@ public static class VexRMOp extends VexRROp {
17221725
public static final VexRMOp EVPABSQ = new VexRMOp("EVPABSQ", VEXPrefixConfig.P_66, VEXPrefixConfig.M_0F38, VEXPrefixConfig.WIG, 0x1F, VEXOpAssertion.AVX512F_VL, EVEXTuple.FVM, VEXPrefixConfig.W1, true);
17231726
public static final VexRMOp EVCVTPH2PS = new VexRMOp("EVCVTPH2PS", VCVTPH2PS);
17241727

1728+
public static final VexRMOp EVPEXPANDB = new VexRMOp("EVPEXPANDB", VEXPrefixConfig.P_66, VEXPrefixConfig.M_0F38, VEXPrefixConfig.W0, 0x62, VEXOpAssertion.AVX512_VBMI2_VL, EVEXTuple.T1S_8BIT, VEXPrefixConfig.W0, true);
1729+
public static final VexRMOp EVPEXPANDW = new VexRMOp("EVPEXPANDW", VEXPrefixConfig.P_66, VEXPrefixConfig.M_0F38, VEXPrefixConfig.W1, 0x62, VEXOpAssertion.AVX512_VBMI2_VL, EVEXTuple.T1S_16BIT, VEXPrefixConfig.W1, true);
1730+
public static final VexRMOp EVPEXPANDD = new VexRMOp("EVPEXPANDD", VEXPrefixConfig.P_66, VEXPrefixConfig.M_0F38, VEXPrefixConfig.W0, 0x89, VEXOpAssertion.AVX512F_VL, EVEXTuple.T1S_32BIT, VEXPrefixConfig.W0, true);
1731+
public static final VexRMOp EVPEXPANDQ = new VexRMOp("EVPEXPANDQ", VEXPrefixConfig.P_66, VEXPrefixConfig.M_0F38, VEXPrefixConfig.W1, 0x89, VEXOpAssertion.AVX512F_VL, EVEXTuple.T1S_64BIT, VEXPrefixConfig.W1, true);
17251732
// @formatter:on
17261733

17271734
protected VexRMOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
@@ -2063,7 +2070,10 @@ public void emit(AMD64Assembler asm, AVXSize size, Register dst, AMD64Address sr
20632070
*/
20642071
public static final class VexMROp extends VexRROp {
20652072
// @formatter:off
2073+
public static final VexMROp EVPCOMPRESSB = new VexMROp("EVPCOMPRESSB", VEXPrefixConfig.P_66, VEXPrefixConfig.M_0F38, VEXPrefixConfig.W0, 0x63, VEXOpAssertion.AVX512_VBMI2_VL, EVEXTuple.T1S_8BIT, VEXPrefixConfig.W0, true);
2074+
public static final VexMROp EVPCOMPRESSW = new VexMROp("EVPCOMPRESSW", VEXPrefixConfig.P_66, VEXPrefixConfig.M_0F38, VEXPrefixConfig.W1, 0x63, VEXOpAssertion.AVX512_VBMI2_VL, EVEXTuple.T1S_16BIT, VEXPrefixConfig.W1, true);
20662075
public static final VexMROp EVPCOMPRESSD = new VexMROp("EVPCOMPRESSD", VEXPrefixConfig.P_66, VEXPrefixConfig.M_0F38, VEXPrefixConfig.W0, 0x8B, VEXOpAssertion.AVX512F_VL, EVEXTuple.T1S_32BIT, VEXPrefixConfig.W0, true);
2076+
public static final VexMROp EVPCOMPRESSQ = new VexMROp("EVPCOMPRESSQ", VEXPrefixConfig.P_66, VEXPrefixConfig.M_0F38, VEXPrefixConfig.W1, 0x8B, VEXOpAssertion.AVX512F_VL, EVEXTuple.T1S_64BIT, VEXPrefixConfig.W1, true);
20672077

20682078
public static final VexMROp EVPMOVWB = new VexMROp("EVPMOVWB", VEXPrefixConfig.P_F3, VEXPrefixConfig.M_0F38, VEXPrefixConfig.W0, 0x30, VEXOpAssertion.AVX512BW_VL, EVEXTuple.HVM, VEXPrefixConfig.W0, true);
20692079
public static final VexMROp EVPMOVDB = new VexMROp("EVPMOVDB", VEXPrefixConfig.P_F3, VEXPrefixConfig.M_0F38, VEXPrefixConfig.W0, 0x31, VEXOpAssertion.AVX512F_VL, EVEXTuple.QVM, VEXPrefixConfig.W0, true);

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/meta/UnimplementedGraalIntrinsics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ public UnimplementedGraalIntrinsics(Architecture arch) {
9191
// scalar operations
9292
"jdk/internal/vm/vector/Float16Math.fma(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljdk/internal/vm/vector/Float16Math$TernaryOperator;)Ljava/lang/Object;",
9393
"jdk/internal/vm/vector/Float16Math.sqrt(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/function/UnaryOperator;)Ljava/lang/Object;",
94-
"jdk/internal/vm/vector/VectorSupport.compressExpandOp(ILjava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;ILjdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$VectorMask;Ljdk/internal/vm/vector/VectorSupport$CompressExpandOperation;)Ljdk/internal/vm/vector/VectorSupport$VectorPayload;",
9594
"jdk/internal/vm/vector/VectorSupport.indexVector(Ljava/lang/Class;Ljava/lang/Class;ILjdk/internal/vm/vector/VectorSupport$Vector;ILjdk/internal/vm/vector/VectorSupport$VectorSpecies;Ljdk/internal/vm/vector/VectorSupport$IndexOperation;)Ljdk/internal/vm/vector/VectorSupport$Vector;",
9695
// JDK-8353786: Migrate Vector API math library support to FFM API
9796
"jdk/internal/vm/vector/VectorSupport.libraryBinaryOp(JLjava/lang/Class;Ljava/lang/Class;ILjava/lang/String;Ljdk/internal/vm/vector/VectorSupport$VectorPayload;Ljdk/internal/vm/vector/VectorSupport$VectorPayload;Ljdk/internal/vm/vector/VectorSupport$BinaryOperation;)Ljdk/internal/vm/vector/VectorSupport$VectorPayload;",
@@ -187,6 +186,7 @@ public UnimplementedGraalIntrinsics(Architecture arch) {
187186
"jdk/internal/vm/vector/VectorSupport.blend(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;ILjdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$VectorMask;Ljdk/internal/vm/vector/VectorSupport$VectorBlendOp;)Ljdk/internal/vm/vector/VectorSupport$Vector;",
188187
"jdk/internal/vm/vector/VectorSupport.broadcastInt(ILjava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;ILjdk/internal/vm/vector/VectorSupport$Vector;ILjdk/internal/vm/vector/VectorSupport$VectorMask;Ljdk/internal/vm/vector/VectorSupport$VectorBroadcastIntOp;)Ljdk/internal/vm/vector/VectorSupport$Vector;",
189188
"jdk/internal/vm/vector/VectorSupport.compare(ILjava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;ILjdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$VectorMask;Ljdk/internal/vm/vector/VectorSupport$VectorCompareOp;)Ljdk/internal/vm/vector/VectorSupport$VectorMask;",
189+
"jdk/internal/vm/vector/VectorSupport.compressExpandOp(ILjava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;ILjdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$VectorMask;Ljdk/internal/vm/vector/VectorSupport$CompressExpandOperation;)Ljdk/internal/vm/vector/VectorSupport$VectorPayload;",
190190
"jdk/internal/vm/vector/VectorSupport.convert(ILjava/lang/Class;Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/Class;ILjdk/internal/vm/vector/VectorSupport$VectorPayload;Ljdk/internal/vm/vector/VectorSupport$VectorSpecies;Ljdk/internal/vm/vector/VectorSupport$VectorConvertOp;)Ljdk/internal/vm/vector/VectorSupport$VectorPayload;",
191191
"jdk/internal/vm/vector/VectorSupport.extract(Ljava/lang/Class;Ljava/lang/Class;ILjdk/internal/vm/vector/VectorSupport$VectorPayload;ILjdk/internal/vm/vector/VectorSupport$VecExtractOp;)J",
192192
"jdk/internal/vm/vector/VectorSupport.fromBitsCoerced(Ljava/lang/Class;Ljava/lang/Class;IJILjdk/internal/vm/vector/VectorSupport$VectorSpecies;Ljdk/internal/vm/vector/VectorSupport$FromBitsCoercedOperation;)Ljdk/internal/vm/vector/VectorSupport$VectorPayload;",
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package jdk.graal.compiler.lir.amd64.vector;
26+
27+
import static jdk.graal.compiler.asm.amd64.AMD64BaseAssembler.EVEXPrefixConfig.B0;
28+
import static jdk.graal.compiler.asm.amd64.AMD64BaseAssembler.EVEXPrefixConfig.Z1;
29+
import static jdk.vm.ci.code.ValueUtil.asRegister;
30+
31+
import jdk.graal.compiler.asm.amd64.AMD64Assembler.VexMROp;
32+
import jdk.graal.compiler.asm.amd64.AMD64Assembler.VexRMOp;
33+
import jdk.graal.compiler.asm.amd64.AMD64MacroAssembler;
34+
import jdk.graal.compiler.asm.amd64.AVXKind;
35+
import jdk.graal.compiler.debug.GraalError;
36+
import jdk.graal.compiler.lir.LIRInstructionClass;
37+
import jdk.graal.compiler.lir.amd64.AMD64LIRInstruction;
38+
import jdk.graal.compiler.lir.asm.CompilationResultBuilder;
39+
import jdk.vm.ci.amd64.AMD64Kind;
40+
import jdk.vm.ci.meta.AllocatableValue;
41+
42+
/**
43+
* This class implements the LIR nodes for AVX512 instructions {@code vpcompress} and
44+
* {@code vpexpand}.
45+
*/
46+
public class AVX512CompressExpand {
47+
/**
48+
* The LIR node for the instruction {@code vpcompress}.
49+
*/
50+
public static final class CompressOp extends AMD64LIRInstruction {
51+
public static final LIRInstructionClass<CompressOp> TYPE = LIRInstructionClass.create(CompressOp.class);
52+
53+
@Def protected AllocatableValue result;
54+
@Use protected AllocatableValue source;
55+
@Use protected AllocatableValue mask;
56+
57+
public CompressOp(AllocatableValue result, AllocatableValue source, AllocatableValue mask) {
58+
super(TYPE);
59+
this.result = result;
60+
this.source = source;
61+
this.mask = mask;
62+
}
63+
64+
@Override
65+
public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
66+
AMD64Kind eKind = ((AMD64Kind) result.getPlatformKind()).getScalar();
67+
AVXKind.AVXSize avxSize = AVXKind.getRegisterSize(result);
68+
VexMROp op = switch (eKind) {
69+
case BYTE -> VexMROp.EVPCOMPRESSB;
70+
case WORD -> VexMROp.EVPCOMPRESSW;
71+
case DWORD, SINGLE -> VexMROp.EVPCOMPRESSD;
72+
case QWORD, DOUBLE -> VexMROp.EVPCOMPRESSQ;
73+
default -> throw GraalError.shouldNotReachHereUnexpectedValue(eKind);
74+
};
75+
op.emit(masm, avxSize, asRegister(result), asRegister(source), asRegister(mask), Z1, B0);
76+
}
77+
}
78+
79+
/**
80+
* The LIR node for the instruction {@code vpexpand}.
81+
*/
82+
public static final class ExpandOp extends AMD64LIRInstruction {
83+
public static final LIRInstructionClass<ExpandOp> TYPE = LIRInstructionClass.create(ExpandOp.class);
84+
85+
@Def protected AllocatableValue result;
86+
@Use protected AllocatableValue source;
87+
@Use protected AllocatableValue mask;
88+
89+
public ExpandOp(AllocatableValue result, AllocatableValue source, AllocatableValue mask) {
90+
super(TYPE);
91+
this.result = result;
92+
this.source = source;
93+
this.mask = mask;
94+
}
95+
96+
@Override
97+
public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
98+
AMD64Kind eKind = ((AMD64Kind) result.getPlatformKind()).getScalar();
99+
AVXKind.AVXSize avxSize = AVXKind.getRegisterSize(result);
100+
VexRMOp op = switch (eKind) {
101+
case BYTE -> VexRMOp.EVPEXPANDB;
102+
case WORD -> VexRMOp.EVPEXPANDW;
103+
case DWORD, SINGLE -> VexRMOp.EVPEXPANDD;
104+
case QWORD, DOUBLE -> VexRMOp.EVPEXPANDQ;
105+
default -> throw GraalError.shouldNotReachHereUnexpectedValue(eKind);
106+
};
107+
op.emit(masm, avxSize, asRegister(result), asRegister(source), asRegister(mask), Z1, B0);
108+
}
109+
}
110+
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/vector/architecture/VectorArchitecture.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,15 @@ protected int getSupportedVectorLogicLengthHelper(LogicNode logicNode, int maxLe
358358
*/
359359
public abstract int getSupportedVectorBlendLength(Stamp elementStamp, int maxLength);
360360

361+
/**
362+
* Get the maximum supported vector length for a vector compress/expand based on a mask.
363+
*
364+
* @param elementStamp the stamp of the elements to be blended
365+
* @param maxLength the maximum length to return
366+
* @return the number of elements that can be compressed/expanded by a single instruction
367+
*/
368+
public abstract int getSupportedVectorCompressExpandLength(Stamp elementStamp, int maxLength);
369+
361370
/**
362371
* Determine the minimum alignment in bytes that is guaranteed for objects.
363372
*

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/vector/architecture/aarch64/VectorAArch64.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@ public int getSupportedVectorBlendLength(Stamp elementStamp, int maxLength) {
285285
return getSupportedVectorLength(elementStamp, maxLength);
286286
}
287287

288+
@Override
289+
public int getSupportedVectorCompressExpandLength(Stamp elementStamp, int maxLength) {
290+
return 1;
291+
}
292+
288293
@Override
289294
public int getObjectAlignment() {
290295
return objectAlignment;

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/vector/architecture/amd64/VectorAMD64.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,17 @@ private boolean isImpossibleLongToDoubleConversion(Stamp result, Stamp input) {
622622
return !supportUnsignedLongToDouble((IntegerStamp) input) && !supportSignedLongToDouble((IntegerStamp) input);
623623
}
624624

625+
@Override
626+
public int getSupportedVectorCompressExpandLength(Stamp elementStamp, int maxLength) {
627+
if (!hasMinimumVectorizationRequirements(maxLength)) {
628+
return 1;
629+
}
630+
631+
AVXSize avxSize = compressExpandOps.getSupportedAVXSize(elementStamp, maxLength);
632+
int supportedLength = getSupportedVectorLength(elementStamp, maxLength, avxSize);
633+
return Math.min(supportedLength, maxLength);
634+
}
635+
625636
@Override
626637
public int getObjectAlignment() {
627638
return objectAlignment;
@@ -1187,6 +1198,41 @@ public AVXSize getSupportedAVXSize(Stamp stamp, int maxLength) {
11871198
}
11881199
}
11891200

1201+
private final AMD64SupportedCompressExpandVectorInstructionsTable compressExpandOps = new AMD64SupportedCompressExpandVectorInstructionsTable(this);
1202+
1203+
private static final class AMD64VectorCompressExpandInstructionsMap extends AMD64SimpleVectorInstructionsTable.AMD64SimpleVectorInstructionsMap {
1204+
@SuppressWarnings("unchecked")
1205+
AMD64VectorCompressExpandInstructionsMap() {
1206+
super(
1207+
entry(IntegerStamp.class,
1208+
op(BYTE_BITS, VectorFeatureAssertion.AVX512_VBMI2_VL),
1209+
op(WORD_BITS, VectorFeatureAssertion.AVX512_VBMI2_VL),
1210+
op(DWORD_BITS, VectorFeatureAssertion.AVX512F_VL),
1211+
op(QWORD_BITS, VectorFeatureAssertion.AVX512F_VL)),
1212+
1213+
entry(FloatStamp.class,
1214+
op(SINGLE_BITS, VectorFeatureAssertion.AVX512F_VL),
1215+
op(DOUBLE_BITS, VectorFeatureAssertion.AVX512F_VL)));
1216+
}
1217+
}
1218+
1219+
private static final class AMD64SupportedCompressExpandVectorInstructionsTable extends AMD64SimpleVectorInstructionsTable {
1220+
1221+
private static final AMD64VectorCompressExpandInstructionsMap COMPRESS_EXPAND_INSTRUCTIONS_MAP = new AMD64VectorCompressExpandInstructionsMap();
1222+
1223+
private AMD64SupportedCompressExpandVectorInstructionsTable(VectorAMD64 vectorAMD64) {
1224+
super(vectorAMD64, COMPRESS_EXPAND_INSTRUCTIONS_MAP);
1225+
}
1226+
1227+
public AVXSize getSupportedAVXSize(Stamp stamp, int maxLength) {
1228+
if (stamp instanceof AbstractObjectStamp) {
1229+
// For compress/expand, treat pointers like integers of the appropriate size.
1230+
return getEntry(IntegerStamp.class, oopBits((AbstractObjectStamp) stamp), maxLength);
1231+
}
1232+
return getEntry(stamp.getClass(), PrimitiveStamp.getBits(stamp), maxLength);
1233+
}
1234+
}
1235+
11901236
private static class VectorSimpleOperation {
11911237
private final int bits;
11921238
protected final VectorFeatureAssertion requiredFeatures;

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/vector/lir/VectorLIRGeneratorTool.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,8 @@ public interface VectorLIRGeneratorTool extends ArithmeticLIRGeneratorTool {
7676
Value emitMoveOpMaskToInteger(LIRKind resultKind, Value mask, int maskLen);
7777

7878
Value emitMoveIntegerToOpMask(LIRKind resultKind, Value mask);
79+
80+
Value emitVectorCompress(LIRKind resultKind, Value source, Value mask);
81+
82+
Value emitVectorExpand(LIRKind resultKind, Value source, Value mask);
7983
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/vector/lir/aarch64/AArch64VectorArithmeticLIRGenerator.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,4 +872,14 @@ public Value emitMoveOpMaskToInteger(LIRKind resultKind, Value mask, int maskLen
872872
public Value emitMoveIntegerToOpMask(LIRKind resultKind, Value mask) {
873873
throw new UnsupportedOperationException();
874874
}
875+
876+
@Override
877+
public Variable emitVectorCompress(LIRKind resultKind, Value source, Value mask) {
878+
throw new UnsupportedOperationException();
879+
}
880+
881+
@Override
882+
public Variable emitVectorExpand(LIRKind resultKind, Value source, Value mask) {
883+
throw new UnsupportedOperationException();
884+
}
875885
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/vector/lir/amd64/AMD64AVX512ArithmeticLIRGenerator.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@
242242
import jdk.graal.compiler.lir.amd64.vector.AMD64VectorMove;
243243
import jdk.graal.compiler.lir.amd64.vector.AMD64VectorShuffle;
244244
import jdk.graal.compiler.lir.amd64.vector.AMD64VectorUnary;
245+
import jdk.graal.compiler.lir.amd64.vector.AVX512CompressExpand;
245246
import jdk.graal.compiler.lir.amd64.vector.AVX512MaskedOp;
246247
import jdk.graal.compiler.nodes.ValueNode;
247248
import jdk.graal.compiler.nodes.calc.AbsNode;
@@ -2019,4 +2020,18 @@ public static AMD64Assembler.VexOp getMaskedOpcode(AMD64 arch, MaskedOpMetaData
20192020
return null;
20202021
}
20212022
}
2023+
2024+
@Override
2025+
public Variable emitVectorCompress(LIRKind resultKind, Value source, Value mask) {
2026+
Variable result = getLIRGen().newVariable(resultKind);
2027+
getLIRGen().append(new AVX512CompressExpand.CompressOp(result, asAllocatable(source), asAllocatable(mask)));
2028+
return result;
2029+
}
2030+
2031+
@Override
2032+
public Variable emitVectorExpand(LIRKind resultKind, Value source, Value mask) {
2033+
Variable result = getLIRGen().newVariable(resultKind);
2034+
getLIRGen().append(new AVX512CompressExpand.ExpandOp(result, asAllocatable(source), asAllocatable(mask)));
2035+
return result;
2036+
}
20222037
}

0 commit comments

Comments
 (0)