1; RUN: llc < %s -mattr=-sse | FileCheck %s -check-prefix=NOSSE
2; RUN: llc < %s | FileCheck %s -check-prefix=YESSSE
3; PR3403
4target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
5target triple = "x86_64-unknown-linux-gnu"
6	%struct.__va_list_tag = type { i32, i32, i8*, i8* }
7
8; NOSSE-NOT: xmm
9; YESSSE: xmm
10define i32 @foo(float %a, i8* nocapture %fmt, ...) nounwind {
11entry:
12	%ap = alloca [1 x %struct.__va_list_tag], align 8		; <[1 x %struct.__va_list_tag]*> [#uses=4]
13	%ap12 = bitcast [1 x %struct.__va_list_tag]* %ap to i8*		; <i8*> [#uses=2]
14	call void @llvm.va_start(i8* %ap12)
15	%0 = getelementptr [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 0		; <i32*> [#uses=2]
16	%1 = load i32, i32* %0, align 8		; <i32> [#uses=3]
17	%2 = icmp ult i32 %1, 48		; <i1> [#uses=1]
18	br i1 %2, label %bb, label %bb3
19
20bb:		; preds = %entry
21	%3 = getelementptr [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 3		; <i8**> [#uses=1]
22	%4 = load i8*, i8** %3, align 8		; <i8*> [#uses=1]
23	%5 = inttoptr i32 %1 to i8*		; <i8*> [#uses=1]
24	%6 = ptrtoint i8* %5 to i64		; <i64> [#uses=1]
25	%ctg2 = getelementptr i8, i8* %4, i64 %6		; <i8*> [#uses=1]
26	%7 = add i32 %1, 8		; <i32> [#uses=1]
27	store i32 %7, i32* %0, align 8
28	br label %bb4
29
30bb3:		; preds = %entry
31	%8 = getelementptr [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 2		; <i8**> [#uses=2]
32	%9 = load i8*, i8** %8, align 8		; <i8*> [#uses=2]
33	%10 = getelementptr i8, i8* %9, i64 8		; <i8*> [#uses=1]
34	store i8* %10, i8** %8, align 8
35	br label %bb4
36
37bb4:		; preds = %bb3, %bb
38	%addr.0.0 = phi i8* [ %ctg2, %bb ], [ %9, %bb3 ]		; <i8*> [#uses=1]
39	%11 = bitcast i8* %addr.0.0 to i32*		; <i32*> [#uses=1]
40	%12 = load i32, i32* %11, align 4		; <i32> [#uses=1]
41	call void @llvm.va_end(i8* %ap12)
42	ret i32 %12
43}
44
45declare void @llvm.va_start(i8*) nounwind
46
47declare void @llvm.va_end(i8*) nounwind
48