asm versions of some simple math functions for i386 and x86_64
authorRich Felker <dalias@aerifal.cx>
Sun, 18 Mar 2012 20:43:54 +0000 (16:43 -0400)
committerRich Felker <dalias@aerifal.cx>
Sun, 18 Mar 2012 20:43:54 +0000 (16:43 -0400)
these are functions that have direct fpu approaches to implementation
without problematic exception or rounding issues. x86_64 lacks
float/double versions because i'm unfamiliar with the necessary sse
code for performing these operations.

src/math/i386/fabs.s [new file with mode: 0644]
src/math/i386/fabsf.s [new file with mode: 0644]
src/math/i386/fabsl.s [new file with mode: 0644]
src/math/i386/rint.s [new file with mode: 0644]
src/math/i386/rintf.s [new file with mode: 0644]
src/math/i386/rintl.s [new file with mode: 0644]
src/math/x86_64/fabsl.s [new file with mode: 0644]
src/math/x86_64/rintl.s [new file with mode: 0644]

diff --git a/src/math/i386/fabs.s b/src/math/i386/fabs.s
new file mode 100644 (file)
index 0000000..d66ea9a
--- /dev/null
@@ -0,0 +1,6 @@
+.global fabs
+.type fabs,@function
+fabs:
+       fldl 4(%esp)
+       fabs
+       ret
diff --git a/src/math/i386/fabsf.s b/src/math/i386/fabsf.s
new file mode 100644 (file)
index 0000000..a981c42
--- /dev/null
@@ -0,0 +1,6 @@
+.global fabsf
+.type fabsf,@function
+fabsf:
+       flds 4(%esp)
+       fabs
+       ret
diff --git a/src/math/i386/fabsl.s b/src/math/i386/fabsl.s
new file mode 100644 (file)
index 0000000..ceef9e4
--- /dev/null
@@ -0,0 +1,6 @@
+.global fabsl
+.type fabsl,@function
+fabsl:
+       fldt 4(%esp)
+       fabs
+       ret
diff --git a/src/math/i386/rint.s b/src/math/i386/rint.s
new file mode 100644 (file)
index 0000000..bb99a11
--- /dev/null
@@ -0,0 +1,6 @@
+.global rint
+.type rint,@function
+rint:
+       fldl 4(%esp)
+       frndint
+       ret
diff --git a/src/math/i386/rintf.s b/src/math/i386/rintf.s
new file mode 100644 (file)
index 0000000..bce4c5a
--- /dev/null
@@ -0,0 +1,6 @@
+.global rintf
+.type rintf,@function
+rintf:
+       flds 4(%esp)
+       frndint
+       ret
diff --git a/src/math/i386/rintl.s b/src/math/i386/rintl.s
new file mode 100644 (file)
index 0000000..cd2bf9a
--- /dev/null
@@ -0,0 +1,6 @@
+.global rintl
+.type rintl,@function
+rintl:
+       fldt 4(%esp)
+       frndint
+       ret
diff --git a/src/math/x86_64/fabsl.s b/src/math/x86_64/fabsl.s
new file mode 100644 (file)
index 0000000..4e7ab52
--- /dev/null
@@ -0,0 +1,6 @@
+.global fabsl
+.type fabsl,@function
+fabsl:
+       fldt 8(%rsp)
+       fabs
+       ret
diff --git a/src/math/x86_64/rintl.s b/src/math/x86_64/rintl.s
new file mode 100644 (file)
index 0000000..64e663c
--- /dev/null
@@ -0,0 +1,6 @@
+.global rintl
+.type rintl,@function
+rintl:
+       fldt 8(%rsp)
+       frndint
+       ret