Skip to content

Commit 754520a

Browse files
[PowerPC] Fix issue where hint was providing the incorrect regsiter class.
Regsier hints when copying to a UACC register do not always produce VSRp registers. This patch makes sure that we do not produce hints in cases where the subregsiter of the UACC is not a VSRp. Reviewed By: nemanjai, #powerpc Differential Revision: https://reviews.llvm.org/D107101
1 parent 8011fc1 commit 754520a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,9 @@ bool PPCRegisterInfo::getRegAllocationHints(Register VirtReg,
506506
VRM->hasPhys(ResultReg)) {
507507
Register UACCPhys = VRM->getPhys(ResultReg);
508508
Register HintReg = getSubReg(UACCPhys, ResultOp->getSubReg());
509-
Hints.push_back(HintReg);
509+
// Ensure that the hint is a VSRp register.
510+
if (HintReg >= PPC::VSRp0 && HintReg <= PPC::VSRp31)
511+
Hints.push_back(HintReg);
510512
}
511513
break;
512514
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -verify-machineinstrs -mtriple powerpc64le-unknown-linux-gnu \
3+
; RUN: -mcpu=pwr10 -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names < %s \
4+
; RUN: | FileCheck %s
5+
6+
define void @copy_novsrp() local_unnamed_addr {
7+
; CHECK-LABEL: copy_novsrp:
8+
; CHECK: # %bb.0: # %dmblvi_entry
9+
; CHECK-NEXT: xxlxor v2, v2, v2
10+
; CHECK-NEXT: xxlxor vs0, vs0, vs0
11+
; CHECK-NEXT: xxlor vs3, v2, v2
12+
; CHECK-NEXT: stxv vs1, 0(0)
13+
dmblvi_entry:
14+
%0 = tail call <512 x i1> @llvm.ppc.mma.assemble.acc(<16 x i8> zeroinitializer, <16 x i8> undef, <16 x i8> undef, <16 x i8> zeroinitializer)
15+
%1 = tail call { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.ppc.mma.disassemble.acc(<512 x i1> %0)
16+
%2 = extractvalue { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } %1, 2
17+
store <16 x i8> %2, <16 x i8>* null, align 1
18+
unreachable
19+
}
20+
21+
declare <512 x i1> @llvm.ppc.mma.assemble.acc(<16 x i8>, <16 x i8>, <16 x i8>, <16 x i8>)
22+
declare { <16 x i8>, <16 x i8>, <16 x i8>, <16 x i8> } @llvm.ppc.mma.disassemble.acc(<512 x i1>)

0 commit comments

Comments
 (0)