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