1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-none-eabi -code-model=tiny -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 global [1073741824 x i32] zeroinitializer, align 4
7 @foo2 = common global [1073741824 x i32] zeroinitializer, align 4
9 define i32 @gv_tiny() {
11 %retval = alloca i32, align 4
12 store i32 0, i32* %retval, align 4
13 %0 = load i32, i32* getelementptr inbounds ([1073741824 x i32], [1073741824 x i32]* @foo1, i64 0, i64 0), align 4
14 %1 = load i32, i32* getelementptr inbounds ([1073741824 x i32], [1073741824 x i32]* @foo2, i64 0, i64 0), 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_tiny
33 ; CHECK: [[ADR:%[0-9]+]]:gpr64 = ADR @foo1
34 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY [[ADR]]
35 ; CHECK: [[ADR1:%[0-9]+]]:gpr64 = ADR @foo2
36 ; CHECK: [[COPY1:%[0-9]+]]:gpr64sp = COPY [[ADR1]]
37 ; CHECK: STRWui $wzr, %stack.0.retval, 0 :: (store 4 into %ir.retval)
38 ; CHECK: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 0 :: (load 4 from `i32* getelementptr inbounds ([1073741824 x i32], [1073741824 x i32]* @foo1, i64 0, i64 0)`)
39 ; CHECK: [[LDRWui1:%[0-9]+]]:gpr32 = LDRWui [[COPY1]], 0 :: (load 4 from `i32* getelementptr inbounds ([1073741824 x i32], [1073741824 x i32]* @foo2, i64 0, i64 0)`)
40 ; CHECK: [[ADDWrr:%[0-9]+]]:gpr32 = ADDWrr [[LDRWui]], [[LDRWui1]]
41 ; CHECK: $w0 = COPY [[ADDWrr]]
42 ; CHECK: RET_ReallyLR implicit $w0
43 %1:gpr(s32) = G_CONSTANT i32 0
44 %4:gpr(p0) = G_GLOBAL_VALUE @foo1
45 %3:gpr(p0) = COPY %4(p0)
46 %7:gpr(p0) = G_GLOBAL_VALUE @foo2
47 %6:gpr(p0) = COPY %7(p0)
48 %0:gpr(p0) = G_FRAME_INDEX %stack.0.retval
49 G_STORE %1(s32), %0(p0) :: (store 4 into %ir.retval)
50 %2:gpr(s32) = G_LOAD %3(p0) :: (load 4 from `i32* getelementptr inbounds ([1073741824 x i32], [1073741824 x i32]* @foo1, i64 0, i64 0)`)
51 %5:gpr(s32) = G_LOAD %6(p0) :: (load 4 from `i32* getelementptr inbounds ([1073741824 x i32], [1073741824 x i32]* @foo2, i64 0, i64 0)`)
52 %8:gpr(s32) = G_ADD %2, %5
54 RET_ReallyLR implicit $w0