United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6752257 Use NOT instead of XOR -1 on x86
JDK-6752257 : Use NOT instead of XOR -1 on x86

Details
Type:
Enhancement
Submit Date:
2008-09-24
Status:
Resolved
Updated Date:
2010-04-02
Project Name:
JDK
Resolved Date:
2008-11-04
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs14
Fixed Versions:
hs14 (b06)

Related Reports
Backport:
Backport:

Sub Tasks

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

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
EVALUATION

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



Hardware and Software, Engineered to Work Together