Hi,
On SPU, variables in the .bss section that are allocated with the .lcomm
directive are not aligned on 16 byte boundaries. This causes misaligned loads,
as the generated assembly assumes this "default" alignment.
A patch to disable .lcomm in favour of '.local .comm' is attached.
kalle
P.s.
As an example, the following function returns '3', when '5' is
expected:
; cause the_vector to not be aligned on natural (16 byte) bounds
@misaligner = internal global i32 zeroinitializer
@the_vector = internal global <6 x i32> zeroinitializer
define i32 @align_test() {
store <6 x i32> <i32 1, i32 2, i32 3, i32 4, i32 5, i32 6>, <6
x i32>*
@the_vector
%loadedval = load i32* getelementptr inbounds (<6 x i32>* @the_vector,
i64 0,
i64 4 );
ret i32 %loadedval
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spu-nolcomm.patch
Type: text/x-patch
Size: 845 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20100407/6147d77c/attachment.bin>