RFR: 8357982: Fix several failing BMI tests with -XX:+UseAPX [v7]

Sandhya Viswanathan sviswanathan at openjdk.org
Thu Jun 5 21:33:57 UTC 2025


On Thu, 5 Jun 2025 08:08:48 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> A) Patch extends the following tests with hard-coded encoding checks for various BMI instructions to cover REX2 or extended EVEX encodings supported by APX. 
>> 
>> 
>>      compiler/intrinsics/bmi/verifycode/AndnTestI.java
>>      compiler/intrinsics/bmi/verifycode/AndnTestL.java
>>      compiler/intrinsics/bmi/verifycode/BzhiTestI2L.java
>>      compiler/intrinsics/bmi/verifycode/LZcntTestL.java
>>      compiler/intrinsics/bmi/verifycode/TZcntTestL.java
>> 
>> 
>> B) After integration of JDK-8349582, which added APX NDD support, AndN instruction selection patterns that expect (Xor SRC, -1) as one of its operands were not getting selected because of a lower-cost generic immediate pattern match; patch fixes this issue through strict predicate checks.
>> 
>> Above tests are now passing, validations were carried out using Intel Software Development emulator.
>> 
>> Kindly review and share your feedback.
>> 
>> Best Regards,
>> Jatin
>
> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review resolutions

src/hotspot/cpu/x86/x86_64.ad line 10621:

> 10619: %{
> 10620:   // Strict predicate check to make selection of xorI_rReg_im1 cost agnostic if immI src is -1.
> 10621:   predicate(!UseAPX && n->in(2)->bottom_type()->is_int()->get_con() != -1);

We don't need to add the strict predicate check to xorI_rReg_imm, xorI_rReg_rReg_imm_ndd, xorL_rReg_imm, xorL_rReg_rReg_imm_ndd. The only change required is to add ins_cost(150) to xorI_rReg_mem_imm_ndd and xorL_rReg_mem_imm_ndd.

src/hotspot/cpu/x86/x86_64.ad line 10636:

> 10634: %{
> 10635:   // Strict predicate check to make selection of xorI_rReg_im1_ndd cost agnostic if immI src2 is -1.
> 10636:   predicate(UseAPX && n->in(2)->bottom_type()->is_int()->get_con() != -1);

This strict predicate check could be removed.

src/hotspot/cpu/x86/x86_64.ad line 11328:

> 11326: %{
> 11327:   // Strict predicate check to make selection of xorL_rReg_im1 cost agnostic if immL32 src is -1.
> 11328:   predicate(!UseAPX && n->in(2)->bottom_type()->is_long()->get_con() != -1L);

This strict predicate check could be removed.

src/hotspot/cpu/x86/x86_64.ad line 11343:

> 11341: %{
> 11342:   // Strict predicate check to make selection of xorL_rReg_im1_ndd cost agnostic if immL32 src2 is -1.
> 11343:   predicate(UseAPX && n->in(2)->bottom_type()->is_long()->get_con() != -1L);

This strict predicate check could be removed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25501#discussion_r2130466887
PR Review Comment: https://git.openjdk.org/jdk/pull/25501#discussion_r2130468837
PR Review Comment: https://git.openjdk.org/jdk/pull/25501#discussion_r2130469792
PR Review Comment: https://git.openjdk.org/jdk/pull/25501#discussion_r2130470425


More information about the hotspot-compiler-dev mailing list