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: bfc [[REG]], #0, #3
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: bfc [[REG]], #0, #3
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]
33 %1 = va_arg i8** %ap, double ; <double> [#uses=1]
34 call void @llvm.va_end(i8* %ap1)
39 declare void @llvm.va_start(i8*) nounwind
41 declare void @llvm.va_end(i8*) nounwind