1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s | FileCheck %s
3; RUN: llc -relocation-model=pic < %s | FileCheck %s --check-prefix=PIC
4
5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6target triple = "x86_64-unknown-linux-gnu"
7
8@foo = external global i8, align 1, !absolute_symbol !0
9
10define void @bar(i8* %x) {
11; CHECK-LABEL: bar:
12; CHECK:       # %bb.0: # %entry
13; CHECK-NEXT:    testb $foo, (%rdi)
14; CHECK-NEXT:    je .LBB0_1
15; CHECK-NEXT:  # %bb.2: # %if.then
16; CHECK-NEXT:    xorl %eax, %eax
17; CHECK-NEXT:    jmp xf@PLT # TAILCALL
18; CHECK-NEXT:  .LBB0_1: # %if.end
19; CHECK-NEXT:    retq
20;
21; PIC-LABEL: bar:
22; PIC:       # %bb.0: # %entry
23; PIC-NEXT:    testb $foo, (%rdi)
24; PIC-NEXT:    je .LBB0_1
25; PIC-NEXT:  # %bb.2: # %if.then
26; PIC-NEXT:    xorl %eax, %eax
27; PIC-NEXT:    jmp xf@PLT # TAILCALL
28; PIC-NEXT:  .LBB0_1: # %if.end
29; PIC-NEXT:    retq
30entry:
31  %0 = load i8, i8* %x, align 1
32  %conv = sext i8 %0 to i32
33  %and = and i32 %conv, sext (i8 ptrtoint (i8* @foo to i8) to i32)
34  %tobool = icmp eq i32 %and, 0
35  br i1 %tobool, label %if.end, label %if.then
36
37if.then:                                          ; preds = %entry
38  tail call void (...) @xf()
39  br label %if.end
40
41if.end:                                           ; preds = %entry, %if.then
42  ret void
43}
44
45declare void @xf(...)
46
47!0 = !{i32 0, i32 256}
48