new math asm (abs/rounding) for x86_64
authorRich Felker <dalias@aerifal.cx>
Mon, 30 Apr 2012 00:31:46 +0000 (20:31 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 30 Apr 2012 00:31:46 +0000 (20:31 -0400)
untested

src/math/x86_64/fabs.s [new file with mode: 0644]
src/math/x86_64/fabsf.s [new file with mode: 0644]
src/math/x86_64/llrint.s [new file with mode: 0644]
src/math/x86_64/llrintf.s [new file with mode: 0644]
src/math/x86_64/lrint.s [new file with mode: 0644]
src/math/x86_64/lrintf.s [new file with mode: 0644]

diff --git a/src/math/x86_64/fabs.s b/src/math/x86_64/fabs.s
new file mode 100644 (file)
index 0000000..5715005
--- /dev/null
@@ -0,0 +1,9 @@
+.global fabs
+.type fabs,@function
+fabs:
+       xor %eax,%eax
+       dec %rax
+       shr %rax
+       movq %rax,%xmm1
+       andpd %xmm1,%xmm0
+       ret
diff --git a/src/math/x86_64/fabsf.s b/src/math/x86_64/fabsf.s
new file mode 100644 (file)
index 0000000..501a1f1
--- /dev/null
@@ -0,0 +1,7 @@
+.global fabsf
+.type fabsf,@function
+fabsf:
+       mov $0x7fffffff,%eax
+       movq %rax,%xmm1
+       andps %xmm1,%xmm0
+       ret
diff --git a/src/math/x86_64/llrint.s b/src/math/x86_64/llrint.s
new file mode 100644 (file)
index 0000000..0de0658
--- /dev/null
@@ -0,0 +1,5 @@
+.global llrint
+.type llrint,@function
+llrint:
+       cvtsd2si @xmm0,%rax
+       ret
diff --git a/src/math/x86_64/llrintf.s b/src/math/x86_64/llrintf.s
new file mode 100644 (file)
index 0000000..b05f7be
--- /dev/null
@@ -0,0 +1,5 @@
+.global llrintf
+.type llrintf,@function
+llrintf:
+       cvtss2si @xmm0,%rax
+       ret
diff --git a/src/math/x86_64/lrint.s b/src/math/x86_64/lrint.s
new file mode 100644 (file)
index 0000000..59b1203
--- /dev/null
@@ -0,0 +1,5 @@
+.global lrint
+.type lrint,@function
+lrint:
+       cvtsd2si @xmm0,%rax
+       ret
diff --git a/src/math/x86_64/lrintf.s b/src/math/x86_64/lrintf.s
new file mode 100644 (file)
index 0000000..951894b
--- /dev/null
@@ -0,0 +1,5 @@
+.global lrintf
+.type lrintf,@function
+lrintf:
+       cvtss2si @xmm0,%rax
+       ret