math: move x86_64 exp2l implementation to exp2l.s from expl.s
authorSzabolcs Nagy <nsz@port70.net>
Sun, 16 Dec 2012 16:28:18 +0000 (17:28 +0100)
committerSzabolcs Nagy <nsz@port70.net>
Sun, 16 Dec 2012 16:28:18 +0000 (17:28 +0100)
src/math/x86_64/exp2l.s
src/math/x86_64/expl.s
src/math/x86_64/expm1l.s

index 510c256dec226bedbf22226aaafd4d1c44fc6024..1f8ed7bb182f2314e00e8e75bd7d00f4073ffbfc 100644 (file)
@@ -1 +1,75 @@
-# see expl.s
+.global expm1l
+.type expm1l,@function
+expm1l:
+       fldt 8(%rsp)
+       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 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)    # 16380
+       fld %st(1)
+       fabs
+       fucom %st(1)
+       fnstsw
+       fstp %st(0)
+       fstp %st(0)
+       sahf
+       ja 3f             # |x| > 16380
+       jp 2f             # x is nan (avoid invalid except in fistp)
+       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             # 2^(x-rint(x))
+       fldt -24(%rsp)    # 2^rint(x)
+       fmulp
+2:     fstp %st(1)
+       ret
+
+3:     fld %st(0)
+       fstpt -24(%rsp)
+       fld1
+       mov -15(%rsp),%ax
+       and $0x7fff,%ax
+       cmp $0x7fff,%ax
+       je 1f             # x = +-inf
+       fld %st(1)
+       frndint
+       fxch %st(2)
+       fsub %st(2)       # st(0)=x-rint(x), st(1)=1, st(2)=rint(x)
+       f2xm1
+       faddp             # 2^(x-rint(x))
+1:     fscale
+       fstp %st(1)
+       ret
index 740bc7790f25f5fbfab4a85dbd7ff77b2abd756a..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,83 +0,0 @@
-.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)    # 16380
-       fld %st(1)
-       fabs
-       fucom %st(1)
-       fnstsw
-       fstp %st(0)
-       fstp %st(0)
-       sahf
-       ja 3f             # |x| > 16380
-       jp 2f             # x is nan (avoid invalid except in fistp)
-       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             # 2^(x-rint(x))
-       fldt -24(%rsp)    # 2^rint(x)
-       fmulp
-2:     fstp %st(1)
-       ret
-
-3:     fld %st(0)
-       fstpt -24(%rsp)
-       fld1
-       mov -15(%rsp),%ax
-       and $0x7fff,%ax
-       cmp $0x7fff,%ax
-       je 1f             # x = +-inf
-       fld %st(1)
-       frndint
-       fxch %st(2)
-       fsub %st(2)       # st(0)=x-rint(x), st(1)=1, st(2)=rint(x)
-       f2xm1
-       faddp             # 2^(x-rint(x))
-1:     fscale
-       fstp %st(1)
-       ret
index 89c2d290019de0e410bb1969a39bdb49a743b6fb..e773f080534a18d72b55ca045df176a327a4c302 100644 (file)
@@ -1 +1 @@
-# see expm1.s
+# see exp2l.s