Return float st(0) or xmm0

975 views Asked by At

Directive for determining in which register (st(0) or xmm0) the floating point value from the assembler block in C++ code will be returned.

__declspec(naked) float __fastcall ln(float flt)
{
    float buf;

    _asm {
        mov buf, eax
        fld buf             // Return st(0)
    };
};
1

There are 1 answers

6
Botje On

For 32-bit x86 code, Visual studio will always use the i387 stack, as it is the calling convention.
For 64-bit x64 code, the XMM registers are used exclusively.

I'm afraid you have no choice but to write separate asm blocks for different architectures. If only you had a higher-level language that generated specific assembly code for each architecture it supports ... ;)