JDK-8311969 : Coalesce 'XYZ, test, jump' instruction sequences
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 22
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • CPU: x86_64
  • Submitted: 2023-07-12
  • Updated: 2023-09-06
  • Resolved: 2023-09-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Duplicate :  
Relates :  
Description
It was noticed in https://bugs.openjdk.org/browse/JDK-8311597 that in the following instruction sequence:

    or ebp, 0xa
    test ebp, ebp
    jl 0x1b5ee511261

The `test ebp, ebp` is redundant, because the same flags are already set by the 'or' instruction.

We could coalesce these instructions together into just:

    or ebp, 0xa
    jl 0x1b5ee511261

The 'jl' instruction needs the SF and OF flags, which are set by the 'or' instruction. The `test ebp, ebp` does not modify the result register, just sets the flags, so it is not needed.