RFR: 8349582: APX NDD code generation for OpenJDK [v3]
Sandhya Viswanathan
sviswanathan at openjdk.org
Thu Mar 6 01:11:13 UTC 2025
On Wed, 5 Mar 2025 18:08:08 GMT, Srinivas Vamsi Parasa <sparasa at openjdk.org> wrote:
>> The goal of this PR is to generate code using APX NDD instructions.
>
> Srinivas Vamsi Parasa has updated the pull request incrementally with one additional commit since the last revision:
>
> remove epopcount, elzcnt, etzcnt
src/hotspot/cpu/x86/x86_64.ad line 8253:
> 8251: %}
> 8252:
> 8253: instruct negI_rReg_ndd(rRegI src, rRegI dst, immI_0 zero, rFlagsReg cr)
A nit pick in many of the new negI/negL instructs, we usually list the dst first in instruct.
src/hotspot/cpu/x86/x86_64.ad line 9060:
> 9058:
> 9059: // Arithmetic Shift Right by variable
> 9060: instruct sarI_rReg_CL_ndd(rRegI dst, rRegI src, rcx_RegI shift, rFlagsReg cr)
The new instructs sarI_rReg_CL_ndd, shrI_rReg_CL_ndd, salL_rReg_CL_ndd, sarL_rReg_CL_ndd, shrL_rReg_CL_ndd could be removed and the original !bmi2 versions could be kept. We dont need to optimize with APX instructions for non bmi2 platforms.
src/hotspot/cpu/x86/x86_64.ad line 10401:
> 10399: %}
> 10400:
> 10401: instruct orI_rReg_imm_rReg_ndd(rRegI dst, immI src1, rRegI src2, rFlagsReg cr)
It looks to me that we only need one of orI_rReg_rReg_imm_ndd or orI_rReg_imm_rReg_ndd as orI is a commutative operator.
src/hotspot/cpu/x86/x86_64.ad line 10806:
> 10804: %}
> 10805:
> 10806: instruct andL_rReg_rReg_mem_ndd(rRegL dst, rRegL src1, memory src2, rFlagsReg cr)
It looks to me that we only need one of andL_rReg_rReg_mem_ndd & andL_rReg_mem_rReg_ndd as and is a commutative operator. Likewise for other commutative operators like or, add, xor, mul, etc.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23501#discussion_r1982329656
PR Review Comment: https://git.openjdk.org/jdk/pull/23501#discussion_r1982343164
PR Review Comment: https://git.openjdk.org/jdk/pull/23501#discussion_r1982391235
PR Review Comment: https://git.openjdk.org/jdk/pull/23501#discussion_r1982388864
More information about the hotspot-compiler-dev
mailing list