diff --git a/basis/cpu/x86/32/32.factor b/basis/cpu/x86/32/32.factor index 5f6c0d4696..1a9e833835 100755 --- a/basis/cpu/x86/32/32.factor +++ b/basis/cpu/x86/32/32.factor @@ -282,6 +282,29 @@ M: x86.32 %callback-value ( ctype -- ) ! Unbox EAX unbox-return ; +:: float-function-param ( stack-slot dst src -- ) + ! We can clobber dst here since its going to contain the + ! final result + dst src n>> spill@ MOVSD + stack-slot dst MOVSD ; + +: float-function-return ( reg -- ) + ESP [] FSTPL + ESP [] MOVSD + ESP 16 ADD ; + +M:: x86.32 %unary-float-function ( dst src func -- ) + ESP -16 [+] dst src float-function-param + ESP 16 SUB + func f %alien-invoke + dst float-function-return ; + +M:: x86.32 %binary-float-function ( dst src1 src2 func -- ) + ESP -16 [+] dst src1 float-function-param + ESP -8 [+] dst src2 float-function-param + ESP 16 SUB + func f %alien-invoke + dst float-function-return ; M: x86.32 %cleanup ( params -- ) #! a) If we just called an stdcall function in Windows, it diff --git a/basis/cpu/x86/64/64.factor b/basis/cpu/x86/64/64.factor index 562563039e..424fdec5b9 100644 --- a/basis/cpu/x86/64/64.factor +++ b/basis/cpu/x86/64/64.factor @@ -249,9 +249,6 @@ M:: x86.64 %call-gc ( gc-root-count temp -- ) ! x86-64. enable-alien-4-intrinsics -! Enable fast calling of libc math functions -enable-float-functions - USE: vocabs.loader { diff --git a/basis/cpu/x86/x86.factor b/basis/cpu/x86/x86.factor index d89e360d09..40a720aa1b 100644 --- a/basis/cpu/x86/x86.factor +++ b/basis/cpu/x86/x86.factor @@ -989,6 +989,7 @@ enable-fixnum-log2 enable-float-intrinsics enable-fsqrt enable-float-min/max + enable-float-functions install-sse2-check ] when ;