Browse Source

new math asm (abs/rounding) for x86_64

untested
Rich Felker 13 years ago
parent
commit
0e4a995213

+ 9 - 0
src/math/x86_64/fabs.s

@@ -0,0 +1,9 @@
+.global fabs
+.type fabs,@function
+fabs:
+	xor %eax,%eax
+	dec %rax
+	shr %rax
+	movq %rax,%xmm1
+	andpd %xmm1,%xmm0
+	ret

+ 7 - 0
src/math/x86_64/fabsf.s

@@ -0,0 +1,7 @@
+.global fabsf
+.type fabsf,@function
+fabsf:
+	mov $0x7fffffff,%eax
+	movq %rax,%xmm1
+	andps %xmm1,%xmm0
+	ret

+ 5 - 0
src/math/x86_64/llrint.s

@@ -0,0 +1,5 @@
+.global llrint
+.type llrint,@function
+llrint:
+	cvtsd2si @xmm0,%rax
+	ret

+ 5 - 0
src/math/x86_64/llrintf.s

@@ -0,0 +1,5 @@
+.global llrintf
+.type llrintf,@function
+llrintf:
+	cvtss2si @xmm0,%rax
+	ret

+ 5 - 0
src/math/x86_64/lrint.s

@@ -0,0 +1,5 @@
+.global lrint
+.type lrint,@function
+lrint:
+	cvtsd2si @xmm0,%rax
+	ret

+ 5 - 0
src/math/x86_64/lrintf.s

@@ -0,0 +1,5 @@
+.global lrintf
+.type lrintf,@function
+lrintf:
+	cvtss2si @xmm0,%rax
+	ret