Skip to content

Commit

Permalink
Merge pull request #3999 from redstar/solarismath
Browse files Browse the repository at this point in the history
Solaris: Add inline assembly version of poly().
  • Loading branch information
H. S. Teoh committed Apr 1, 2016
2 parents 7be36e3 + 8acb830 commit 8d4b940
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions std/math.d
Expand Up @@ -6849,6 +6849,34 @@ private real polyImpl(real x, in real[] A) @trusted pure nothrow @nogc
;
}
}
else version (Solaris)
{
asm pure nothrow @nogc // assembler by W. Bright
{
// EDX = (A.length - 1) * real.sizeof
mov ECX,A[EBP] ; // ECX = A.length
dec ECX ;
lea EDX,[ECX*8] ;
lea EDX,[EDX][ECX*4] ;
add EDX,A+4[EBP] ;
fld real ptr [EDX] ; // ST0 = coeff[ECX]
jecxz return_ST ;
fld x[EBP] ; // ST0 = x
fxch ST(1) ; // ST1 = x, ST0 = r
align 4 ;
L2: fmul ST,ST(1) ; // r *= x
fld real ptr -12[EDX] ;
sub EDX,12 ; // deg--
faddp ST(1),ST ;
dec ECX ;
jne L2 ;
fxch ST(1) ; // ST1 = r, ST0 = x
fstp ST(0) ; // dump x
align 4 ;
return_ST: ;
;
}
}
else
{
static assert(0);
Expand Down

0 comments on commit 8d4b940

Please sign in to comment.