llvm.org GIT mirror llvm / 4ffee4b
[mips][FastISel] Allow computation of addresses from constant expressions. Summary: Try to compute addresses when the offset from a memory location is a constant expression. Based on a patch by Reed Kotler. Test Plan: Passes test-suite for -O0/O2 and mips 32 r1/r2 Reviewers: rkotler, dsanders Subscribers: llvm-commits, aemerson, rfuhler Differential Revision: http://reviews.llvm.org/D6767 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237117 91177308-0d34-0410-b5e6-96231b3b80d8 Vasileios Kalintiris 5 years ago
2 changed file(s) with 22 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
389389 Opcode = I->getOpcode();
390390 U = I;
391391 }
392 } else if (isa(Obj))
393 return false;
392 } else if (const ConstantExpr *C = dyn_cast(Obj)) {
393 Opcode = C->getOpcode();
394 U = C;
395 }
394396 switch (Opcode) {
395397 default:
396398 break;
0 ; RUN: llc -march=mipsel -mcpu=mips32 -relocation-model=pic \
1 ; RUN: -fast-isel=true -mips-fast-isel -fast-isel-abort=1 < %s | FileCheck %s
2 ; RUN: llc -march=mipsel -mcpu=mips32r2 -relocation-model=pic \
3 ; RUN: -fast-isel=true -mips-fast-isel -fast-isel-abort=1 < %s | FileCheck %s
4
5 @ARR = external global [10 x i32], align 4
6
7 define void @foo() {
8 ; CHECK-LABEL: foo
9
10 ; CHECK-DAG: lw $[[ARR:[0-9]+]], %got(ARR)({{.*}})
11 ; CHECK-DAG: addiu $[[T0:[0-9]+]], $zero, 12345
12 ; CHECK: sw $[[T0]], 8($[[ARR]])
13
14 entry:
15 store i32 12345, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @ARR, i32 0, i32 2), align 4
16 ret void
17 }