Messages in this thread | | | Date | Tue, 22 Apr 2003 11:24:54 +0300 | From | Shachar Shemesh <> | Subject | Re: [PATCH] new system call mknod64 |
| |
Jamie Lokier wrote:
>It varies very much between architectures. > >I just checked, and simple copies of this structure are absolutely >atrocious in GCC 3.2 (I tried Alpha, Mips64 and Sparc64). The code >was approx. 3 times longer to copy the 32:32 struct than to copy a 64 >bit scalar. > > Last time I had access to gcc on sparc, copying a struct where the compiler guessed that non-aligned access may occure produced code that was guarenteed not to crash the program. This was tested in user mode, in 32 bit, but still...
Copying a struct with two 32 bit values does not prove to the compiler that it will be 64bit aligned. It is therefor reasonable for the compiler to assume it needs two 32 bit transfers, rather than one 64 bit transfer. Try adding "#pragme align 8", or whatever it is called, and seeing if this inefficiency goes away.
>On x86_64, the struct produces the same code as the scalar. >The same is true on s390x. > > I don't know how x86_64 is doing, but x86 does not issue a bus error when unaligned value is being accessed. It is therefor reasonable for the compiler not to worry about it. If x86_64 is the same, the results you report seem like a reasonable feature of gcc, rather than a bug.
Shachar
-- Shachar Shemesh Open Source integration consultant Home page & resume - http://www.shemesh.biz/
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |