United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6479927 2x slowdown in loop storing float constant
JDK-6479927 : 2x slowdown in loop storing float constant

Details
Type:
Bug
Submit Date:
2006-10-09
Status:
Resolved
Updated Date:
2010-04-03
Project Name:
JDK
Resolved Date:
2006-11-14
Component:
hotspot
OS:
solaris_9
Sub-Component:
compiler
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs10 (b03)

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
2x slowdown from 6.0 to 7.0

   for (int i = 0; i < 10000; i++) {
         array[i] = 1234.5678f;

Possible issue with costs in ad file.

6.0 code

080   B8: #	B8 B9 <- B7 B8 	Loop: B8-B8 inner stride: not constant main Freq: 5.46993e+06
080   	MOV    [EBX + #12 + EDI << #2],#1234.567749	# store float
088   	MOV    [EBX + #16 + EDI << #2],#1234.567749	# store float
090   	MOV    [EBX + #20 + EDI << #2],#1234.567749	# store float
098   	MOV    [EBX + #24 + EDI << #2],#1234.567749	# store float
0a0   	MOV    [EBX + #28 + EDI << #2],#1234.567749	# store float
0a8   	MOV    [EBX + #32 + EDI << #2],#1234.567749	# store float
0b0   	MOV    [EBX + #36 + EDI << #2],#1234.567749	# store float
0b8   	MOV    [EBX + #40 + EDI << #2],#1234.567749	# store float
0c0   	MOV    [EBX + #44 + EDI << #2],#1234.567749	# store float
0c8   	MOV    [EBX + #48 + EDI << #2],#1234.567749	# store float
0d0   	MOV    [EBX + #52 + EDI << #2],#1234.567749	# store float
0d8   	MOV    [EBX + #56 + EDI << #2],#1234.567749	# store float
0e0   	MOV    [EBX + #60 + EDI << #2],#1234.567749	# store float
0e8   	MOV    [EBX + #64 + EDI << #2],#1234.567749	# store float
0f0   	MOV    [EBX + #68 + EDI << #2],#1234.567749	# store float
0f8   	MOV    [EBX + #72 + EDI << #2],#1234.567749	# store float
100   	ADD    EDI,#16
103   	CMP    EDI,ECX
105   	Jlt    B8	# Loop end  P=0.999900 C=5470208.000000

1.7 code

0c0   B8: #	B8 B9 <- B7 B8 	Loop: B8-B8 inner stride: not constant main of N70 Freq: 191478
0c0   	MOVSS  [EAX + #12 + EBP << #2],XMM4a
0c6   	MOVSS  [EAX + #16 + EBP << #2],XMM5a
0cc   	MOVSS  [EAX + #20 + EBP << #2],XMM2a
0d2   	MOVSS  [EAX + #24 + EBP << #2],XMM3a
0d8   	MOVSS  [EAX + #28 + EBP << #2],XMM0a
0de   	MOVSS  XMM1a,[#1234.567749]
0e6   	MOVSS  [EAX + #32 + EBP << #2],XMM1a
0ec   	MOVSS  XMM1a,[#1234.567749]
0f4   	MOVSS  [EAX + #36 + EBP << #2],XMM1a
0fa   	MOVSS  XMM1a,[#1234.567749]
102   	MOVSS  [EAX + #40 + EBP << #2],XMM1a
108   	MOVSS  XMM1a,[#1234.567749]
110   	MOVSS  [EAX + #44 + EBP << #2],XMM1a
116   	MOVSS  XMM1a,[#1234.567749]
11e   	MOVSS  [EAX + #48 + EBP << #2],XMM1a
124   	MOVSS  XMM1a,[#1234.567749]
12c   	MOVSS  [EAX + #52 + EBP << #2],XMM1a
132   	MOVSS  XMM1a,[#1234.567749]
13a   	MOVSS  [EAX + #56 + EBP << #2],XMM1a
140   	MOVSS  XMM1a,[#1234.567749]
148   	MOVSS  [EAX + #60 + EBP << #2],XMM1a
14e   	MOVSS  XMM1a,[#1234.567749]
156   	MOVSS  [EAX + #64 + EBP << #2],XMM1a
15c   	MOVSS  XMM1a,[#1234.567749]
164   	MOVSS  [EAX + #68 + EBP << #2],XMM1a
16a   	MOVSS  XMM1a,[#1234.567749]
172   	MOVSS  [EAX + #72 + EBP << #2],XMM1a
178   	ADD    EBP,#16
17b   	CMP    EBP,ECX
17d   	Jlt    B8	# Loop end  P=0.999901 C=191488.000000

                                    

Comments
EVALUATION

Introduced during the fix for 6452568.
The cost of load float constant into XMM and store it into a memory
dominates the move from immediate 32bits bits value to a memory:
  instruct storeF_imm( memory mem, immF src)
                                     
2006-10-09
SUGGESTED FIX

Add instruction for immediate float values stores for SSE >= 1 on x86 and
0 double values stores on x64. Set their cost lower then register stores.
Add the static method Node::has_special_unique_user() to
put unique users of specific nodes on IGVN worklist.
Remove unused code from .ad files.

Webrev:                 http://analemma.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/c2_baseline/2006/20061102095649.kvn.6479927/workspace/webrevs/webrev-2006.11.02/index.html
                                     
2006-11-02



Hardware and Software, Engineered to Work Together