Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6452568

i486 use SQRTSS instead of SQRTSD for (float)Math.sqrt()

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • hs10
    • 6
    • hotspot
    • b03
    • x86
    • windows_xp

    Backports

      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 ----------

        Attachments

          Issue Links

            Activity

              People

                kvn Vladimir Kozlov
                rmandalasunw Ranjith Mandala (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: