1; RUN: llc -march=ppc64le -mcpu=pwr8 < %s | FileCheck %s
2; RUN: llc -march=ppc64le -mcpu=pwr8 -O0 < %s | FileCheck %s
3
4target datalayout = "e-m:e-i64:64-n32:64"
5target triple = "powerpc64le-unknown-linux-gnu"
6
7@number64 = global i64 10, align 8
8
9; CHECK: .abiversion 2
10
11define i64 @use_toc(i64 %a) nounwind {
12entry:
13; CHECK-LABEL: @use_toc
14; CHECK-NEXT: .Ltmp[[TMP1:[0-9]+]]:
15; CHECK-NEXT: addis 2, 12, .TOC.-.Ltmp[[TMP1]]@ha
16; CHECK-NEXT: addi 2, 2, .TOC.-.Ltmp[[TMP1]]@l
17; CHECK-NEXT: .Ltmp[[TMP2:[0-9]+]]:
18; CHECK-NEXT: .localentry use_toc, .Ltmp[[TMP2]]-.Ltmp[[TMP1]]
19; CHECK-NEXT: %entry
20  %0 = load i64* @number64, align 8
21  %cmp = icmp eq i64 %0, %a
22  %conv1 = zext i1 %cmp to i64
23  ret i64 %conv1
24}
25
26declare void @callee()
27define void @use_toc_implicit() nounwind {
28entry:
29; CHECK-LABEL: @use_toc_implicit
30; CHECK-NEXT: .Ltmp[[TMP1:[0-9]+]]:
31; CHECK-NEXT: addis 2, 12, .TOC.-.Ltmp[[TMP1]]@ha
32; CHECK-NEXT: addi 2, 2, .TOC.-.Ltmp[[TMP1]]@l
33; CHECK-NEXT: .Ltmp[[TMP2:[0-9]+]]:
34; CHECK-NEXT: .localentry use_toc_implicit, .Ltmp[[TMP2]]-.Ltmp[[TMP1]]
35; CHECK-NEXT: %entry
36  call void @callee()
37  ret void
38}
39
40define i64 @no_toc(i64 %a) nounwind {
41entry:
42; CHECK-LABEL: @no_toc
43; CHECK-NEXT: %entry
44  ret i64 %a
45}
46
47