From 8d9e948652eb8381f1f376cbd0c9bc5e2947d150 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 18 Mar 2012 16:43:54 -0400 Subject: [PATCH] asm versions of some simple math functions for i386 and x86_64 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 | 6 ++++++ src/math/i386/fabsf.s | 6 ++++++ src/math/i386/fabsl.s | 6 ++++++ src/math/i386/rint.s | 6 ++++++ src/math/i386/rintf.s | 6 ++++++ src/math/i386/rintl.s | 6 ++++++ src/math/x86_64/fabsl.s | 6 ++++++ src/math/x86_64/rintl.s | 6 ++++++ 8 files changed, 48 insertions(+) create mode 100644 src/math/i386/fabs.s create mode 100644 src/math/i386/fabsf.s create mode 100644 src/math/i386/fabsl.s create mode 100644 src/math/i386/rint.s create mode 100644 src/math/i386/rintf.s create mode 100644 src/math/i386/rintl.s create mode 100644 src/math/x86_64/fabsl.s create mode 100644 src/math/x86_64/rintl.s diff --git a/src/math/i386/fabs.s b/src/math/i386/fabs.s new file mode 100644 index 00000000..d66ea9a1 --- /dev/null +++ b/src/math/i386/fabs.s @@ -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 index 00000000..a981c422 --- /dev/null +++ b/src/math/i386/fabsf.s @@ -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 index 00000000..ceef9e4c --- /dev/null +++ b/src/math/i386/fabsl.s @@ -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 index 00000000..bb99a11c --- /dev/null +++ b/src/math/i386/rint.s @@ -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 index 00000000..bce4c5a6 --- /dev/null +++ b/src/math/i386/rintf.s @@ -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 index 00000000..cd2bf9a9 --- /dev/null +++ b/src/math/i386/rintl.s @@ -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 index 00000000..4e7ab525 --- /dev/null +++ b/src/math/x86_64/fabsl.s @@ -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 index 00000000..64e663cd --- /dev/null +++ b/src/math/x86_64/rintl.s @@ -0,0 +1,6 @@ +.global rintl +.type rintl,@function +rintl: + fldt 8(%rsp) + frndint + ret -- 2.25.1