RFR: JDK-8331732 : [PPC64] Unify and optimize code which converts != 0 to 1 [v2]
Amit Kumar
amitkumar at openjdk.org
Wed Jun 26 17:01:15 UTC 2024
On Wed, 26 Jun 2024 16:45:25 GMT, Suchismith Roy <sroy at openjdk.org> wrote:
>> [JDK-8331732](https://bugs.openjdk.org/browse/JDK-8331732)
>> The template interpreter contains branch-free conversion code for T_BOOLEAN (TemplateInterpreterGenerator::generate_result_handler_for).
>>
>> SharedRuntime::generate_native_wrapper uses unoptimized code to "Unpack the native result" for T_BOOLEAN.
>> Power10 has the "setbc" / "setbcr" instruction.
>>
>> A new function has been created for the conversion and use "setbcr" on Power10 (determined by VM_Version::has_brw()) and otherwise the branch-free implementation. We should have a function for 32 and one for 64 bit operations (or one with supports both).
>>
>> The new code for MacroAssembler::verify_secondary_supers_table also uses the new function.
>
> Suchismith Roy has updated the pull request incrementally with one additional commit since the last revision:
>
> empty lines
src/hotspot/cpu/ppc/macroAssembler_ppc.cpp line 349:
> 347: // Set register dst to true if dst is non zero using temp for calculations on Power Version<10.
> 348: // Set register dst to true if dst is non zero for Power 10 and above machines.
> 349: void MacroAssembler::normalize_bool(Register dst, Register temp, bool use_64bit) {
I would've used `is_64bit/is_long` instead of `use_64bit`. But that's personal choice and leave it upto you.
src/hotspot/cpu/ppc/macroAssembler_ppc.cpp line 356:
> 354: else
> 355: cmpwi(CCR0, dst, 0);
> 356: setbcr(dst, CCR0, Assembler::zero);
This is what I understood after implementation & definition:
If bit BI of the CR contains a 1, register RT is set to 0. Otherwise, register RT is set to 1.
CCR0 will contain `1` when `dst == 0`. then `dst` will be set to `1` by `setbcr`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19886#discussion_r1655235075
PR Review Comment: https://git.openjdk.org/jdk/pull/19886#discussion_r1655232478
More information about the hotspot-dev
mailing list