Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6452568
Votes 0
Synopsis i486 use SQRTSS instead of SQRTSD for (float)Math.sqrt()
Category hotspot:compiler2
Reported Against
Release Fixed hs10(b03), 6u4(b03) (Bug ID:2171807) , 7(b03) (Bug ID:2176740)
State 10-Fix Delivered, request for enhancement
Priority: 4-Low
Related Bugs
Submit Date 25-JUL-2006
Description
A DESCRIPTION OF THE REQUEST :
A common code sequence in 3d code is this:
float value = ....;
float result = (float)Math.sqrt(value);


Disabled code obtained from 1.6.0-rc-fastdebug-b90-debug
with the following options:
-XX:+PrintCompilation -XX:+PrintInlining -XX:+PrintOptoAssembly


JUSTIFICATION :
unneccessary float point format conversion.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
SQRTSS XMM1a,XMM0a

ACTUAL -
CVTSS2SD XMM0a,XMM1a	# D-round
SQRTSD XMM0a,XMM0a
CVTSD2SS XMM1a,XMM0a	# F-round

---------- BEGIN SOURCE ----------
public class Vector3f {
    
    public float x, y, z;

    public Vector3f normalize() {
        float x = this.x;
        float y = this.y;
        float z = this.z;
        float l = (float)Math.sqrt(x*x + y*y + z*z);
        this.x = x / l;
        this.y = y / l;
        this.z = z / l;
        return this;
    }

}

---------- END SOURCE ----------
Posted Date : 2006-07-25 17:13:11.0
Work Around
N/A
Evaluation
Missed optimization.
Posted Date : 2006-07-28 21:54:46.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang