egcs-1.1 bug or invalid inline assembler?

Franz Sirl
Sun Aug 2 06:11:00 GMT 1998


I have a problem with inline assembler and egcs-1.1 (already there with
egcs-1.0). If the following PPC inline assembler is activated in the linux
kernel, the kernel corrupts the filesystem.

static __inline__ __const__ __u16 ___arch__swab16(__u16 value)
	__u16 result;

	__asm__("rlwimi %0,%1,8,16,23"
	    : "=r" (result)
	    : "r" (value), "0" (value >> 8));
	return result;

static __inline__ __const__ __u32 ___arch__swab32(__u32 value)
	__u32 result;

	__asm__("rlwimi %0,%2,24,16,23" : "=r" (result) : "0" (value>>24), "r" (value));
	__asm__("rlwimi %0,%2,8,8,15"   : "=r" (result) : "0" (result),    "r" (value));
	__asm__("rlwimi %0,%2,24,0,7"   : "=r" (result) : "0" (result),    "r" (value));
	return result;

I just want to know if there is something wrong with the inline assembler
code (clobbers, earlyclobbers, volatile asm?), otherwise I will try to come up
with a testcase.
If it turns out to be an egcs bug, this is _no_ problem for the
egcs-1.1 release schedule (better work on gcc.dg/980526-1.c ;-) ), as it can
easily be disabled in the kernel.

Any hints appreciated,

More information about the Gcc-bugs mailing list