1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -O0 -run-pass=legalizer --relocation-model=pic %s -o - | FileCheck %s --check-prefix=PIC 3 4--- | 5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" 6 target triple = "aarch64--" 7 @var = external global i8 8 define i8* @test_global() { ret i8* undef } 9... 10--- 11name: test_global 12registers: 13 - { id: 0, class: _ } 14body: | 15 bb.0: 16 17 ; We don't want to lower to G_ADD_LOW when we need a GOT access, or when the code 18 ; model isn't 'Small'. 19 20 ; CHECK-LABEL: name: test_global 21 ; CHECK: [[ADRP:%[0-9]+]]:gpr64(p0) = ADRP target-flags(aarch64-page) @var 22 ; CHECK: [[ADD_LOW:%[0-9]+]]:_(p0) = G_ADD_LOW [[ADRP]](p0), target-flags(aarch64-pageoff, aarch64-nc) @var 23 ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[ADD_LOW]](p0) 24 ; CHECK: $x0 = COPY [[PTRTOINT]](s64) 25 ; CMLARGE-LABEL: name: test_global 26 ; CMLARGE: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @var 27 ; CMLARGE: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[GV]](p0) 28 ; CMLARGE: $x0 = COPY [[PTRTOINT]](s64) 29 ; PIC-LABEL: name: test_global 30 ; PIC: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @var 31 ; PIC: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[GV]](p0) 32 ; PIC: $x0 = COPY [[PTRTOINT]](s64) 33 %0(p0) = G_GLOBAL_VALUE @var 34 %1:_(s64) = G_PTRTOINT %0 35 $x0 = COPY %1 36... 37