Skip to content

Commit

Permalink
Make getIeeeFlags() naked
Browse files Browse the repository at this point in the history
DMD knows what epilogue code to insert for a non-naked assembly code
function returning a four-byte struct. Other compilers such as LDC don’t.
Improve compiler compatibility by implementing the ABI explicitly in the
function using `naked` rather than having the compiler doing it implicitly.
  • Loading branch information
david-eckardt-frequenz authored and matthias-wende-sociomantic committed Jul 5, 2019
1 parent 2d5eca2 commit 63ef0e8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ocean/math/IEEE.d
Original file line number Diff line number Diff line change
Expand Up @@ -281,22 +281,26 @@ private:
{
asm
{
naked;
fstsw AX;
// NOTE: If compiler supports SSE2, need to OR the result with
// the SSE2 status register.
// Clear all irrelevant bits
and EAX, 0x03D;
ret;
}
}
else version(D_InlineAsm_X86_64)
{
asm
{
naked;
fstsw AX;
// NOTE: If compiler supports SSE2, need to OR the result with
// the SSE2 status register.
// Clear all irrelevant bits
and RAX, 0x03D;
ret;
}
} else {
/* SPARC:
Expand Down

0 comments on commit 63ef0e8

Please sign in to comment.