Skip to content

Commit 9007bc2

Browse files
committed
8255129: [PPC64, s390] Check vector_size_supported and add VectorReinterpret node
Reviewed-by: lucy
1 parent df79257 commit 9007bc2

File tree

2 files changed

+102
-129
lines changed

2 files changed

+102
-129
lines changed

src/hotspot/cpu/ppc/ppc.ad

Lines changed: 82 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,97 +2062,78 @@ static int frame_slots_bias(int reg_enc, PhaseRegAlloc* ra_) {
20622062
}
20632063

20642064
const bool Matcher::match_rule_supported(int opcode) {
2065-
if (!has_match_rule(opcode))
2066-
return false;
2065+
if (!has_match_rule(opcode)) {
2066+
return false; // no match rule present
2067+
}
20672068

2068-
bool ret_value = true;
20692069
switch (opcode) {
2070-
case Op_SqrtD:
2071-
return VM_Version::has_fsqrt();
2072-
case Op_CountLeadingZerosI:
2073-
case Op_CountLeadingZerosL:
2074-
if (!UseCountLeadingZerosInstructionsPPC64)
2075-
return false;
2076-
break;
2077-
case Op_CountTrailingZerosI:
2078-
case Op_CountTrailingZerosL:
2079-
if (!UseCountLeadingZerosInstructionsPPC64 &&
2080-
!UseCountTrailingZerosInstructionsPPC64)
2081-
return false;
2082-
break;
2083-
2084-
case Op_PopCountI:
2085-
case Op_PopCountL:
2086-
return (UsePopCountInstruction && VM_Version::has_popcntw());
2087-
2088-
case Op_StrComp:
2089-
return SpecialStringCompareTo;
2090-
case Op_StrEquals:
2091-
return SpecialStringEquals;
2092-
case Op_StrIndexOf:
2093-
case Op_StrIndexOfChar:
2094-
return SpecialStringIndexOf;
2095-
case Op_AddVB:
2096-
case Op_AddVS:
2097-
case Op_AddVI:
2098-
case Op_AddVF:
2099-
case Op_AddVD:
2100-
case Op_SubVB:
2101-
case Op_SubVS:
2102-
case Op_SubVI:
2103-
case Op_SubVF:
2104-
case Op_SubVD:
2105-
case Op_MulVS:
2106-
case Op_MulVF:
2107-
case Op_MulVD:
2108-
case Op_DivVF:
2109-
case Op_DivVD:
2110-
case Op_AbsVF:
2111-
case Op_AbsVD:
2112-
case Op_NegVF:
2113-
case Op_NegVD:
2114-
case Op_SqrtVF:
2115-
case Op_SqrtVD:
2116-
case Op_AddVL:
2117-
case Op_SubVL:
2118-
case Op_MulVI:
2119-
case Op_RoundDoubleModeV:
2120-
return SuperwordUseVSX;
2121-
case Op_PopCountVI:
2122-
return (SuperwordUseVSX && UsePopCountInstruction);
2123-
case Op_FmaVF:
2124-
case Op_FmaVD:
2125-
return (SuperwordUseVSX && UseFMA);
2126-
case Op_Digit:
2127-
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isDigit);
2128-
case Op_LowerCase:
2129-
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isLowerCase);
2130-
case Op_UpperCase:
2131-
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isUpperCase);
2132-
case Op_Whitespace:
2133-
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isWhitespace);
2134-
2135-
case Op_CacheWB:
2136-
case Op_CacheWBPreSync:
2137-
case Op_CacheWBPostSync:
2138-
if (!VM_Version::supports_data_cache_line_flush()) {
2139-
ret_value = false;
2140-
}
2141-
break;
2070+
case Op_SqrtD:
2071+
return VM_Version::has_fsqrt();
2072+
case Op_CountLeadingZerosI:
2073+
case Op_CountLeadingZerosL:
2074+
return UseCountLeadingZerosInstructionsPPC64;
2075+
case Op_CountTrailingZerosI:
2076+
case Op_CountTrailingZerosL:
2077+
return (UseCountLeadingZerosInstructionsPPC64 || UseCountTrailingZerosInstructionsPPC64);
2078+
case Op_PopCountI:
2079+
case Op_PopCountL:
2080+
return (UsePopCountInstruction && VM_Version::has_popcntw());
2081+
2082+
case Op_AddVB:
2083+
case Op_AddVS:
2084+
case Op_AddVI:
2085+
case Op_AddVF:
2086+
case Op_AddVD:
2087+
case Op_SubVB:
2088+
case Op_SubVS:
2089+
case Op_SubVI:
2090+
case Op_SubVF:
2091+
case Op_SubVD:
2092+
case Op_MulVS:
2093+
case Op_MulVF:
2094+
case Op_MulVD:
2095+
case Op_DivVF:
2096+
case Op_DivVD:
2097+
case Op_AbsVF:
2098+
case Op_AbsVD:
2099+
case Op_NegVF:
2100+
case Op_NegVD:
2101+
case Op_SqrtVF:
2102+
case Op_SqrtVD:
2103+
case Op_AddVL:
2104+
case Op_SubVL:
2105+
case Op_MulVI:
2106+
case Op_RoundDoubleModeV:
2107+
return SuperwordUseVSX;
2108+
case Op_PopCountVI:
2109+
return (SuperwordUseVSX && UsePopCountInstruction);
2110+
case Op_FmaVF:
2111+
case Op_FmaVD:
2112+
return (SuperwordUseVSX && UseFMA);
2113+
2114+
case Op_Digit:
2115+
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isDigit);
2116+
case Op_LowerCase:
2117+
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isLowerCase);
2118+
case Op_UpperCase:
2119+
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isUpperCase);
2120+
case Op_Whitespace:
2121+
return vmIntrinsics::is_intrinsic_available(vmIntrinsics::_isWhitespace);
2122+
2123+
case Op_CacheWB:
2124+
case Op_CacheWBPreSync:
2125+
case Op_CacheWBPostSync:
2126+
return VM_Version::supports_data_cache_line_flush();
21422127
}
21432128

2144-
return ret_value; // Per default match rules are supported.
2129+
return true; // Per default match rules are supported.
21452130
}
21462131

21472132
const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType bt) {
2148-
2149-
// TODO
2150-
// identify extra cases that we might want to provide match rules for
2151-
// e.g. Op_ vector nodes and other intrinsics while guarding with vlen
2152-
bool ret_value = match_rule_supported(opcode);
2153-
// Add rules here.
2154-
2155-
return ret_value; // Per default match rules are supported.
2133+
if (!match_rule_supported(opcode) || !vector_size_supported(bt, vlen)) {
2134+
return false;
2135+
}
2136+
return true; // Per default match rules are supported.
21562137
}
21572138

21582139
const bool Matcher::has_predicated_vectors(void) {
@@ -6569,6 +6550,23 @@ instruct storeV16(indirect mem, vecX src) %{
65696550
ins_pipe(pipe_class_default);
65706551
%}
65716552

6553+
// Reinterpret: only one vector size used: either L or X
6554+
instruct reinterpretL(iRegLdst dst) %{
6555+
match(Set dst (VectorReinterpret dst));
6556+
ins_cost(0);
6557+
format %{ "reinterpret $dst" %}
6558+
ins_encode( /*empty*/ );
6559+
ins_pipe(pipe_class_empty);
6560+
%}
6561+
6562+
instruct reinterpretX(vecX dst) %{
6563+
match(Set dst (VectorReinterpret dst));
6564+
ins_cost(0);
6565+
format %{ "reinterpret $dst" %}
6566+
ins_encode( /*empty*/ );
6567+
ins_pipe(pipe_class_empty);
6568+
%}
6569+
65726570
// Store Compressed Oop
65736571
instruct storeN(memory dst, iRegN_P2N src) %{
65746572
match(Set dst (StoreN dst src));

src/hotspot/cpu/s390/s390.ad

Lines changed: 20 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,60 +1511,28 @@ static Register reg_to_register_object(int register_encoding) {
15111511
}
15121512

15131513
const bool Matcher::match_rule_supported(int opcode) {
1514-
if (!has_match_rule(opcode)) return false;
1514+
if (!has_match_rule(opcode)) {
1515+
return false; // no match rule present
1516+
}
15151517

15161518
switch (opcode) {
1517-
case Op_CountLeadingZerosI:
1518-
case Op_CountLeadingZerosL:
1519-
case Op_CountTrailingZerosI:
1520-
case Op_CountTrailingZerosL:
1521-
// Implementation requires FLOGR instruction, which is available since z9.
1522-
return true;
1523-
15241519
case Op_ReverseBytesI:
15251520
case Op_ReverseBytesL:
15261521
return UseByteReverseInstruction;
1527-
1528-
// PopCount supported by H/W from z/Architecture G5 (z196) on.
15291522
case Op_PopCountI:
15301523
case Op_PopCountL:
1531-
return UsePopCountInstruction && VM_Version::has_PopCount();
1532-
1533-
case Op_StrComp:
1534-
return SpecialStringCompareTo;
1535-
case Op_StrEquals:
1536-
return SpecialStringEquals;
1537-
case Op_StrIndexOf:
1538-
case Op_StrIndexOfChar:
1539-
return SpecialStringIndexOf;
1540-
1541-
case Op_GetAndAddI:
1542-
case Op_GetAndAddL:
1543-
return true;
1544-
// return VM_Version::has_AtomicMemWithImmALUOps();
1545-
case Op_GetAndSetI:
1546-
case Op_GetAndSetL:
1547-
case Op_GetAndSetP:
1548-
case Op_GetAndSetN:
1549-
return true; // General CAS implementation, always available.
1550-
1551-
default:
1552-
return true; // Per default match rules are supported.
1553-
// BUT: make sure match rule is not disabled by a false predicate!
1524+
// PopCount supported by H/W from z/Architecture G5 (z196) on.
1525+
return (UsePopCountInstruction && VM_Version::has_PopCount());
15541526
}
15551527

1556-
return true; // Per default match rules are supported.
1557-
// BUT: make sure match rule is not disabled by a false predicate!
1528+
return true; // Per default match rules are supported.
15581529
}
15591530

15601531
const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType bt) {
1561-
// TODO
1562-
// Identify extra cases that we might want to provide match rules for
1563-
// e.g. Op_ vector nodes and other intrinsics while guarding with vlen.
1564-
bool ret_value = match_rule_supported(opcode);
1565-
// Add rules here.
1566-
1567-
return ret_value; // Per default match rules are supported.
1532+
if (!match_rule_supported(opcode) || !vector_size_supported(bt, vlen)) {
1533+
return false;
1534+
}
1535+
return true; // Per default match rules are supported.
15681536
}
15691537

15701538
const bool Matcher::has_predicated_vectors(void) {
@@ -10807,7 +10775,7 @@ instruct Repl2F_imm0(iRegL dst, immFp0 src) %{
1080710775
ins_pipe(pipe_class_dummy);
1080810776
%}
1080910777

10810-
// Store
10778+
// Load/Store vector
1081110779

1081210780
// Store Aligned Packed Byte register to memory (8 Bytes).
1081310781
instruct storeA8B(memory mem, iRegL src) %{
@@ -10821,8 +10789,6 @@ instruct storeA8B(memory mem, iRegL src) %{
1082110789
ins_pipe(pipe_class_dummy);
1082210790
%}
1082310791

10824-
// Load
10825-
1082610792
instruct loadV8(iRegL dst, memory mem) %{
1082710793
match(Set dst (LoadVector mem));
1082810794
predicate(n->as_LoadVector()->memory_size() == 8);
@@ -10834,6 +10800,15 @@ instruct loadV8(iRegL dst, memory mem) %{
1083410800
ins_pipe(pipe_class_dummy);
1083510801
%}
1083610802

10803+
// Reinterpret: only one vector size used
10804+
instruct reinterpret(iRegL dst) %{
10805+
match(Set dst (VectorReinterpret dst));
10806+
ins_cost(0);
10807+
format %{ "reinterpret $dst" %}
10808+
ins_encode( /*empty*/ );
10809+
ins_pipe(pipe_class_dummy);
10810+
%}
10811+
1083710812
//----------POPULATION COUNT RULES--------------------------------------------
1083810813

1083910814
// Byte reverse

0 commit comments

Comments
 (0)