RFR: 8346836: C2: Verify CastII/CastLL bounds at runtime [v10]

Vladimir Ivanov vlivanov at openjdk.org
Thu Apr 24 23:16:48 UTC 2025


On Thu, 24 Apr 2025 23:12:46 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> I don't think it is, `cmpw(rval, lo)` is equivalent to `subsw(zr, rval, lo)`. However, if `lo` does not fit into an immediate instruction, `MacroAssembler::subsw`, which calls into `wrap_adds_subs_imm_insn`, will use `Rd` as a temporary register to store `lo`, this is invalid if `Rd` is `zr`. Am I understanding it right?
>
> Yes, you are right. Completely forgot that there's only 12 bits available for the immediate (`Assembler::operand_valid_for_add_sub_immediate()`).

Completely forgot what I was thinking about when writing that code :-)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22880#discussion_r2059362742


More information about the hotspot-compiler-dev mailing list