|
| 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 | +--- |
| 39 | +name: read_x |
| 40 | +alignment: 4 |
| 41 | +tracksRegLiveness: true |
| 42 | +registers: |
| 43 | + - { id: 0, class: g8rc } |
| 44 | +frameInfo: |
| 45 | + maxAlignment: 8 |
| 46 | +machineFunctionInfo: {} |
| 47 | +body: | |
| 48 | + bb.0.entry: |
| 49 | + %0:g8rc = LBZ8 @x + 2, $x2 :: (dereferenceable load (s8) from @x + 2, align 2, basealign 4) |
| 50 | + $x3 = COPY %0 |
| 51 | + BLR8 implicit $lr8, implicit $rm, implicit $x3 |
| 52 | +
|
| 53 | +... |
| 54 | +--- |
| 55 | +name: read_y |
| 56 | +alignment: 4 |
| 57 | +tracksRegLiveness: true |
| 58 | +registers: |
| 59 | + - { id: 0, class: g8rc } |
| 60 | +frameInfo: |
| 61 | + maxAlignment: 8 |
| 62 | +machineFunctionInfo: {} |
| 63 | +body: | |
| 64 | + bb.0.entry: |
| 65 | + %0:g8rc = LBZ8 @y + 1, $x2 :: (dereferenceable load (s8) from @y + 1, basealign 4) |
| 66 | + $x3 = COPY %0 |
| 67 | + BLR8 implicit $lr8, implicit $rm, implicit $x3 |
| 68 | +
|
| 69 | +... |
0 commit comments