RFR: JDK-8331859 : [PPC64] Remove support for Power7 and older [v4]

Martin Doerr mdoerr at openjdk.org
Thu Apr 17 17:04:10 UTC 2025


On Thu, 17 Apr 2025 08:03:02 GMT, Suchismith Roy <sroy at openjdk.org> wrote:

>> JBS Issue: [JDK-8331859](https://bugs.openjdk.org/browse/JDK-8331859) 
>> Linux PPC64le requires Power8 since the beginning.
>> AIX requires Power8 with the new OpenXL based build ([JDK-8307520](https://bugs.openjdk.org/browse/JDK-8307520)). The old build has been removed in JDK 23 ([JDK-8327701](https://bugs.openjdk.org/browse/JDK-8327701)).
>> Linux PPC64 Big Endian is no longer officially supported (only kept alive for development, debugging and testing purposes).
>> 
>> The following checks for old processors are no longer needed:
>> 8: VM_Version::has_lqarx()
>> 7: VM_Version::has_popcntw()
>> 6: VM_Version::has_cmpb()
>> 5: VM_Version::has_popcntb()
>> These ones and some more checks for old instructions are no longer needed. All code which is no longer reachable when removing them should also get removed.
>> Checks like "PowerArchitecturePPC64 >= 8" (or older) can be removed.
>> 
>> Atomic::PlatformCmpxchg<1>::operator() can be simplified by using sub-word instructions (lharx, lbarx).
>> 
>> Temp registers can be removed from cmpxchgb and cmpxchgh.
>> 
>> Build flags "-mcpu=powerpc64 -mtune=power5" for Big Endian linux should get replaced by "-mcpu=power8 -mtune=power8" as already used for linux PPC64le.
>
> Suchismith Roy has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 27 commits:
> 
>  - Merge branch 'openjdk:master' into power8
>  - mfdscr removal
>  - indents
>  - indents
>  - mcpu flag
>  - superword
>  -  further cleanup
>  - clean of power 7 instructions
>  - Removal of older P7 Instructions
>  - Removal of older P7 Instructions
>  - ... and 17 more: https://git.openjdk.org/jdk/compare/1138a186...4aa520c2

Very nice that we can get rid of so much code!

src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp line 551:

> 549:         __ mtfprd(rdst, src->as_register_lo());
> 550:       }
> 551:       rsrc = rdst;

Further simplification: Remove rsrc and use `fcfid(rdst, rdst)`

src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp line 566:

> 564:       }
> 565:       rsrc = rdst;
> 566:       __ fcfids(rdst, rsrc);

Same here.

src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp line 1548:

> 1546:   }
> 1547: 
> 1548:   // Try to use isel on >=Power7.

The comment should also get removed.

src/hotspot/cpu/ppc/globals_ppc.hpp line 118:

> 116:                                                                             \
> 117:   /* special instructions */                                                \
> 118:   product(bool, SuperwordUseVSX, true,                                     \

Please add one space before ''.

src/hotspot/cpu/ppc/macroAssembler_ppc.cpp line 1574:

> 1572:   // Sub-word instructions are available since Power 8.
> 1573: 
> 1574:   const int instruction_type = size;

Maybe remove `instruction_type` and use `size` directly below?

src/hotspot/cpu/ppc/macroAssembler_ppc.cpp line 4238:

> 4236:                                      : StubRoutines::crc_table_addr()   , R0);
> 4237: 
> 4238:   kernel_crc32_vpmsum(crc, buf, len, t0, t1, t2, t3, t4, t5, t6, t7, !is_crc32c);

`kernel_crc32_1word` is now dead and should be removed completely.

src/hotspot/cpu/ppc/ppc.ad line 2070:

> 2068:       return VM_Version::has_fsqrt();
> 2069:     case Op_RoundDoubleMode:
> 2070:       return VM_Version::has_vsx();

Please remove `Op_SqrtD` and `Op_RoundDoubleMode` from this list. We should not fall through to `return UseCountLeadingZerosInstructionsPPC64;` which is wrong.

src/hotspot/cpu/ppc/ppc.ad line 10367:

> 10365: 
> 10366: // Double to Int conversion, NaN is mapped to 0.
> 10367: instruct convD2I_reg_ExEx(iRegIdst dst, regD src) %{

This `instruct` should be completely removed.

src/hotspot/cpu/ppc/ppc.ad line 10410:

> 10408: 
> 10409: // Float to Int conversion, NaN is mapped to 0.
> 10410: instruct convF2I_regF_ExEx(iRegIdst dst, regF src) %{

This instruct should be completely removed.

src/hotspot/cpu/ppc/ppc.ad line 10621:

> 10619: 
> 10620: // Float to Long conversion, NaN is mapped to 0.
> 10621: instruct convF2L_reg_ExEx(iRegLdst dst, regF src) %{

This instruct should be completely removed.

src/hotspot/cpu/ppc/ppc.ad line 10664:

> 10662: 
> 10663: // Double to Long conversion, NaN is mapped to 0.
> 10664: instruct convD2L_reg_ExEx(iRegLdst dst, regD src) %{

This instruct should be completely removed.

src/hotspot/cpu/ppc/ppc.ad line 10721:

> 10719: 
> 10720: // Integer to Float conversion.
> 10721: instruct convI2F_ireg_Ex(regF dst, iRegIsrc src) %{

This instruct should be completely removed.

src/hotspot/cpu/ppc/ppc.ad line 10752:

> 10750: 
> 10751: // Integer to Float conversion. Special version for Power7.
> 10752: instruct convI2F_ireg_fcfids_Ex(regF dst, iRegIsrc src) %{

This instruct should be completely removed.

src/hotspot/cpu/ppc/ppc.ad line 10780:

> 10778: 
> 10779: // L2F to avoid runtime call.
> 10780: instruct convL2F_ireg_fcfids_Ex(regF dst, iRegLsrc src) %{

This instruct should be completely removed.

src/hotspot/cpu/ppc/ppc.ad line 13349:

> 13347: instruct storeL_reversed(iRegLsrc src, indirect mem) %{
> 13348:   match(Set mem (StoreL mem (ReverseBytesL src)));
> 13349:   predicate(VM_Version::has_stdbrx());

This makes other `instruct` with `match(Set dst (ReverseBytesL src));` and higher cost obsolete. `bytes_reverse_long_Ex` should be removed. There are more cases in which you have removed a predicate which makes other `instruct` blocks obsolete. Please check!

src/hotspot/cpu/ppc/stubGenerator_ppc.cpp line 927:

> 925:         __ mtctr(tmp1);
> 926: 
> 927:        if (!VM_Version::has_vsx()) {

Seems like you have removed the wrong block.

src/hotspot/cpu/ppc/stubRoutines_ppc_64.cpp line 81:

> 79:   // Layout of constant table:
> 80:   // <= Power7 Little Endian: 4 tables for byte folding
> 81:   // <= Power7 Big Endian: 1 table for single byte folding + 4 tables for multi-byte folding

Power7 comments should get removed.

src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp line 1080:

> 1078:   // PPC64 specific:
> 1079:   switch (kind) {
> 1080:     case Interpreter::java_lang_math_sqrt: use_instruction = true; break;

Wit this,
`case Interpreter::java_lang_math_sqrt : runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsqrt);  break;`
can be simplified to
`case Interpreter::java_lang_math_sqrt : /* run interpreted */ break;`
and `|| defined(PPC)` can be removed from sharedRuntime.hpp and sharedRuntime.cpp (search for `dsqrt`).

src/hotspot/cpu/ppc/vm_version_ppc.cpp line 103:

> 101: 
> 102: 
> 103:   MaxVectorSize = 16;

This removes too much. The last 4 lines should stay. SuperwordUseVSX is a supported switch which serves as workaround for VSX bugs.

src/hotspot/cpu/ppc/vm_version_ppc.cpp line 164:

> 162:   jio_snprintf(buf, sizeof(buf),
> 163:                "ppc64%s%s%s%s",
> 164:                (has_lxarxeh() ? " lxarxeh" : ""),

I think this one is also no longer needed. It's a strange name for ldarx with EH bit support.

src/hotspot/cpu/ppc/vm_version_ppc.cpp line 165:

> 163:                "ppc64%s%s%s%s",
> 164:                (has_lxarxeh() ? " lxarxeh" : ""),
> 165:                (has_vshasig() ? " sha"     : ""),

The check for `has_vshasig()` is no longer needed (v2.07). I guess that " sha" should still get printed because some tests check for it.

-------------

PR Review: https://git.openjdk.org/jdk/pull/20262#pullrequestreview-2776288596
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049268775
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049273318
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049276011
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049278426
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049281547
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049290117
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049293787
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049299134
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049299737
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049300127
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049300496
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049301001
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049301549
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049302519
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049307973
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049311324
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049315213
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049327127
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049330443
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049344339
PR Review Comment: https://git.openjdk.org/jdk/pull/20262#discussion_r2049346118


More information about the hotspot-dev mailing list