Skip to content

Commit 150988f

Browse files
committed
fixup! Apply pattern to basic case of 4 i64 loads into fpr128 register
Fix condition while checking for the pattern and add a negative test where the pattern is not applied
1 parent ea2546a commit 150988f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7344,7 +7344,7 @@ static bool getLoadPatterns(MachineInstr &Root,
73447344
auto *CurrInstr = MRI.getUniqueVRegDef(Root.getOperand(1).getReg());
73457345
SmallSet<unsigned, 4> RemainingLanes({1, 2});
73467346
while (RemainingLanes.begin() != RemainingLanes.end() &&
7347-
Root.getOpcode() == AArch64::LD1i32 &&
7347+
CurrInstr->getOpcode() == AArch64::LD1i32 &&
73487348
MRI.hasOneNonDBGUse(CurrInstr->getOperand(0).getReg())) {
73497349
RemainingLanes.erase(CurrInstr->getOperand(2).getImm());
73507350
CurrInstr = MRI.getUniqueVRegDef(CurrInstr->getOperand(1).getReg());

llvm/test/CodeGen/AArch64/aarch64-combine-split-loads.mir

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,19 @@ body: |
3434
%9:fpr128 = LD1i32 %8, 3, killed %4
3535
$q0 = COPY %9
3636
RET_ReallyLR implicit $q0
37+
38+
---
39+
name: negative_pattern
40+
body: |
41+
bb.0.entry:
42+
liveins: $x0, $x1
43+
44+
; CHECK-LABEL: name: negative_pattern
45+
; CHECK: [[LD1:%.*]]:fpr128 = LDRQui $x1, 0
46+
; CHECK-NEXT: [[LD2:%.*]]:fpr128 = LD1i32 [[LD1]]
47+
48+
%0:gpr64common = COPY $x0
49+
%1:fpr128 = LDRQui $x1, 0
50+
%2:fpr128 = LD1i32 %1, 3, %0
51+
$q0 = COPY %2
52+
RET_ReallyLR implicit $q0

0 commit comments

Comments
 (0)