Unaligned 64-bits access on FreeBSD/powerpc

Maxim Sobolev sobomax at FreeBSD.org
Thu Aug 3 19:39:28 UTC 2006


Peter Grehan wrote:
>> According to the following link, unaligned floating-point 64-bits 
>> access isn't supported in the PowerPC:
>>
>> http://www-128.ibm.com/developerworks/library/pa-dalign/
> 
>  Yep, that's right: I should have mentioned that unaligned ints are OK. 
> Which your program demonstrates :)
> 
>>         atype = "64";
>>         for (i = 0; i < 256; i++) {
>>             apoint = (uint8_t *)&(buf[i]);
>>             v64 = *(uint64_t *)apoint;
>>         }
> 
>  Would you be able to do a disassembly on this ? I suspect gcc is using 
> floating-point regs to do the 64-bit loads.

--- test.c ----
long long
test(void)
{
     volatile long long *foo = (long long *)0x1234;

     return(*foo);
}
--- test.s ---
test:
         stwu 1,-32(1)
         stw 31,28(1)
         mr 31,1
         li 0,4660
         stw 0,8(31)
         lwz 9,8(31)
         lfd 0,0(9)
         stfd 0,16(31)
         lwz 9,16(31)
         lwz 10,20(31)
         mr 3,9
         mr 4,10
         lwz 11,0(1)
         lwz 31,-4(11)
         mr 1,11
         blr

-Maxim


More information about the freebsd-ppc mailing list