2011-04-13 02:38:32 +02:00
|
|
|
; RUN: llc < %s -mtriple=armv7-none-linux-gnueabi -pre-RA-sched=source | FileCheck %s
|
2010-06-26 20:22:20 +02:00
|
|
|
; Test that we correctly align elements when using va_arg
|
|
|
|
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test1:
|
2010-07-11 06:01:49 +02:00
|
|
|
; CHECK-NOT: bfc
|
2011-04-13 02:38:32 +02:00
|
|
|
; CHECK: add [[REG:(r[0-9]+)|(lr)]], {{(r[0-9]+)|(lr)}}, #7
|
2017-04-08 00:01:23 +02:00
|
|
|
; CHECK: bic {{(r[0-9]+)|(lr)}}, [[REG]], #7
|
|
|
|
; CHECK-NOT: bic
|
2010-06-26 20:22:20 +02:00
|
|
|
|
2010-07-11 06:01:49 +02:00
|
|
|
define i64 @test1(i32 %i, ...) nounwind optsize {
|
2010-06-26 20:22:20 +02:00
|
|
|
entry:
|
|
|
|
%g = alloca i8*, align 4
|
|
|
|
%g1 = bitcast i8** %g to i8*
|
|
|
|
call void @llvm.va_start(i8* %g1)
|
|
|
|
%0 = va_arg i8** %g, i64
|
|
|
|
call void @llvm.va_end(i8* %g1)
|
|
|
|
ret i64 %0
|
|
|
|
}
|
|
|
|
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test2:
|
2010-07-11 06:01:49 +02:00
|
|
|
; CHECK-NOT: bfc
|
2011-04-13 02:38:32 +02:00
|
|
|
; CHECK: add [[REG:(r[0-9]+)|(lr)]], {{(r[0-9]+)|(lr)}}, #7
|
2017-04-08 00:01:23 +02:00
|
|
|
; CHECK: bic {{(r[0-9]+)|(lr)}}, [[REG]], #7
|
|
|
|
; CHECK-NOT: bic
|
2010-07-11 06:01:49 +02:00
|
|
|
; CHECK: bx lr
|
|
|
|
|
2014-05-30 10:59:55 +02:00
|
|
|
define double @test2(i32 %a, i32* %b, ...) nounwind optsize {
|
2010-07-11 06:01:49 +02:00
|
|
|
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]
|
2014-05-30 10:59:55 +02:00
|
|
|
store i32 %0, i32* %b
|
2010-07-11 06:01:49 +02:00
|
|
|
%1 = va_arg i8** %ap, double ; <double> [#uses=1]
|
|
|
|
call void @llvm.va_end(i8* %ap1)
|
|
|
|
ret double %1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-26 20:22:20 +02:00
|
|
|
declare void @llvm.va_start(i8*) nounwind
|
|
|
|
|
|
|
|
declare void @llvm.va_end(i8*) nounwind
|