浏览代码

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.
Rich Felker 13 年之前
父节点
当前提交
8d9e948652

+ 6 - 0
src/math/i386/fabs.s

@@ -0,0 +1,6 @@
+.global fabs
+.type fabs,@function
+fabs:
+	fldl 4(%esp)
+	fabs
+	ret

+ 6 - 0
src/math/i386/fabsf.s

@@ -0,0 +1,6 @@
+.global fabsf
+.type fabsf,@function
+fabsf:
+	flds 4(%esp)
+	fabs
+	ret

+ 6 - 0
src/math/i386/fabsl.s

@@ -0,0 +1,6 @@
+.global fabsl
+.type fabsl,@function
+fabsl:
+	fldt 4(%esp)
+	fabs
+	ret

+ 6 - 0
src/math/i386/rint.s

@@ -0,0 +1,6 @@
+.global rint
+.type rint,@function
+rint:
+	fldl 4(%esp)
+	frndint
+	ret

+ 6 - 0
src/math/i386/rintf.s

@@ -0,0 +1,6 @@
+.global rintf
+.type rintf,@function
+rintf:
+	flds 4(%esp)
+	frndint
+	ret

+ 6 - 0
src/math/i386/rintl.s

@@ -0,0 +1,6 @@
+.global rintl
+.type rintl,@function
+rintl:
+	fldt 4(%esp)
+	frndint
+	ret

+ 6 - 0
src/math/x86_64/fabsl.s

@@ -0,0 +1,6 @@
+.global fabsl
+.type fabsl,@function
+fabsl:
+	fldt 8(%rsp)
+	fabs
+	ret

+ 6 - 0
src/math/x86_64/rintl.s

@@ -0,0 +1,6 @@
+.global rintl
+.type rintl,@function
+rintl:
+	fldt 8(%rsp)
+	frndint
+	ret