xref: /llvm-project/llvm/test/CodeGen/PowerPC/tocdata-non-zero-addend.mir (revision 2cd32132dbf5ec4a0e62f8fea0cd48420561e970)
1# RUN: llc -verify-machineinstrs -x mir -filetype=obj < %s -o %t.o
2# RUN: llvm-objdump -dr %t.o | FileCheck %s
3# CHECK-LABEL: .read_x
4# CHECK: lbz 3, 2(2)
5# CHECK-NEXT: R_TOC        x
6# CHECK-LABEL: .read_y
7# CHECK: lbz 3, 0(2)
8# CHECK-NEXT: R_TOC        y
9
10--- |
11  ; ModuleID = '<stdin>'
12  source_filename = "<stdin>"
13  target datalayout = "E-m:a-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512"
14  target triple = "powerpc64-ibm-aix"
15
16  @x = local_unnamed_addr global i32 218114560, align 4 #0
17  @y = external local_unnamed_addr global i32, align 4 #0
18
19  define signext range(i32 0, 256) i32 @read_x() {
20  entry:
21    %0 = load i32, ptr @x, align 4
22    %shr = lshr i32 %0, 8
23    %and = and i32 %shr, 255
24    ret i32 %and
25  }
26
27  define signext range(i32 0, 256) i32 @read_y() {
28  entry:
29    %0 = load i32, ptr @y, align 4
30    %shr = lshr i32 %0, 16
31    %and = and i32 %shr, 255
32    ret i32 %and
33  }
34
35  attributes #0 = { "toc-data" }
36
37...
38---
39name:            read_x
40alignment:       4
41tracksRegLiveness: true
42registers:
43  - { id: 0, class: g8rc }
44frameInfo:
45  maxAlignment:    8
46machineFunctionInfo: {}
47body:             |
48  bb.0.entry:
49    liveins: $x3, $x2
50    %0:g8rc = LBZ8 @x + 2, $x2 :: (dereferenceable load (s8) from @x + 2, align 2, basealign 4)
51    $x3 = COPY %0
52    BLR8 implicit $lr8, implicit $rm, implicit $x3
53
54...
55---
56name:            read_y
57alignment:       4
58tracksRegLiveness: true
59registers:
60  - { id: 0, class: g8rc }
61frameInfo:
62  maxAlignment:    8
63machineFunctionInfo: {}
64body:             |
65  bb.0.entry:
66    liveins: $x3, $x2
67    %0:g8rc = LBZ8 @y + 1, $x2 :: (dereferenceable load (s8) from @y + 1, basealign 4)
68    $x3 = COPY %0
69    BLR8 implicit $lr8, implicit $rm, implicit $x3
70
71...
72