|
From: Jan-Benedict G. <jb...@us...> - 2005-05-24 02:14:59
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22476 Modified Files: Makefile Added Files: udiv.c urem.c Log Message: - Thanks to Kenn, I found my bad __udiv() function... - __urem() can most probably be done better, though. - Sunrise starts, I'd go to bed. --- NEW FILE: urem.c --- typedef signed int SItype __attribute__ ((mode (SI))); typedef unsigned int USItype __attribute__ ((mode (SI))); typedef signed long long DItype __attribute__ ((mode (DI))); typedef unsigned long long UDItype __attribute__ ((mode (DI))); /* * This could probably be done better, but without clobbering r[2-4], gcc * re-used the MSB longword of the dividend, most probably because I * haven't told him correctly that this is a DItype... * * Also, keep an eye on where 'ret' gets allocated to. We want to keep * r0 unsused up to this point so gcc will schedult r0 for output which * will save another MOVL. */ USItype __urem (USItype dividend, USItype divisor) { USItype ret; USItype quotient; __asm__ ( " movl %3, %%r2 \n" /* r[23] = dividend */ " clrl %%r3 \n" /* */ " movl %2, %%r4 \n" /* r4 = divisor */ " ediv %%r4, %%r2, %1, %0 \n" /* %0 = dividend % divisor */ : "=g" (ret), "=g" (quotient) : "g" (divisor), "g" (dividend) : "r2", "r3", "r4"); return ret; } --- NEW FILE: udiv.c --- typedef signed int SItype __attribute__ ((mode (SI))); typedef unsigned int USItype __attribute__ ((mode (SI))); USItype __udiv (USItype dividend, USItype divisor) { USItype ret; __asm__ ( " divl3 %2, %1, %0 \n" : "=g" (ret) : "g" (dividend), "g" (divisor)); return ret; } Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/lib/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Makefile 13 Oct 2003 01:07:26 -0000 1.8 +++ Makefile 24 May 2005 02:14:36 -0000 1.9 @@ -2,6 +2,7 @@ # Makefile for the linux kernel. # -lib-y := string.o negdi.o checksum.o lshrdi3.o strncpy_user.o \ - copy_tofrom_user.o strnlen_user.o clear_user.o +lib-y := string.o negdi.o checksum.o lshrdi3.o strncpy_user.o \ + copy_tofrom_user.o strnlen_user.o clear_user.o \ + udiv.o urem.o |