Add amd64 assembly versions of div(3), ldiv(3), and lldiv(3).
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 26 Apr 2009 04:23:41 +0000 (04:23 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 21 Jun 2009 08:12:08 +0000 (08:12 +0000)
Obtained-from: FreeBSD

lib/libc/amd64/stdlib/Makefile.inc [new file with mode: 0644]
lib/libc/amd64/stdlib/div.S [new file with mode: 0644]
lib/libc/amd64/stdlib/ldiv.S [new file with mode: 0644]
lib/libc/amd64/stdlib/lldiv.S [new file with mode: 0644]

diff --git a/lib/libc/amd64/stdlib/Makefile.inc b/lib/libc/amd64/stdlib/Makefile.inc
new file mode 100644 (file)
index 0000000..2087358
--- /dev/null
@@ -0,0 +1,4 @@
+#      @(#)Makefile.inc        8.1 (Berkeley) 6/4/93
+# $FreeBSD: src/lib/libc/amd64/stdlib/Makefile.inc,v 1.1 2007/04/04 01:19:54 jkim Exp $
+
+MDSRCS+=div.S ldiv.S lldiv.S
diff --git a/lib/libc/amd64/stdlib/div.S b/lib/libc/amd64/stdlib/div.S
new file mode 100644 (file)
index 0000000..2481530
--- /dev/null
@@ -0,0 +1,19 @@
+/*     $NetBSD: div.S,v 1.1 2001/06/19 00:25:04 fvdl Exp $     */
+
+/*-
+ * Written by Frank van der Linden (fvdl@wasabisystems.com)
+ * Public domain.
+ *
+ * $FreeBSD: src/lib/libc/amd64/stdlib/div.S,v 1.2 2008/11/02 01:10:54 peter Exp $
+ */
+
+#include <machine/asm.h>
+
+ENTRY(div)
+       movl    %edi,%eax
+       cltd
+       idivl   %esi
+       salq    $32,%rdx
+       orq     %rdx,%rax
+       ret
+END(div)
diff --git a/lib/libc/amd64/stdlib/ldiv.S b/lib/libc/amd64/stdlib/ldiv.S
new file mode 100644 (file)
index 0000000..e58cd87
--- /dev/null
@@ -0,0 +1,17 @@
+/*     $NetBSD: ldiv.S,v 1.1 2001/06/19 00:25:04 fvdl Exp $    */
+
+/*-
+ * Written by gcc 3.0.
+ * Copy/pasted by Frank van der Linden (fvdl@wasabisystems.com)
+ *
+ * $FreeBSD: src/lib/libc/amd64/stdlib/ldiv.S,v 1.2 2008/11/02 01:10:54 peter Exp $
+ */
+
+#include <machine/asm.h>
+
+ENTRY(ldiv)
+       movq    %rdi,%rax
+       cqto
+       idivq   %rsi
+       ret
+END(ldiv)
diff --git a/lib/libc/amd64/stdlib/lldiv.S b/lib/libc/amd64/stdlib/lldiv.S
new file mode 100644 (file)
index 0000000..4b5c105
--- /dev/null
@@ -0,0 +1,17 @@
+/*     $NetBSD: ldiv.S,v 1.1 2001/06/19 00:25:04 fvdl Exp $    */
+
+/*-
+ * Written by gcc 3.0.
+ * Copy/pasted by Frank van der Linden (fvdl@wasabisystems.com)
+ *
+ * $FreeBSD: src/lib/libc/amd64/stdlib/lldiv.S,v 1.2 2008/11/02 01:10:54 peter Exp $
+ */
+
+#include <machine/asm.h>
+
+ENTRY(lldiv)
+       movq    %rdi,%rax
+       cqto
+       idivq   %rsi
+       ret
+END(lldiv)