1; RUN: llc -verify-machineinstrs -mcpu=pwr8 < %s | FileCheck %s
2; RUN: llc -verify-machineinstrs -mcpu=pwr8 -O0 < %s | FileCheck %s
3; RUN: llc -verify-machineinstrs < %s | FileCheck %s
4; RUN: llc -verify-machineinstrs -O0 < %s | FileCheck %s
5
6; The second run of the test case is to ensure the behaviour is the same
7; without specifying -mcpu=pwr8 as that is now the baseline for ppc64le.
8
9target datalayout = "e-m:e-i64:64-n32:64"
10target triple = "powerpc64le-unknown-linux-gnu"
11
12@number64 = global i64 10, align 8
13
14; CHECK: .abiversion 2
15
16define i64 @use_toc(i64 %a) nounwind {
17entry:
18; CHECK-LABEL: @use_toc
19; CHECK-NEXT: .L{{.*}}:
20; CHECK-NEXT: .Lfunc_gep[[FN:[0-9]+]]:
21; CHECK-NEXT: addis 2, 12, .TOC.-.Lfunc_gep[[FN]]@ha
22; CHECK-NEXT: addi 2, 2, .TOC.-.Lfunc_gep[[FN]]@l
23; CHECK-NEXT: .Lfunc_lep[[FN]]:
24; CHECK-NEXT: .localentry use_toc, .Lfunc_lep[[FN]]-.Lfunc_gep[[FN]]
25; CHECK-NEXT: %entry
26  %0 = load i64, i64* @number64, align 8
27  %cmp = icmp eq i64 %0, %a
28  %conv1 = zext i1 %cmp to i64
29  ret i64 %conv1
30}
31
32declare void @callee()
33define void @use_toc_implicit() nounwind {
34entry:
35; CHECK-LABEL: @use_toc_implicit
36; CHECK-NEXT: .L{{.*}}:
37; CHECK-NEXT: .Lfunc_gep[[FN:[0-9]+]]:
38; CHECK-NEXT: addis 2, 12, .TOC.-.Lfunc_gep[[FN]]@ha
39; CHECK-NEXT: addi 2, 2, .TOC.-.Lfunc_gep[[FN]]@l
40; CHECK-NEXT: .Lfunc_lep[[FN]]:
41; CHECK-NEXT: .localentry use_toc_implicit, .Lfunc_lep[[FN]]-.Lfunc_gep[[FN]]
42; CHECK-NEXT: %entry
43  call void @callee()
44  ret void
45}
46
47define i64 @no_toc(i64 %a) nounwind {
48entry:
49; CHECK-LABEL: @no_toc
50; CHECK-NEXT: .L{{.*}}:
51; CHECK-NEXT: %entry
52  ret i64 %a
53}
54
55