1 ; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi -pre-RA-sched=source | FileCheck %s
2 ; Test that we correctly align elements when using va_arg
6 ; CHECK: add [[REG:(r[0-9]+)|(lr)]], {{(r[0-9]+)|(lr)}}, #7
7 ; CHECK: bic {{(r[0-9]+)|(lr)}}, [[REG]], #7
10 define i64 @test1(i32 %i, ...) nounwind optsize {
12 %g = alloca i8*, align 4
13 %g1 = bitcast i8** %g to i8*
14 call void @llvm.va_start(i8* %g1)
15 %0 = va_arg i8** %g, i64
16 call void @llvm.va_end(i8* %g1)
22 ; CHECK: add [[REG:(r[0-9]+)|(lr)]], {{(r[0-9]+)|(lr)}}, #7
23 ; CHECK: bic {{(r[0-9]+)|(lr)}}, [[REG]], #7
27 define double @test2(i32 %a, i32* %b, ...) nounwind optsize {
29 %ap = alloca i8*, align 4 ; <i8**> [#uses=3]
30 %ap1 = bitcast i8** %ap to i8* ; <i8*> [#uses=2]
31 call void @llvm.va_start(i8* %ap1)
32 %0 = va_arg i8** %ap, i32 ; <i32> [#uses=0]
34 %1 = va_arg i8** %ap, double ; <double> [#uses=1]
35 call void @llvm.va_end(i8* %ap1)
40 declare void @llvm.va_start(i8*) nounwind
42 declare void @llvm.va_end(i8*) nounwind