• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc %s -o - | FileCheck %s
3
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-n8:16:32:64-S128"
5target triple = "x86_64-apple-macosx10.10.0"
6
7; Check that vastart handling doesn't get between testb and je for the branch.
8define i32 @check_flag(i32 %flags, ...) nounwind {
9; CHECK-LABEL: check_flag:
10; CHECK:       ## %bb.0: ## %entry
11; CHECK-NEXT:    subq $56, %rsp
12; CHECK-NEXT:    testb %al, %al
13; CHECK-NEXT:    je LBB0_2
14; CHECK-NEXT:  ## %bb.1: ## %entry
15; CHECK-NEXT:    movaps %xmm0, -{{[0-9]+}}(%rsp)
16; CHECK-NEXT:    movaps %xmm1, -{{[0-9]+}}(%rsp)
17; CHECK-NEXT:    movaps %xmm2, -{{[0-9]+}}(%rsp)
18; CHECK-NEXT:    movaps %xmm3, -{{[0-9]+}}(%rsp)
19; CHECK-NEXT:    movaps %xmm4, -{{[0-9]+}}(%rsp)
20; CHECK-NEXT:    movaps %xmm5, (%rsp)
21; CHECK-NEXT:    movaps %xmm6, {{[0-9]+}}(%rsp)
22; CHECK-NEXT:    movaps %xmm7, {{[0-9]+}}(%rsp)
23; CHECK-NEXT:  LBB0_2: ## %entry
24; CHECK-NEXT:    movq %rsi, -{{[0-9]+}}(%rsp)
25; CHECK-NEXT:    movq %rdx, -{{[0-9]+}}(%rsp)
26; CHECK-NEXT:    movq %rcx, -{{[0-9]+}}(%rsp)
27; CHECK-NEXT:    movq %r8, -{{[0-9]+}}(%rsp)
28; CHECK-NEXT:    movq %r9, -{{[0-9]+}}(%rsp)
29; CHECK-NEXT:    xorl %eax, %eax
30; CHECK-NEXT:    testl $512, %edi ## imm = 0x200
31; CHECK-NEXT:    je LBB0_4
32; CHECK-NEXT:  ## %bb.3: ## %if.then
33; CHECK-NEXT:    leaq -{{[0-9]+}}(%rsp), %rax
34; CHECK-NEXT:    movq %rax, 16
35; CHECK-NEXT:    leaq {{[0-9]+}}(%rsp), %rax
36; CHECK-NEXT:    movq %rax, 8
37; CHECK-NEXT:    movl $48, 4
38; CHECK-NEXT:    movl $8, 0
39; CHECK-NEXT:    movl $1, %eax
40; CHECK-NEXT:  LBB0_4: ## %if.end
41; CHECK-NEXT:    addq $56, %rsp
42; CHECK-NEXT:    retq
43entry:
44  %and = and i32 %flags, 512
45  %tobool = icmp eq i32 %and, 0
46  br i1 %tobool, label %if.end, label %if.then
47
48if.then:                                          ; preds = %entry
49  call void @llvm.va_start(i8* null)
50  br label %if.end
51
52if.end:                                           ; preds = %entry, %if.then
53  %hasflag = phi i32 [ 1, %if.then ], [ 0, %entry ]
54  ret i32 %hasflag
55}
56
57declare void @llvm.va_start(i8*) nounwind
58