[PATCH] D71346: [PowerPC] support loop ds form prep for lwa
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 05:04:44 PST 2019
shchenz created this revision.
shchenz added reviewers: jsji, nemanjai, steven.zhang, hfinkel, PowerPC.
Herald added subscribers: llvm-commits, wuzish, hiraditya.
Herald added a project: LLVM.
This patch supports loop ds form prep for PPC instruction lwa.
https://reviews.llvm.org/D71346
Files:
llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
llvm/test/CodeGen/PowerPC/loop-instr-form-prepare.ll
Index: llvm/test/CodeGen/PowerPC/loop-instr-form-prepare.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/loop-instr-form-prepare.ll
+++ llvm/test/CodeGen/PowerPC/loop-instr-form-prepare.ll
@@ -774,20 +774,17 @@
define i64 @test_ds_lwa_prep(i8* %0, i32 signext %1) {
; CHECK-LABEL: test_ds_lwa_prep:
-; CHECK: li r6, 1
-; CHECK-NEXT: li r7, 2
-; CHECK-NEXT: li r8, 6
-; CHECK-NEXT: li r9, 10
+; CHECK: addi r5, r3, 2
+; CHECK: li r6, -1
; CHECK: .LBB9_2: #
-; CHECK-NEXT: lwax r11, r3, r6
-; CHECK-NEXT: lwax r12, r3, r7
-; CHECK-NEXT: lwax r0, r3, r8
-; CHECK-NEXT: addi r10, r3, 1
-; CHECK-NEXT: mulld r11, r12, r11
-; CHECK-NEXT: lwax r3, r3, r9
-; CHECK-NEXT: mulld r11, r11, r0
-; CHECK-NEXT: maddld r5, r11, r3, r5
-; CHECK-NEXT: mr r3, r10
+; CHECK-NEXT: lwax r7, r5, r6
+; CHECK-NEXT: lwa r8, 0(r5)
+; CHECK-NEXT: lwa r9, 4(r5)
+; CHECK-NEXT: lwa r10, 8(r5)
+; CHECK-NEXT: addi r5, r5, 1
+; CHECK-NEXT: mulld r7, r8, r7
+; CHECK-NEXT: mulld r7, r7, r9
+; CHECK-NEXT: maddld r3, r7, r10, r3
; CHECK-NEXT: bdnz .LBB9_2
%3 = sext i32 %1 to i64
@@ -827,3 +824,4 @@
%33 = add nsw i64 %32, %3
ret i64 %33
}
+
Index: llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
+++ llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
@@ -846,11 +846,13 @@
// Check if a load/store has DS form.
auto isDSFormCandidate = [] (const Instruction *I, const Value *PtrValue) {
assert((PtrValue && I) && "Invalid parameter!");
- // FIXME: 32 bit instruction lwa is also DS form.
return !isa<IntrinsicInst>(I) &&
((PtrValue->getType()->getPointerElementType()->isIntegerTy(64)) ||
(PtrValue->getType()->getPointerElementType()->isFloatTy()) ||
- (PtrValue->getType()->getPointerElementType()->isDoubleTy()));
+ (PtrValue->getType()->getPointerElementType()->isDoubleTy()) ||
+ (PtrValue->getType()->getPointerElementType()->isIntegerTy(32) &&
+ llvm::any_of(I->users(),
+ [](const User *U) { return isa<SExtInst>(U); })));
};
// Check if a load/store has DQ form.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71346.233320.patch
Type: text/x-patch
Size: 2347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191211/9aea8716/attachment.bin>
More information about the llvm-commits
mailing list