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