Re: [PATCH] Fix ppc64 out_be64

From: Roland Dreier
Date: Mon Jun 14 2004 - 15:32:09 EST


Benjamin> Well, I may know ppc asm, but gcc inline asm still
Benjamin> drives me nuts :)

Speaking of gcc asm, is there a reason why out_le64 (specifically the
constraints) isn't written in this (simpler) way? It seems to me we
can just let val be an input, as long as the "&" constraint for tmp
makes sure it doesn't share the same register. This seems to generate
the same code for me as the current kernel version, at least with gcc
3.4.0/binutils 2.15.

static inline void out_le64(volatile unsigned long *addr, unsigned long val)
{
unsigned long tmp;

__asm__ __volatile__(
"rldimi %0,%2,5*8,1*8\n"
"rldimi %0,%2,3*8,2*8\n"
"rldimi %0,%2,1*8,3*8\n"
"rldimi %0,%2,7*8,4*8\n"
"rldicl %2,%2,32,0\n"
"rlwimi %0,%2,8,8,31\n"
"rlwimi %0,%2,24,16,23\n"
"std %0,%1\n"
"sync"
: "=&r" (tmp), "=m" (*addr) : "r" (val));
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/