1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
llvm-mirror/test/CodeGen/AArch64/arm64-alloca-frame-pointer-offset.ll
Jun Bum Lim 3cdf780204 [AArch64] Promote loads from stored
This is a recommit of r256004 which was reverted in r256160. The issue was the
incorrect promotion for half and byte loads transformed into mov instructions.
This fix will replace half and byte type loads only with bit field extracts.

Original commit message:

This change promotes load instructions which directly read from stored by
replacing them with mov instructions. If the store is wider than the load,
the load will be replaced with a bitfield extract.
For example :
  STRWui %W1, %X0, 1
  %W0 = LDRHHui %X0, 3
becomes
  STRWui %W1, %X0, 1
  %W0 = UBFMWri %W1, 16, 31

llvm-svn: 256249
2015-12-22 16:36:16 +00:00

30 lines
894 B
LLVM

; RUN: llc -march=arm64 -mcpu=cyclone < %s | FileCheck %s
; CHECK: foo
; CHECK: str w[[REG0:[0-9]+]], [x19, #264]
; CHECK: mov w[[REG1:[0-9]+]], w[[REG0]]
; CHECK: str w[[REG1]], [x19, #132]
define i32 @foo(i32 %a) nounwind {
%retval = alloca i32, align 4
%a.addr = alloca i32, align 4
%arr = alloca [32 x i32], align 4
%i = alloca i32, align 4
%arr2 = alloca [32 x i32], align 4
%j = alloca i32, align 4
store i32 %a, i32* %a.addr, align 4
%tmp = load i32, i32* %a.addr, align 4
%tmp1 = zext i32 %tmp to i64
%v = mul i64 4, %tmp1
%vla = alloca i8, i64 %v, align 4
%tmp2 = bitcast i8* %vla to i32*
%tmp3 = load i32, i32* %a.addr, align 4
store i32 %tmp3, i32* %i, align 4
%tmp4 = load i32, i32* %a.addr, align 4
store i32 %tmp4, i32* %j, align 4
%tmp5 = load i32, i32* %j, align 4
store i32 %tmp5, i32* %retval
%x = load i32, i32* %retval
ret i32 %x
}