[llvm-commits] [PATCH] va_arg alignment type
Rafael Espindola
espindola at google.com
Thu Oct 14 07:53:30 PDT 2010
On 13 October 2010 22:21, David Meyer <pdox at google.com> wrote:
> Rafael,
> I'm afraid not. <2 x i64> is aligned to 8-bytes on X86-64, both ABI and
> stack.
> I'm not sure there's any way to "test" this change... it may have no
> external effects (except for Native Client). All major architectures have
> stack alignment the same as ABI alignment. In principle, however, I think
> this change is correct.
I tested
define <2 x i64> @test(i32 %a, i32 %b, ...) nounwind optsize {
entry:
%ap = alloca i8*, align 4 ; <i8**> [#uses=3]
%ap1 = bitcast i8** %ap to i8* ; <i8*> [#uses=2]
call void @llvm.va_start(i8* %ap1)
%0 = va_arg i8** %ap, i32 ; <i32> [#uses=0]
%1 = va_arg i8** %ap, <2 x i64> ; <double> [#uses=1]
call void @llvm.va_end(i8* %ap1)
ret <2 x i64> %1
}
declare void @llvm.va_start(i8*) nounwind
declare void @llvm.va_end(i8*) nounwind
With and without your patch. Without your patch there is an extra
addq $15, %rcx
andq $-16, %rcx
in the output. So it is really reducing the alignment requirement of
<2 x i64>. I think but I am not sure that this is a fix and not a
regression :-)
So, is this what you were expecting?
> - David M
Cheers,
--
Rafael Ávila de Espíndola
More information about the llvm-commits
mailing list