• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -verify-machineinstrs -mcpu=corei7-avx %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=NO-FLAGS
2target 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-n8:16:32:64-S128"
3target triple = "x86_64-apple-macosx10.9.0"
4
5%struct.__va_list_tag = type { i32, i32, i8*, i8* }
6
7; Check that vastart gets the right thing.
8define i32 @sum(i32 %count, ...) nounwind optsize ssp uwtable {
9; CHECK:      testb   %al, %al
10; CHECK-NEXT: je
11; CHECK-NEXT: ## BB#{{[0-9]+}}:
12; CHECK-NEXT: vmovaps %xmm0, 48(%rsp)
13; CHECK-NEXT: vmovaps %xmm1, 64(%rsp)
14; CHECK-NEXT: vmovaps %xmm2, 80(%rsp)
15; CHECK-NEXT: vmovaps %xmm3, 96(%rsp)
16; CHECK-NEXT: vmovaps %xmm4, 112(%rsp)
17; CHECK-NEXT: vmovaps %xmm5, 128(%rsp)
18; CHECK-NEXT: vmovaps %xmm6, 144(%rsp)
19; CHECK-NEXT: vmovaps %xmm7, 160(%rsp)
20
21; Check that [EFLAGS] hasn't been pulled in.
22; NO-FLAGS-NOT: %flags
23
24  %ap = alloca [1 x %struct.__va_list_tag], align 16
25  %1 = bitcast [1 x %struct.__va_list_tag]* %ap to i8*
26  call void @llvm.va_start(i8* %1)
27  %2 = icmp sgt i32 %count, 0
28  br i1 %2, label %.lr.ph, label %._crit_edge
29
30.lr.ph:                                           ; preds = %0
31  %3 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 0
32  %4 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 2
33  %.pre = load i32, i32* %3, align 16
34  br label %5
35
36; <label>:5                                       ; preds = %.lr.ph, %13
37  %6 = phi i32 [ %.pre, %.lr.ph ], [ %14, %13 ]
38  %.01 = phi i32 [ %count, %.lr.ph ], [ %15, %13 ]
39  %7 = icmp ult i32 %6, 41
40  br i1 %7, label %8, label %10
41
42; <label>:8                                       ; preds = %5
43  %9 = add i32 %6, 8
44  store i32 %9, i32* %3, align 16
45  br label %13
46
47; <label>:10                                      ; preds = %5
48  %11 = load i8*, i8** %4, align 8
49  %12 = getelementptr i8, i8* %11, i64 8
50  store i8* %12, i8** %4, align 8
51  br label %13
52
53; <label>:13                                      ; preds = %10, %8
54  %14 = phi i32 [ %6, %10 ], [ %9, %8 ]
55  %15 = add nsw i32 %.01, 1
56  %16 = icmp sgt i32 %15, 0
57  br i1 %16, label %5, label %._crit_edge
58
59._crit_edge:                                      ; preds = %13, %0
60  %.0.lcssa = phi i32 [ %count, %0 ], [ %15, %13 ]
61  call void @llvm.va_end(i8* %1)
62  ret i32 %.0.lcssa
63}
64
65declare void @llvm.va_start(i8*) nounwind
66
67declare void @llvm.va_end(i8*) nounwind
68