1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/CodeGen/ARM/zext-logic-shift-load.ll
Guozhi Wei fb70343484 [DAGCombiner] Fold (zext (and/or/xor (shl/shr (load x), cst), cst))
In our real world application, we found the following optimization is missed in DAGCombiner

(zext (and/or/xor (shl/shr (load x), cst), cst)) -> (and/or/xor (shl/shr (zextload x), (zext cst)), (zext cst))

If the user of original zext is an add, it may enable further lea optimization on x86.

This patch add a new function CombineZExtLogicopShiftLoad to do this optimization.

Differential Revision: https://reviews.llvm.org/D44402

llvm-svn: 329516
2018-04-07 23:36:10 +00:00

18 lines
324 B
LLVM

; RUN: llc -mtriple=armv7-linux-gnu < %s -o - | FileCheck %s
define void @test1(i8* %p, i16* %q) {
; CHECK: ldrb
; CHECK-NEXT: mov
; CHECK-NEXT: and
; CHECK-NEXT: strh
; CHECK-NEXT: bx
%1 = load i8, i8* %p
%2 = shl i8 %1, 2
%3 = and i8 %2, 12
%4 = zext i8 %3 to i16
store i16 %4, i16* %q
ret void
}