Skip to content

Commit a59c9b2

Browse files
Paul SandozSandhya ViswanathanJatin BhatejaNingsheng JianXiaohong Gong
committedNov 15, 2021
8271515: Integration of JEP 417: Vector API (Third Incubator)
Co-authored-by: Sandhya Viswanathan <sviswanathan@openjdk.org> Co-authored-by: Jatin Bhateja <jbhateja@openjdk.org> Co-authored-by: Ningsheng Jian <njian@openjdk.org> Co-authored-by: Xiaohong Gong <xgong@openjdk.org> Co-authored-by: Eric Liu <eliu@openjdk.org> Co-authored-by: Jie Fu <jiefu@openjdk.org> Co-authored-by: Vladimir Ivanov <vlivanov@openjdk.org> Co-authored-by: John R Rose <jrose@openjdk.org> Co-authored-by: Paul Sandoz <psandoz@openjdk.org> Co-authored-by: Rado Smogura <mail@smogura.eu> Reviewed-by: kvn, sviswanathan, ngasson
1 parent 9326eb1 commit a59c9b2

File tree

104 files changed

+19895
-5765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+19895
-5765
lines changed
 

‎src/hotspot/cpu/aarch64/aarch64.ad

+67-7
Original file line numberDiff line numberDiff line change
@@ -2059,7 +2059,7 @@ uint MachSpillCopyNode::implementation(CodeBuffer *cbuf, PhaseRegAlloc *ra_, boo
20592059

20602060
assert(src_lo != OptoReg::Bad && dst_lo != OptoReg::Bad, "must move at least 1 register");
20612061

2062-
if (src_hi != OptoReg::Bad) {
2062+
if (src_hi != OptoReg::Bad && !bottom_type()->isa_vectmask()) {
20632063
assert((src_lo&1)==0 && src_lo+1==src_hi &&
20642064
(dst_lo&1)==0 && dst_lo+1==dst_hi,
20652065
"expected aligned-adjacent pairs");
@@ -2074,7 +2074,7 @@ uint MachSpillCopyNode::implementation(CodeBuffer *cbuf, PhaseRegAlloc *ra_, boo
20742074
int src_offset = ra_->reg2offset(src_lo);
20752075
int dst_offset = ra_->reg2offset(dst_lo);
20762076

2077-
if (bottom_type()->isa_vect() != NULL) {
2077+
if (bottom_type()->isa_vect() && !bottom_type()->isa_vectmask()) {
20782078
uint ireg = ideal_reg();
20792079
if (ireg == Op_VecA && cbuf) {
20802080
C2_MacroAssembler _masm(cbuf);
@@ -2180,10 +2180,29 @@ uint MachSpillCopyNode::implementation(CodeBuffer *cbuf, PhaseRegAlloc *ra_, boo
21802180
} else if (dst_lo_rc == rc_float) { // stack --> fpr load
21812181
__ unspill(as_FloatRegister(Matcher::_regEncode[dst_lo]),
21822182
is64 ? __ D : __ S, src_offset);
2183+
} else if (dst_lo_rc == rc_predicate) {
2184+
__ unspill_sve_predicate(as_PRegister(Matcher::_regEncode[dst_lo]), ra_->reg2offset(src_lo),
2185+
Matcher::scalable_vector_reg_size(T_BYTE) >> 3);
21832186
} else { // stack --> stack copy
21842187
assert(dst_lo_rc == rc_stack, "spill to bad register class");
2185-
__ unspill(rscratch1, is64, src_offset);
2186-
__ spill(rscratch1, is64, dst_offset);
2188+
if (ideal_reg() == Op_RegVectMask) {
2189+
__ spill_copy_sve_predicate_stack_to_stack(src_offset, dst_offset,
2190+
Matcher::scalable_vector_reg_size(T_BYTE) >> 3);
2191+
} else {
2192+
__ unspill(rscratch1, is64, src_offset);
2193+
__ spill(rscratch1, is64, dst_offset);
2194+
}
2195+
}
2196+
break;
2197+
case rc_predicate:
2198+
if (dst_lo_rc == rc_predicate) {
2199+
__ sve_mov(as_PRegister(Matcher::_regEncode[dst_lo]), as_PRegister(Matcher::_regEncode[src_lo]));
2200+
} else if (dst_lo_rc == rc_stack) {
2201+
__ spill_sve_predicate(as_PRegister(Matcher::_regEncode[src_lo]), ra_->reg2offset(dst_lo),
2202+
Matcher::scalable_vector_reg_size(T_BYTE) >> 3);
2203+
} else {
2204+
assert(false, "bad src and dst rc_class combination.");
2205+
ShouldNotReachHere();
21872206
}
21882207
break;
21892208
default:
@@ -2204,7 +2223,7 @@ uint MachSpillCopyNode::implementation(CodeBuffer *cbuf, PhaseRegAlloc *ra_, boo
22042223
} else {
22052224
st->print("%s", Matcher::regName[dst_lo]);
22062225
}
2207-
if (bottom_type()->isa_vect() != NULL) {
2226+
if (bottom_type()->isa_vect() && !bottom_type()->isa_vectmask()) {
22082227
int vsize = 0;
22092228
switch (ideal_reg()) {
22102229
case Op_VecD:
@@ -2221,6 +2240,10 @@ uint MachSpillCopyNode::implementation(CodeBuffer *cbuf, PhaseRegAlloc *ra_, boo
22212240
ShouldNotReachHere();
22222241
}
22232242
st->print("\t# vector spill size = %d", vsize);
2243+
} else if (ideal_reg() == Op_RegVectMask) {
2244+
assert(Matcher::supports_scalable_vector(), "bad register type for spill");
2245+
int vsize = Matcher::scalable_predicate_reg_slots() * 32;
2246+
st->print("\t# predicate spill size = %d", vsize);
22242247
} else {
22252248
st->print("\t# spill size = %d", is64 ? 64 : 32);
22262249
}
@@ -2382,6 +2405,18 @@ const bool Matcher::match_rule_supported(int opcode) {
23822405
ret_value = false;
23832406
}
23842407
break;
2408+
case Op_LoadVectorMasked:
2409+
case Op_StoreVectorMasked:
2410+
case Op_LoadVectorGatherMasked:
2411+
case Op_StoreVectorScatterMasked:
2412+
case Op_MaskAll:
2413+
case Op_AndVMask:
2414+
case Op_OrVMask:
2415+
case Op_XorVMask:
2416+
if (UseSVE == 0) {
2417+
ret_value = false;
2418+
}
2419+
break;
23852420
}
23862421

23872422
return ret_value; // Per default match rules are supported.
@@ -2430,6 +2465,15 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType
24302465
return vector_size_supported(bt, vlen);
24312466
}
24322467

2468+
const bool Matcher::match_rule_supported_vector_masked(int opcode, int vlen, BasicType bt) {
2469+
// Only SVE supports masked operations.
2470+
if (UseSVE == 0) {
2471+
return false;
2472+
}
2473+
return match_rule_supported(opcode) &&
2474+
masked_op_sve_supported(opcode, vlen, bt);
2475+
}
2476+
24332477
const RegMask* Matcher::predicate_reg_mask(void) {
24342478
return &_PR_REG_mask;
24352479
}
@@ -2643,10 +2687,14 @@ bool size_fits_all_mem_uses(AddPNode* addp, int shift) {
26432687

26442688
// Should the matcher clone input 'm' of node 'n'?
26452689
bool Matcher::pd_clone_node(Node* n, Node* m, Matcher::MStack& mstack) {
2646-
if (is_vshift_con_pattern(n, m)) { // ShiftV src (ShiftCntV con)
2647-
mstack.push(m, Visit); // m = ShiftCntV
2690+
// ShiftV src (ShiftCntV con)
2691+
// StoreVector (VectorStoreMask src)
2692+
if (is_vshift_con_pattern(n, m) ||
2693+
(UseSVE > 0 && m->Opcode() == Op_VectorStoreMask && n->Opcode() == Op_StoreVector)) {
2694+
mstack.push(m, Visit);
26482695
return true;
26492696
}
2697+
26502698
return false;
26512699
}
26522700

@@ -5505,6 +5553,7 @@ operand pReg()
55055553
%{
55065554
constraint(ALLOC_IN_RC(pr_reg));
55075555
match(RegVectMask);
5556+
match(pRegGov);
55085557
op_cost(0);
55095558
format %{ %}
55105559
interface(REG_INTER);
@@ -8854,6 +8903,17 @@ instruct castVV(vReg dst)
88548903
ins_pipe(pipe_class_empty);
88558904
%}
88568905

8906+
instruct castVVMask(pRegGov dst)
8907+
%{
8908+
match(Set dst (CastVV dst));
8909+
8910+
size(0);
8911+
format %{ "# castVV of $dst" %}
8912+
ins_encode(/* empty encoding */);
8913+
ins_cost(0);
8914+
ins_pipe(pipe_class_empty);
8915+
%}
8916+
88578917
// ============================================================================
88588918
// Atomic operation instructions
88598919
//

0 commit comments

Comments
 (0)