JDK-6460965 : C2 does not match an instruction with swaped operands of commutative operation.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 6,7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2006-08-17
  • Updated: 2011-12-23
  • Resolved: 2006-11-14
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
6u4Fixed 7Fixed hs10Fixed
Description
C2 does not match an instruction with swaped operands of commutative operation.
For example, the next instruction will not be matched if a LoadI node
is the first operand:

instruct addI_rReg_mem(rRegI dst, memory src, rFlagsReg cr)
%{
  match(Set dst (AddI dst (LoadI src)));

So instead of generating one instruction "add reg, mem" C2 will generate 2:
"mov reg1, mem"
"add reg, reg1"

Comments
SUGGESTED FIX Modify ADLC to generate duplicated instructions with swapped subtree operands of commutative operations in match rules. Also allow to specify more than one match rule per instruction in .ad files by generating duplicated instructions for each match rule. Remove not needed duplicated instruction from .ad files. Webrev: http://analemma.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/c2_baseline/2006/20060829100548.kvn.6460965/workspace/webrevs/webrev-2006.08.29/index.html
29-08-2006

EVALUATION See Description.
17-08-2006