Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libkern/arch/sh3 Reword the comment about "millicode...



details:   https://anonhg.NetBSD.org/src/rev/59a576c3ea03
branches:  trunk
changeset: 767974:59a576c3ea03
user:      uwe <uwe%NetBSD.org@localhost>
date:      Fri Aug 05 02:00:25 2011 +0000

description:
Reword the comment about "millicode" nature of these functions and add
it to sdivsi3_i4i.S too.

diffstat:

 sys/lib/libkern/arch/sh3/sdivsi3_i4i.S |  29 +++++++++++++++++++--
 sys/lib/libkern/arch/sh3/udivsi3_i4i.S |  46 ++++++++++++++-------------------
 2 files changed, 45 insertions(+), 30 deletions(-)

diffs (112 lines):

diff -r ba670a5081c5 -r 59a576c3ea03 sys/lib/libkern/arch/sh3/sdivsi3_i4i.S
--- a/sys/lib/libkern/arch/sh3/sdivsi3_i4i.S    Fri Aug 05 01:59:39 2011 +0000
+++ b/sys/lib/libkern/arch/sh3/sdivsi3_i4i.S    Fri Aug 05 02:00:25 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdivsi3_i4i.S,v 1.1 2011/08/04 03:20:09 uwe Exp $      */
+/*     $NetBSD: sdivsi3_i4i.S,v 1.2 2011/08/05 02:00:25 uwe Exp $      */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,10 +36,33 @@
 
 #include <machine/asm.h>
 #if defined(LIBC_SCCS)
-       RCSID("$NetBSD: sdivsi3_i4i.S,v 1.1 2011/08/04 03:20:09 uwe Exp $")
+       RCSID("$NetBSD: sdivsi3_i4i.S,v 1.2 2011/08/05 02:00:25 uwe Exp $")
 #endif
 
-/* See comments in udivsi3_i4i.S */
+/*
+ * IMPOTANT: This function is special.
+ *
+ * This function is an auxiliary "millicode" function that is
+ * referenced by the code generated by gcc for signed integer
+ * division.  But gcc does NOT treat a call to this function as an
+ * ordinary function call - it can clobber only R1, MACL and MACH.
+ *
+ * See the definition of "divsi3_i4_int" in gcc/config/sh/sh.md
+ *
+ * As the consequence this function cannot be called via any
+ * indirection that assumes normal calling convention:
+ *
+ * . cannot have _PROF_PROLOGUE
+ * . cannot be called via PLT (not relevant for kernel)
+ *
+ * XXX: uwe: Older gcc used __sdivsi3; newer uses __sdivsi3_i4i - a
+ * heavily tuned version that is NOT compatible with __sdivsi3 because
+ * it clobbers different registers.  We don't want to link the kernel
+ * against libgcc and we don't have resources to write heavily tuned
+ * version ourselves, so clone __sdivsi3 but adjust the code to
+ * conform to the __sdivsi3_i4i clobber spec.
+ */
+
 
 #ifdef __ELF__
        .hidden __sdivsi3_i4i
diff -r ba670a5081c5 -r 59a576c3ea03 sys/lib/libkern/arch/sh3/udivsi3_i4i.S
--- a/sys/lib/libkern/arch/sh3/udivsi3_i4i.S    Fri Aug 05 01:59:39 2011 +0000
+++ b/sys/lib/libkern/arch/sh3/udivsi3_i4i.S    Fri Aug 05 02:00:25 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udivsi3_i4i.S,v 1.1 2011/08/04 03:20:09 uwe Exp $      */
+/*     $NetBSD: udivsi3_i4i.S,v 1.2 2011/08/05 02:00:25 uwe Exp $      */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,39 +36,31 @@
 
 #include <machine/asm.h>
 #if defined(LIBC_SCCS)
-       RCSID("$NetBSD: udivsi3_i4i.S,v 1.1 2011/08/04 03:20:09 uwe Exp $")
+       RCSID("$NetBSD: udivsi3_i4i.S,v 1.2 2011/08/05 02:00:25 uwe Exp $")
 #endif
 
 /*
- * XXX: uwe: this is a kludge...
- *
- * For unsigned integer division gcc used to emit a call to __udivsi3
- * "millicode" function that uses compiler-private ABI.  Newer gcc
- * uses heavily tuned __udivsi3_i4i that is NOT compatible with
- * __udivsi3 because it's expected to clobber different registers.  We
- * don't want to link the kernel against libgcc and we don't have
- * resources to write heavily tuned version ourselves, so clone
- * __udivsi3 but adjust it to conform to the __udivsi3_i4i clobber
- * spec.
- */
-
-/*
  * IMPOTANT: This function is special.
  *
- * This function is an auxiliary function that is referenced by the
- * code generated by gcc for integer division.  But gcc does NOT treat
- * a call to this function as an ordinary function call w.r.t. the set
- * of register this call clobbers.  See the definition of "udivsi3_i1"
- * in gcc/config/sh/sh.md.
+ * This function is an auxiliary "millicode" function that is
+ * referenced by the code generated by gcc for unsigned integer
+ * division.  But gcc does NOT treat a call to this function as an
+ * ordinary function call - it can clobber only R1, MACL and MACH.
+ *
+ * See the definition of "udivsi3_i4_int" in gcc/config/sh/sh.md
+ *
+ * As the consequence this function cannot be called via any
+ * indirection that assumes normal calling convention:
  *
- * Any call to this function MUST NOT clobber any registers besides r4
- * and r0, where the result is returned.  At the time of the call the
- * r4 contains the first argument, so we are only left with r0, and we
- * cannot do anything meaningful using only one register.  The
- * consequences are:
+ * . cannot have _PROF_PROLOGUE
+ * . cannot be called via PLT (not relevant for kernel)
  *
- * . this function cannot have _PROF_PROLOGUE
- * . this function cannot be called via PLT
+ * XXX: uwe: Older gcc used __udivsi3; newer uses __udivsi3_i4i - a
+ * heavily tuned version that is NOT compatible with __udivsi3 because
+ * it clobbers different registers.  We don't want to link the kernel
+ * against libgcc and we don't have resources to write heavily tuned
+ * version ourselves, so clone __udivsi3 but adjust the code to
+ * conform to the __udivsi3_i4i clobber spec.
  */
 
 



Home | Main Index | Thread Index | Old Index