Module Name:    src
Committed By:   uwe
Date:           Fri Aug  5 02:00:25 UTC 2011

Modified Files:
        src/sys/lib/libkern/arch/sh3: sdivsi3_i4i.S udivsi3_i4i.S

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


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/lib/libkern/arch/sh3/sdivsi3_i4i.S \
    src/sys/lib/libkern/arch/sh3/udivsi3_i4i.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libkern/arch/sh3/sdivsi3_i4i.S
diff -u src/sys/lib/libkern/arch/sh3/sdivsi3_i4i.S:1.1 src/sys/lib/libkern/arch/sh3/sdivsi3_i4i.S:1.2
--- src/sys/lib/libkern/arch/sh3/sdivsi3_i4i.S:1.1	Thu Aug  4 03:20:09 2011
+++ src/sys/lib/libkern/arch/sh3/sdivsi3_i4i.S	Fri Aug  5 02:00:25 2011
@@ -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
Index: src/sys/lib/libkern/arch/sh3/udivsi3_i4i.S
diff -u src/sys/lib/libkern/arch/sh3/udivsi3_i4i.S:1.1 src/sys/lib/libkern/arch/sh3/udivsi3_i4i.S:1.2
--- src/sys/lib/libkern/arch/sh3/udivsi3_i4i.S:1.1	Thu Aug  4 03:20:09 2011
+++ src/sys/lib/libkern/arch/sh3/udivsi3_i4i.S	Fri Aug  5 02:00:25 2011
@@ -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.
- *
- * 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:
- *
- * . this function cannot have _PROF_PROLOGUE
- * . this function cannot be called via PLT
+ * 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:
+ *
+ * . cannot have _PROF_PROLOGUE
+ * . cannot be called via PLT (not relevant for kernel)
+ *
+ * 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.
  */
 
 

Reply via email to