RFR: 8333382: [s390x] Enhance popcnt Instruction to use Z15 facilities [v7]

Andrew Haley aph at openjdk.org
Tue Jun 11 09:18:17 UTC 2024


On Tue, 11 Jun 2024 07:57:43 GMT, Amit Kumar <amitkumar at openjdk.org> wrote:

>> We need to move popcnt instruction implementation out of s390.ad file as it is required to be required some methods present in [JDK-8331126.](https://bugs.openjdk.org/browse/JDK-8331126)
>> 
>> 
>> When the miscellaneous-instruction-extensions facility 3 is not installed or bit 0 of the M3
>>  field is zero, a count of the number of one bits in each of the eight bytes of general register
>>  R2 is placed into the corresponding byte of general register R1. Each byte of general register 
>> R1 is an 8-bit binary integer in the range of 0-8.
>> 
>> 
>> 
>> When the miscellaneous-instruction-extensions facility 3 is installed and bit 0 of the M3 field
>> is one, a count of the total number of one bits in the 64-bit general register R2 is placed into 
>> general register R1. The result is a 64-bit unsigned integer in the range 0 to 64.
>> 
>> 
>> Performed tier1 test on fastdebug build and didn't see any regression.
>
> Amit Kumar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   corrects the regsiter for z_popcnt in pop_count_long_post_z15 method

src/hotspot/cpu/s390/macroAssembler_s390.cpp line 5871:

> 5869: }
> 5870: 
> 5871: void MacroAssembler::pop_count_long_post_z15(Register r_dst, Register r_src) {

I know the name was my suggestion, but perhaps `pop_count_long_ext3` and `pop_count_long_pre_ext3` would be better.

src/hotspot/cpu/s390/macroAssembler_s390.cpp line 5877:

> 5875:     z_popcnt(r_dst, r_src, 8);
> 5876:   } else {
> 5877:     stop("this hardware doesn't support miscellaneous-instruction-extensions facility 3, still pop_count_long_post_z15 is used");

Use a `guarantee()` here instead of the if/then/else blocks.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19509#discussion_r1634498158
PR Review Comment: https://git.openjdk.org/jdk/pull/19509#discussion_r1634494732


More information about the hotspot-dev mailing list