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 3 4 ; CHECK: test1: 5 ; CHECK-NOT: bfc 6 ; CHECK: add [[REG:(r[0-9]+)|(lr)]], {{(r[0-9]+)|(lr)}}, #7 7 ; CHECK: bfc [[REG]], #0, #3 8 ; CHECK-NOT: bfc 9 10 define i64 @test1(i32 %i, ...) nounwind optsize { 11 entry: 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) 17 ret i64 %0 18 } 19 20 ; CHECK: test2: 21 ; CHECK-NOT: bfc 22 ; CHECK: add [[REG:(r[0-9]+)|(lr)]], {{(r[0-9]+)|(lr)}}, #7 23 ; CHECK: bfc [[REG]], #0, #3 24 ; CHECK-NOT: bfc 25 ; CHECK: bx lr 26 27 define double @test2(i32 %a, i32 %b, ...) nounwind optsize { 28 entry: 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) 35 ret double %1 36 } 37 38 39 declare void @llvm.va_start(i8*) nounwind 40 41 declare void @llvm.va_end(i8*) nounwind 42