United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6443505 Ideal() function for CmpLTMask
JDK-6443505 : Ideal() function for CmpLTMask

Details
Type:
Enhancement
Submit Date:
2006-06-26
Status:
Resolved
Updated Date:
2013-06-26
Project Name:
JDK
Resolved Date:
2013-04-13
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
hs25 (b29)

Related Reports
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

Description
While investigating 6317170, it was noted that the CmpLTMask node could profit from a Ideal() function which transforms (CmpLTMask (SubI x y) 0) into (CmpLTMask x y). 

Small improvements in 201_compress are expected.

                                    

Comments
URL:   http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/886d1fd67dc3
User:  kvn
Date:  2013-04-13 04:31:15 +0000

                                     
2013-04-13
URL:   http://hg.openjdk.java.net/hsx/hsx25/hotspot/rev/886d1fd67dc3
User:  amurillo
Date:  2013-04-19 20:07:30 +0000

                                     
2013-04-19
The recommended transformation is not correct (try x=Integer.MIN_VALUE, y=1) but there is nonetheless a transformation that applies.  Recommended method is "do in .ad files as match() rule. Look on cadd_cmpLTMask, for example."

Current compilation of x<y and x-y<0:

           return x < y;

00c   	xorl    R10, R10	# int
00f   	movl    RAX, #1	# int
014   	cmpl    RSI, RDX
016   	cmovlge RAX, R10	# signed, int

           return (x - y) < 0;

00c   	subl    RSI, RDX	# int
00e   	movl    RAX, #1	# int
013   	xorl    R11, R11	# int
016   	testl   RSI, RSI
018   	cmovlge RAX, R11	# signed, int

Proposed improvement:

           return (x - y) < 0;

00e   	movl    RAX, #1	# int
013   	xorl    R11, R11	# int
00c   	cmpl    RSI, RDX	# int
018   	cmovlns RAX, R11	# signed, int

                                     
2013-02-27



Hardware and Software, Engineered to Work Together