Thread overview
[Issue 8060] New: xmmstore cannot allocate store for optimized operation that uses int and floats
May 07, 2012
Fawzi Mohamed
May 07, 2012
Fawzi Mohamed
May 08, 2012
Fawzi Mohamed
May 14, 2012
Don
May 19, 2012
Walter Bright
May 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8060

           Summary: xmmstore cannot allocate store for optimized operation
                    that uses int and floats
           Product: D
           Version: D1 & D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: fawzi@gmx.ch


--- Comment #0 from Fawzi Mohamed <fawzi@gmx.ch> 2012-05-07 13:51:45 PDT ---
float invSqrt(float x) {
    union fi {
    float f;
    int i;
    }
    fi v;
    float xhalf = 0.5f * x;
    v.f = x;
    v.i = 0x5f375a86 - (v.i >> 1);
    float y = x * v.f;
    float z = y*(1.5f - xhalf * y * y);
    return z;
}

or

float invSqrt(float x) {
    float xhalf = 0.5f * x;
    int i = *cast(int*)&x;
    i = 0x5f375a86 - (i >> 1);
    x = *cast(float*)&i;
    x = x*(1.5f - xhalf * x * x);
    return x;
}

fails with error

tym = xa
Internal error: ../ztc/cgxmm.c 567

when compiled with dmd 1.074 or 2.059 with -O

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8060



--- Comment #1 from Fawzi Mohamed <fawzi@gmx.ch> 2012-05-07 13:54:15 PDT ---
well probably the optimizer should not expect such a thing to be possible.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8060


Fawzi Mohamed <fawzi@gmx.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |regression


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 14, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8060


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2012-05-14 00:59:21 PDT ---
Reduced test case. The float needs to be a parameter (not a local variable).

float bug8060(float x) {
    int i = *cast(int*)&x;
    ++i;
    return *cast(float*)&i;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8060



--- Comment #4 from github-bugzilla@puremagic.com 2012-05-18 23:03:08 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/cb946cd258a186f09cbaa303d1ded96a8ebb095d
fix Issue 8060 - xmmstore cannot allocate store for optimized operation that
uses int and floats

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8060


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------