ldl_u() used for aligned access

Harald Koenig (koenig@tat.physik.uni-tuebingen.de)
Mon, 11 Nov 1996 16:38:48 +0100 (MET)


what's the best way to have a ldl_u() routine which does
use the special asm commands only when the argumet is really unaligned
since using the unaligned access commands takes much more time
than a normal accesss, so the additional test shouldn't be too bad
and it would give a big performace win for aligned accesses.

is there a better to achieve this than just adding those 2 lines below ?

--- Xserver/hw/xfree86/common/compiler.h~ Tue Oct 8 22:36:59 1996
+++ Xserver/hw/xfree86/common/compiler.h Mon Nov 11 14:56:40 1996
@@ -168,6 +168,7 @@
static __inline__ unsigned long ldl_u(unsigned int * r11)
{
unsigned long r1,r2;
+ if (((long)r11) & 3)
__asm__("ldq_u %0,%3\n\t"
"ldq_u %1,%4\n\t"
"extll %0,%2,%0\n\t"
@@ -177,6 +178,7 @@
:"r" (r11),
"m" (*r11),
"m" (*(unsigned long *)(3+(char *) r11)));
+ else r1 = *r11;
return r1;
}

Harald

--
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^