select-gv-cmodel-tiny.mir 2.57 KB
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=aarch64-none-eabi -code-model=tiny -run-pass=instruction-select -verify-machineinstrs -O0 %s -o - | FileCheck %s
--- |
  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"

  @foo1 = common global [1073741824 x i32] zeroinitializer, align 4
  @foo2 = common global [1073741824 x i32] zeroinitializer, align 4

  define i32 @gv_tiny() {
  entry:
    %retval = alloca i32, align 4
    store i32 0, i32* %retval, align 4
    %0 = load i32, i32* getelementptr inbounds ([1073741824 x i32], [1073741824 x i32]* @foo1, i64 0, i64 0), align 4
    %1 = load i32, i32* getelementptr inbounds ([1073741824 x i32], [1073741824 x i32]* @foo2, i64 0, i64 0), align 4
    %add = add nsw i32 %0, %1
    ret i32 %add
  }

...
---
name:            gv_tiny
legalized:       true
regBankSelected: true
stack:
  - { id: 0, name: retval, type: default, offset: 0, size: 4, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '',
      debug-info-location: '' }
constants:
body:             |
  bb.1:
    ; CHECK-LABEL: name: gv_tiny
    ; CHECK: [[ADR:%[0-9]+]]:gpr64 = ADR @foo1
    ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY [[ADR]]
    ; CHECK: [[ADR1:%[0-9]+]]:gpr64 = ADR @foo2
    ; CHECK: [[COPY1:%[0-9]+]]:gpr64sp = COPY [[ADR1]]
    ; CHECK: STRWui $wzr, %stack.0.retval, 0 :: (store 4 into %ir.retval)
    ; 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)`)
    ; 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)`)
    ; CHECK: [[ADDWrr:%[0-9]+]]:gpr32 = ADDWrr [[LDRWui]], [[LDRWui1]]
    ; CHECK: $w0 = COPY [[ADDWrr]]
    ; CHECK: RET_ReallyLR implicit $w0
    %1:gpr(s32) = G_CONSTANT i32 0
    %4:gpr(p0) = G_GLOBAL_VALUE @foo1
    %3:gpr(p0) = COPY %4(p0)
    %7:gpr(p0) = G_GLOBAL_VALUE @foo2
    %6:gpr(p0) = COPY %7(p0)
    %0:gpr(p0) = G_FRAME_INDEX %stack.0.retval
    G_STORE %1(s32), %0(p0) :: (store 4 into %ir.retval)
    %2:gpr(s32) = G_LOAD %3(p0) :: (load 4 from `i32* getelementptr inbounds ([1073741824 x i32], [1073741824 x i32]* @foo1, i64 0, i64 0)`)
    %5:gpr(s32) = G_LOAD %6(p0) :: (load 4 from `i32* getelementptr inbounds ([1073741824 x i32], [1073741824 x i32]* @foo2, i64 0, i64 0)`)
    %8:gpr(s32) = G_ADD %2, %5
    $w0 = COPY %8(s32)
    RET_ReallyLR implicit $w0

...