RFR: 8354348: Enable Extended EVEX to REX2/REX demotion for commutative operations with same dst and src2

Jatin Bhateja jbhateja at openjdk.org
Mon Sep 1 13:05:42 UTC 2025


On Thu, 28 Aug 2025 21:09:03 GMT, Srinivas Vamsi Parasa <sparasa at openjdk.org> wrote:

> This change extends Extended EVEX (EEVEX) to REX2/REX demotion for Intel APX NDD instructions to handle commutative operations when the destination register and the second source register (src2) are the same.
> 
> Currently, EEVEX to REX2/REX demotion is only enabled when the first source (src1) and the destination are the same. This enhancement allows additional cases of valid demotion for commutative instructions (add, imul, and, or, xor).
> 
> For example:
> `eaddl r18, r25, r18` can be encoded as `addl r18, r25` using APX REX2 encoding
> `eaddl r2, r7, r2` can be encoded as `addl r2, r7` using non-APX legacy encoding

Hi @vamsi-parasa , thanks for working on this, I am process of validating https://github.com/openjdk/jdk/pull/26283 and find that additional RA biasing will enable demotion for more cases, with a minimal test case I see following results

Test point:-
<img width="440" height="150" alt="image" src="https://github.com/user-attachments/assets/e294762f-3a7a-4b2c-9498-01c870997797" />
Baseline:-
<img width="440" height="150" alt="image" src="https://github.com/user-attachments/assets/635b6f40-7404-4438-b4b5-78d86354f112" />
With this patch:-
<img width="440" height="150" alt="image" src="https://github.com/user-attachments/assets/e56f910b-8e96-4332-b8b4-78428ce1a9ee" />
With additional RA biasing
<img width="440" height="150" alt="image" src="https://github.com/user-attachments/assets/14271ea0-63d5-4146-935d-c0b2c6de6c52" />

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

PR Comment: https://git.openjdk.org/jdk/pull/26997#issuecomment-3242279829


More information about the hotspot-compiler-dev mailing list