55 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -O0 -run-pass=legalizer %s -o - | FileCheck %s3# RUN: llc -O0 -run-pass=legalizer --code-model=large %s -o - | FileCheck %s --check-prefix=CMLARGE4 5--- |6 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"7 target triple = "aarch64--"8 @var = external dso_local global i89 define ptr @test_global() { ret ptr undef }10 define ptr @test_global_with_offset() { ret ptr undef }11...12---13name: test_global14registers:15 - { id: 0, class: _ }16body: |17 bb.0:18 19 ; We don't want to lower to G_ADD_LOW when we need a GOT access, or when the code20 ; model isn't 'Small'.21 ; CHECK-LABEL: name: test_global22 ; CHECK: [[ADRP:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @var23 ; CHECK-NEXT: [[ADD_LOW:%[0-9]+]]:_(p0) = G_ADD_LOW [[ADRP]](p0), target-flags(aarch64-pageoff, aarch64-nc) @var24 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[ADD_LOW]](p0)25 ; CHECK-NEXT: $x0 = COPY [[PTRTOINT]](s64)26 ;27 ; CMLARGE-LABEL: name: test_global28 ; CMLARGE: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @var29 ; CMLARGE-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[GV]](p0)30 ; CMLARGE-NEXT: $x0 = COPY [[PTRTOINT]](s64)31 %0(p0) = G_GLOBAL_VALUE @var32 %1:_(s64) = G_PTRTOINT %033 $x0 = COPY %134...35---36name: test_global_with_offset37body: |38 bb.0:39 ; When we legalize into ADRP + G_ADD_LOW, both should inherit the offset40 ; from the original G_GLOBAL_VALUE.41 ; CHECK-LABEL: name: test_global_with_offset42 ; CHECK: [[ADRP:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @var + 143 ; CHECK-NEXT: [[ADD_LOW:%[0-9]+]]:_(p0) = G_ADD_LOW [[ADRP]](p0), target-flags(aarch64-pageoff, aarch64-nc) @var + 144 ; CHECK-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[ADD_LOW]](p0)45 ; CHECK-NEXT: $x0 = COPY [[PTRTOINT]](s64)46 ;47 ; CMLARGE-LABEL: name: test_global_with_offset48 ; CMLARGE: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @var + 149 ; CMLARGE-NEXT: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[GV]](p0)50 ; CMLARGE-NEXT: $x0 = COPY [[PTRTOINT]](s64)51 %0:_(p0) = G_GLOBAL_VALUE @var + 152 %1:_(s64) = G_PTRTOINT %053 $x0 = COPY %154...55