this has not been tested heavily, but it's known to at least assemble
and run in basic usage cases. it's nearly identical to the
corresponding i386 code, and thus expected to be just as correct or
just as incorrect.
17 files changed:
--- /dev/null
+.global acosl
+.type acosl,@function
+acosl:
+ fldt 8(%rsp)
+ fld1
+ fld %st(1)
+ fld1
+ fsubp
+ fxch %st(2)
+ faddp
+ fdivp
+ fsqrt
+ fld1
+ fxch %st(1)
+ fpatan
+ fld1
+ fld1
+ faddp
+ fmulp
+ ret
--- /dev/null
+.global asinl
+.type asinl,@function
+asinl:
+ fldt 8(%rsp)
+1: fld %st(0)
+ fmul %st(0)
+ fld1
+ fsubp %st(1)
+ fsqrt
+ fpatan
+ ret
+
--- /dev/null
+.global atan2l
+.type atan2l,@function
+atan2l:
+ fldt 8(%rsp)
+ fldt 24(%rsp)
+ fpatan
+ ret
--- /dev/null
+.global atanl
+.type atanl,@function
+atanl:
+ fldt 8(%rsp)
+ fld1
+ fpatan
+ ret
--- /dev/null
+# see floor.s
--- /dev/null
+# see expl.s
--- /dev/null
+.global expm1l
+.type expm1l,@function
+expm1l:
+ fldt 8(%rsp)
+1: fldl2e
+ fmulp
+ fld1
+ fld %st(1)
+ fabs
+ fucom %st(1)
+ fnstsw %ax
+ fstp %st(0)
+ fstp %st(0)
+ sahf
+ ja 1f
+ f2xm1
+ ret
+1: push %rax
+ call 1f
+ pop %rax
+ fld1
+ fsubrp
+ ret
+
+.global expl
+.type expl,@function
+expl:
+ fldt 8(%rsp)
+ fldl2e
+ fmulp
+ jmp 1f
+
+.global exp2l
+.type exp2l,@function
+exp2l:
+ fldt 8(%rsp)
+1: mov $0x467ff000,%eax
+ mov %eax,-16(%rsp)
+ mov $0x80000000,%eax
+ mov %eax,-20(%rsp)
+ xor %eax,%eax
+ mov %eax,-24(%rsp)
+ flds -16(%rsp)
+ fld %st(1)
+ fabs
+ fucom %st(1)
+ fnstsw
+ fstp %st(0)
+ fstp %st(0)
+ sahf
+ ja 2f
+ fld %st(0)
+ fistpl -16(%rsp)
+ fildl -16(%rsp)
+ fxch %st(1)
+ fsub %st(1)
+ mov $0x3fff,%eax
+ add %eax,-16(%rsp)
+ f2xm1
+ fld1
+ faddp
+ fldt -24(%rsp)
+ fmulp
+ fstp %st(1)
+ ret
+
+2: fld %st(0)
+ fstpt -24(%rsp)
+ mov -15(%rsp),%ah
+ and $0x7f,%ah
+ cmp $0x7f,%ah
+ jne 1f
+ decb -15(%rsp)
+ fstp %st(0)
+ fldt -24(%rsp)
+1: fld %st(0)
+ frndint
+ fxch %st(1)
+ fsub %st(1)
+ f2xm1
+ fld1
+ faddp
+ fscale
+ fstp %st(1)
+ ret
--- /dev/null
+# see expm1.s
--- /dev/null
+.global floorl
+.type floorl,@function
+floorl:
+ fldt 8(%rsp)
+1: mov $0x7,%al
+1: fstcw 8(%rsp)
+ mov 9(%rsp),%ah
+ mov %al,9(%rsp)
+ fldcw 8(%rsp)
+ frndint
+ mov %ah,9(%rsp)
+ fldcw 8(%rsp)
+ ret
+
+.global ceill
+.type ceill,@function
+ceill:
+ fldt 8(%rsp)
+ mov $0xb,%al
+ jmp 1b
+
+.global truncl
+.type truncl,@function
+truncl:
+ fldt 8(%rsp)
+ mov $0xf,%al
+ jmp 1b
--- /dev/null
+.global llrintl
+.type llrintl,@function
+llrintl:
+ fldt 8(%rsp)
+ fistpq 8(%rsp)
+ mov 8(%rsp),%rax
+ ret
--- /dev/null
+.global log10l
+.type log10l,@function
+log10l:
+ fldlg2
+ fldt 8(%rsp)
+ fyl2x
+ ret
--- /dev/null
+.global log1pl
+.type log1pl,@function
+log1pl:
+ mov 14(%rsp),%eax
+ fldln2
+ and $0x7fffffff,%eax
+ fldt 8(%rsp)
+ cmp $0x3ffd9400,%eax
+ ja 1f
+ fyl2xp1
+ ret
+1: fld1
+ faddp
+ fyl2x
+ ret
--- /dev/null
+.global log2l
+.type log2l,@function
+log2l:
+ fld1
+ fldt 8(%rsp)
+ fyl2x
+ ret
--- /dev/null
+.global logl
+.type logl,@function
+logl:
+ fldln2
+ fldt 8(%rsp)
+ fyl2x
+ ret
--- /dev/null
+.global lrintl
+.type lrintl,@function
+lrintl:
+ fldt 8(%rsp)
+ fistpl 8(%rsp)
+ mov 8(%rsp),%eax
+ ret
--- /dev/null
+.global modfl
+.type modfl,@function
+modfl:
+ fldt 8(%rsp)
+ fxam
+ fnstsw %ax
+ sahf
+ jnp 1f
+ jc 2f
+1: fld1
+ fld %st(1)
+1: fprem
+ fnstsw %ax
+ sahf
+ jp 1b
+ fstp %st(1)
+ fsubr %st(0),%st(1)
+ fxch %st(1)
+ fstpt (%rdi)
+ ret
+
+2: fstpt (%rdi)
+ mov 6(%rdi),%eax
+ and $0x80000000,%eax
+ mov %eax,8(%rsp)
+ flds 8(%rsp)
+ ret
--- /dev/null
+# see floor.s