[Issue 6877] [XMM] regression, clobbered float value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 1 19:29:27 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6877



--- Comment #1 from dawg at dawgfoto.de 2011-11-01 19:28:58 PDT ---
struct Matrix
{
    void setSinCos(float sinV)
    {
        // use parameter, so it becomes a register veriable
        a = sinV * sinV;

        // refer to value of parameter
        version (none)
            val = -sinV;
        else // which 'eleq' optimizes to
            *cast(uint*)&val = (*cast(uint*)&sinV) ^ 0x80000000;
    }
    float a, val;
}

extern(C) int printf(in char* format, ...);

void main()
{
    Matrix m;
    printf("%g\n", m.val);
    // indirect to prevent CTFE
    auto dg = &m.setSinCos;
    dg(2.0);
    printf("%g\n", m.val);
}

-----------------------------------------------------

sinV is a register variable residing in xmm2.
The load for the left xor operand is done with
  mov   %edx, %eax
which should be
  movd %xmm2, %eax
instead, same modrm though.

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


More information about the Digitalmars-d-bugs mailing list