From 58ff9e8eaf99f2294232be860daa2ca6f3674faf Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 19 Mar 2012 05:15:30 -0400 Subject: [PATCH 1/1] asm for scalbn family unlike some implementations, these functions perform the equivalent of gcc's -ffloat-store on the result before returning. this is necessary to raise underflow/overflow/inexact exceptions, perform the correct rounding with denormals, etc. --- src/math/i386/ldexp.s | 1 + src/math/i386/ldexpf.s | 1 + src/math/i386/ldexpl.s | 1 + src/math/i386/scalbln.s | 1 + src/math/i386/scalblnf.s | 1 + src/math/i386/scalblnl.s | 1 + src/math/i386/scalbn.s | 20 ++++++++++++++++++++ src/math/i386/scalbnf.s | 20 ++++++++++++++++++++ src/math/i386/scalbnl.s | 18 ++++++++++++++++++ 9 files changed, 64 insertions(+) create mode 100644 src/math/i386/ldexp.s create mode 100644 src/math/i386/ldexpf.s create mode 100644 src/math/i386/ldexpl.s create mode 100644 src/math/i386/scalbln.s create mode 100644 src/math/i386/scalblnf.s create mode 100644 src/math/i386/scalblnl.s create mode 100644 src/math/i386/scalbn.s create mode 100644 src/math/i386/scalbnf.s create mode 100644 src/math/i386/scalbnl.s diff --git a/src/math/i386/ldexp.s b/src/math/i386/ldexp.s new file mode 100644 index 00000000..c430f784 --- /dev/null +++ b/src/math/i386/ldexp.s @@ -0,0 +1 @@ +# see scalbn.s diff --git a/src/math/i386/ldexpf.s b/src/math/i386/ldexpf.s new file mode 100644 index 00000000..3f8e4b95 --- /dev/null +++ b/src/math/i386/ldexpf.s @@ -0,0 +1 @@ +# see scalbnf.s diff --git a/src/math/i386/ldexpl.s b/src/math/i386/ldexpl.s new file mode 100644 index 00000000..86fe5621 --- /dev/null +++ b/src/math/i386/ldexpl.s @@ -0,0 +1 @@ +# see scalbnl.s diff --git a/src/math/i386/scalbln.s b/src/math/i386/scalbln.s new file mode 100644 index 00000000..c430f784 --- /dev/null +++ b/src/math/i386/scalbln.s @@ -0,0 +1 @@ +# see scalbn.s diff --git a/src/math/i386/scalblnf.s b/src/math/i386/scalblnf.s new file mode 100644 index 00000000..3f8e4b95 --- /dev/null +++ b/src/math/i386/scalblnf.s @@ -0,0 +1 @@ +# see scalbnf.s diff --git a/src/math/i386/scalblnl.s b/src/math/i386/scalblnl.s new file mode 100644 index 00000000..86fe5621 --- /dev/null +++ b/src/math/i386/scalblnl.s @@ -0,0 +1 @@ +# see scalbnl.s diff --git a/src/math/i386/scalbn.s b/src/math/i386/scalbn.s new file mode 100644 index 00000000..e275d14f --- /dev/null +++ b/src/math/i386/scalbn.s @@ -0,0 +1,20 @@ +.global ldexp +.type ldexp,@function +ldexp: + nop + +.global scalbln +.type scalbln,@function +scalbln: + nop + +.global scalbn +.type scalbn,@function +scalbn: + fildl 12(%esp) + fldl 4(%esp) + fscale + fstp %st(1) + fstpl 4(%esp) + fldl 4(%esp) + ret diff --git a/src/math/i386/scalbnf.s b/src/math/i386/scalbnf.s new file mode 100644 index 00000000..40232b6a --- /dev/null +++ b/src/math/i386/scalbnf.s @@ -0,0 +1,20 @@ +.global ldexpf +.type ldexpf,@function +ldexpf: + nop + +.global scalblnf +.type scalblnf,@function +scalblnf: + nop + +.global scalbnf +.type scalbnf,@function +scalbnf: + fildl 8(%esp) + flds 4(%esp) + fscale + fstp %st(1) + fstps 4(%esp) + flds 4(%esp) + ret diff --git a/src/math/i386/scalbnl.s b/src/math/i386/scalbnl.s new file mode 100644 index 00000000..224b1bef --- /dev/null +++ b/src/math/i386/scalbnl.s @@ -0,0 +1,18 @@ +.global ldexpl +.type ldexpl,@function +ldexpl: + nop + +.global scalblnl +.type scalblnl,@function +scalblnl: + nop + +.global scalbnl +.type scalbnl,@function +scalbnl: + fildl 16(%esp) + fldt 4(%esp) + fscale + fstp %st(1) + ret -- 2.20.1