Skip to content

Commit

Permalink
[PowerPC][Future] Enable __builtin_mma_xxm[t|f]acc
Browse files Browse the repository at this point in the history
Future cpu instructions dmxxinstdmr512 and dmxxextfdmr512 insert and extract
quad vectors from the new wide accumulator(wacc) register class.
The introduction of these new instructions renders the p10 instructions
xxmtacc and xxmfacc obsolete since the new wacc register class is a better
choice for handing quad vector operations. This patch ensures that, for
future cpu, instructions dmxxinstdmr512 and dmxxextfdmr512 are generated
by custom lowering the intrinsics for xxm[t|f]acc to produce no instructions.

Reviewed By: amyk, lei

Differential Revision: https://reviews.llvm.org/D153034
  • Loading branch information
kamaub committed Jul 14, 2023
1 parent 68d2814 commit 62c1cf7
Show file tree
Hide file tree
Showing 2 changed files with 815 additions and 0 deletions.
14 changes: 14 additions & 0 deletions llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10741,6 +10741,20 @@ SDValue PPCTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
return DAG.getMergeValues(RetOps, dl);
}

case Intrinsic::ppc_mma_xxmfacc:
case Intrinsic::ppc_mma_xxmtacc: {
// Allow pre-isa-future subtargets to lower as normal.
if (!Subtarget.isISAFuture())
return SDValue();
// The intrinsics for xxmtacc and xxmfacc take one argument of
// type v512i1, for future cpu the corresponding wacc instruction
// dmxx[inst|extf]dmr512 is always generated for type v512i1, negating
// the need to produce the xxm[t|f]acc.
SDValue WideVec = Op.getOperand(1);
DAG.ReplaceAllUsesWith(Op, WideVec);
return SDValue();
}

case Intrinsic::ppc_unpack_longdouble: {
auto *Idx = dyn_cast<ConstantSDNode>(Op.getOperand(2));
assert(Idx && (Idx->getSExtValue() == 0 || Idx->getSExtValue() == 1) &&
Expand Down

0 comments on commit 62c1cf7

Please sign in to comment.