@@ -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)
+ sahf
+ ja 1f
+ f2xm1
+ ret
+1: push %rax
+ call 1f
+ pop %rax
+ fsubrp
+
+.global exp2l
+.type exp2l,@function
+exp2l:
+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
+ fnstsw
+ 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)
+ faddp # 2^(x-rint(x))
+ fldt -24(%rsp) # 2^rint(x)
+2: fstp %st(1)
+3: fld %st(0)
+ fstpt -24(%rsp)
+ mov -15(%rsp),%ax
+ and $0x7fff,%ax
+ cmp $0x7fff,%ax
+ je 1f # x = +-inf
+ frndint
+ fxch %st(2)
+ fsub %st(2) # st(0)=x-rint(x), st(1)=1, st(2)=rint(x)
+1: fscale
+ fstp %st(1)
@@ -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)
- sahf
- ja 1f
- f2xm1
- ret
-1: push %rax
- call 1f
- pop %rax
- fsubrp
-
-.global expl
-.type expl,@function
-expl:
- fldl2e
- jmp 1f
-.global exp2l
-.type exp2l,@function
-exp2l:
-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
- fnstsw
- 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)
- faddp # 2^(x-rint(x))
- fldt -24(%rsp) # 2^rint(x)
-2: fstp %st(1)
-3: fld %st(0)
- fstpt -24(%rsp)
- mov -15(%rsp),%ax
- and $0x7fff,%ax
- cmp $0x7fff,%ax
- je 1f # x = +-inf
- frndint
- fxch %st(2)
- fsub %st(2) # st(0)=x-rint(x), st(1)=1, st(2)=rint(x)
-1: fscale
- fstp %st(1)
@@ -1 +1 @@
-# see expm1.s
+# see exp2l.s