1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-linux-gnu -code-model=large -run-pass=instruction-select -verify-machineinstrs -O0 %s -o - | FileCheck %s
4 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6 @foo1 = common dso_local global [1073741824 x i32] zeroinitializer, align 4
7 @foo2 = common dso_local global [1073741824 x i32] zeroinitializer, align 4
9 define dso_local i32 @gv_large() {
11 %retval = alloca i32, align 4
12 store i32 0, ptr %retval, align 4
13 %0 = load i32, ptr @foo1, align 4
14 %1 = load i32, ptr @foo2, align 4
15 %add = add nsw i32 %0, %1
25 - { id: 0, name: retval, type: default, offset: 0, size: 4, alignment: 4,
26 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
27 debug-info-variable: '', debug-info-expression: '',
28 debug-info-location: '' }
32 ; CHECK-LABEL: name: gv_large
33 ; CHECK: [[MOVZXi:%[0-9]+]]:gpr64 = MOVZXi target-flags(aarch64-g0, aarch64-nc) @foo1, 0
34 ; CHECK: [[MOVKXi:%[0-9]+]]:gpr64 = MOVKXi [[MOVZXi]], target-flags(aarch64-g1, aarch64-nc) @foo1, 16
35 ; CHECK: [[MOVKXi1:%[0-9]+]]:gpr64 = MOVKXi [[MOVKXi]], target-flags(aarch64-g2, aarch64-nc) @foo1, 32
36 ; CHECK: [[MOVKXi2:%[0-9]+]]:gpr64 = MOVKXi [[MOVKXi1]], target-flags(aarch64-g3) @foo1, 48
37 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY [[MOVKXi2]]
38 ; CHECK: [[MOVZXi1:%[0-9]+]]:gpr64 = MOVZXi target-flags(aarch64-g0, aarch64-nc) @foo2, 0
39 ; CHECK: [[MOVKXi3:%[0-9]+]]:gpr64 = MOVKXi [[MOVZXi1]], target-flags(aarch64-g1, aarch64-nc) @foo2, 16
40 ; CHECK: [[MOVKXi4:%[0-9]+]]:gpr64 = MOVKXi [[MOVKXi3]], target-flags(aarch64-g2, aarch64-nc) @foo2, 32
41 ; CHECK: [[MOVKXi5:%[0-9]+]]:gpr64 = MOVKXi [[MOVKXi4]], target-flags(aarch64-g3) @foo2, 48
42 ; CHECK: [[COPY1:%[0-9]+]]:gpr64sp = COPY [[MOVKXi5]]
43 ; CHECK: STRWui $wzr, %stack.0.retval, 0 :: (store (s32) into %ir.retval)
44 ; CHECK: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 0 :: (load (s32) from @foo1)
45 ; CHECK: [[LDRWui1:%[0-9]+]]:gpr32 = LDRWui [[COPY1]], 0 :: (load (s32) from @foo2)
46 ; CHECK: [[ADDWrr:%[0-9]+]]:gpr32 = ADDWrr [[LDRWui]], [[LDRWui1]]
47 ; CHECK: $w0 = COPY [[ADDWrr]]
48 ; CHECK: RET_ReallyLR implicit $w0
49 %1:gpr(s32) = G_CONSTANT i32 0
50 %4:gpr(p0) = G_GLOBAL_VALUE @foo1
51 %3:gpr(p0) = COPY %4(p0)
52 %7:gpr(p0) = G_GLOBAL_VALUE @foo2
53 %6:gpr(p0) = COPY %7(p0)
54 %0:gpr(p0) = G_FRAME_INDEX %stack.0.retval
55 G_STORE %1(s32), %0(p0) :: (store (s32) into %ir.retval)
56 %2:gpr(s32) = G_LOAD %3(p0) :: (load (s32) from @foo1)
57 %5:gpr(s32) = G_LOAD %6(p0) :: (load (s32) from @foo2)
58 %8:gpr(s32) = G_ADD %2, %5
60 RET_ReallyLR implicit $w0