[Hexagon] Allow use of gather intrinsics even with no-packets

Vgather requires must be in a packet with a store, which contradicts
the no-packets feature. As a consequence, gather/scatter could not be
used with no-packets. Relax this, and allow gather packets as exceptions
to the no-packets requirements.

llvm-svn: 339177
This commit is contained in:
Krzysztof Parzyszek 2018-08-07 20:33:47 +00:00
parent 9b07347033
commit e7ce247dd7
3 changed files with 26 additions and 14 deletions

View File

@ -755,7 +755,6 @@ void HexagonAsmPrinter::EmitInstruction(const MachineInstr *MI) {
const MCInstrInfo &MCII = *Subtarget->getInstrInfo();
if (MI->isBundle()) {
assert(Subtarget->usePackets() && "Support for packets is disabled");
const MachineBasicBlock* MBB = MI->getParent();
MachineBasicBlock::const_instr_iterator MII = MI->getIterator();

View File

@ -2048,10 +2048,6 @@ void HexagonDAGToDAGISel::SelectHvxVAlign(SDNode *N) {
}
void HexagonDAGToDAGISel::SelectV65GatherPred(SDNode *N) {
if (!HST->usePackets()) {
report_fatal_error("Support for gather requires packets, "
"which are disabled");
}
const SDLoc &dl(N);
SDValue Chain = N->getOperand(0);
SDValue Address = N->getOperand(2);
@ -2091,10 +2087,6 @@ void HexagonDAGToDAGISel::SelectV65GatherPred(SDNode *N) {
}
void HexagonDAGToDAGISel::SelectV65Gather(SDNode *N) {
if (!HST->usePackets()) {
report_fatal_error("Support for gather requires packets, "
"which are disabled");
}
const SDLoc &dl(N);
SDValue Chain = N->getOperand(0);
SDValue Address = N->getOperand(2);

View File

@ -1,11 +1,32 @@
; RUN: llc -march=hexagon -mattr=+hvxv60,hvx-length64b < %s | FileCheck %s --check-prefix=CHECK-GATHER
; RUN: not llc -march=hexagon -mattr=+hvxv60,hvx-length64b,-packets %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
; RUN: llc -march=hexagon -mattr=+hvxv60,hvx-length64b,-packets < %s | FileCheck %s
target triple = "hexagon"
; CHECK-GATHER-LABEL: fred:
; CHECK-GATHER: vgather
; CHECK-ERROR: LLVM ERROR: Support for gather requires packets, which are disabled
; Check that the only (multi-instruction) packet is the one with vgather.
; CHECK-LABEL: fred:
; CHECK: {
; CHECK-NEXT: allocframe(r29,#64):raw
; CHECK-NEXT: }
; CHECK-NEXT: {
; CHECK-NEXT: m0 = r2
; CHECK-NEXT: }
; CHECK-NEXT: {
; CHECK-NEXT: vtmp.w = vgather(r1,m0,v0.w).w
; CHECK-NEXT: vmem(r0+#0) = vtmp.new
; CHECK-NEXT: }
; CHECK-NEXT: {
; CHECK-NEXT: r29 = and(r29,#-64)
; CHECK-NEXT: }
; CHECK-NEXT: {
; CHECK-NEXT: r0 = add(r29,#0)
; CHECK-NEXT: }
; CHECK-NEXT: {
; CHECK-NEXT: call foo
; CHECK-NEXT: }
; CHECK-NEXT: {
; CHECK-NEXT: r31:30 = dealloc_return(r30):raw
; CHECK-NEXT: }
define void @fred(i8* %p, i32 %x, i32 %y) local_unnamed_addr #0 {
entry: