RFR: 8241502: Migrate x86_64.ad to MacroAssembler [v7]

John Tortugo github.com+2249648+johntortugo at openjdk.java.net
Thu Apr 15 18:30:37 UTC 2021

On Mon, 29 Mar 2021 10:44:12 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> John Tortugo has updated the pull request incrementally with one additional commit since the last revision:
>>   Use cdql/cdqq implemented in MacroAssembler.
> src/hotspot/cpu/x86/x86_64.ad line 8329:
>> 8327:     "done:"        %}
>> 8328:   opcode(0xF7, 0x7);  /* Opcode F7 /7 */
>> 8329:   ins_encode(cdql_enc(div), REX_reg(div), OpcP, reg_opc(div));
> `cdql_enc`/`cdqq_enc` contain extensive comments about the logic. What about migrating them to dedicated methods in `MacroAssembler`/`C2_MacroAssembler` (`idivrem`/`ldivrem`) and calling those from `divI_rReg` / `divL_rReg`/`divModL_rReg_divmod`/...?

Hi Vladimir, thanks for the comment. Actually, there is already an implementation of cdql/cdqq in MacroAssembler, the names are slightly different though: corrected_idivl and corrected_idivq. I followed your suggestion and replaced the encoding of div*_rReg / divMod*_rReg_divmod and mod*_rReg with calls to these two functions.


PR: https://git.openjdk.java.net/jdk/pull/2420

More information about the hotspot-compiler-dev mailing list