JDK-6752257 : Use NOT instead of XOR -1 on x86
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-09-24
  • Updated: 2010-04-02
  • Resolved: 2008-11-04
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.
JDK 6 JDK 7 Other
6u14Fixed 7Fixed hs14Fixed
Description
On x86, use NOT instead of XOR -1 when possible.

XOR reg, -1 is 3 bytes, while NOT reg is 2 bytes.  Both are 1 cycle.  Don't expect earth shattering gains but it is smaller code.

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/b744678d4d71
2008-10-10

EVALUATION Give it a try.
2008-09-24

SUGGESTED FIX // Use NOT instead of XOR -1 instruct notI_eReg(eRegI dst, immI_M1 imm) %{ match(Set dst (XorI dst imm)); size(2); format %{ "NOT $dst" %} ins_encode %{ __ notl($dst$$Register); %} ins_pipe( ialu_reg_reg ); %}
2008-09-24