From 49199465a3b21d86a871cb3d368b223c726f8aff Mon Sep 17 00:00:00 2001 From: Cullen Rhodes Date: Thu, 12 Dec 2019 15:24:30 +0000 Subject: [AArch64][SVE] Implement ptrue intrinsic Reviewers: sdesmalen, eli.friedman, dancgr, mgudim, cameron.mcinally, huntergr, efriedma Reviewed By: sdesmalen Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71457 --- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 4 ++++ llvm/lib/Target/AArch64/AArch64ISelLowering.h | 1 + llvm/lib/Target/AArch64/SVEInstrFormats.td | 24 ++++++++++++++---------- 3 files changed, 19 insertions(+), 10 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 87a320dfd3a..85bbb3fc43c 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -1347,6 +1347,7 @@ const char *AArch64TargetLowering::getTargetNodeName(unsigned Opcode) const { case AArch64ISD::UUNPKHI: return "AArch64ISD::UUNPKHI"; case AArch64ISD::UUNPKLO: return "AArch64ISD::UUNPKLO"; case AArch64ISD::INSR: return "AArch64ISD::INSR"; + case AArch64ISD::PTRUE: return "AArch64ISD::PTRUE"; case AArch64ISD::GLD1: return "AArch64ISD::GLD1"; case AArch64ISD::GLD1_SCALED: return "AArch64ISD::GLD1_SCALED"; case AArch64ISD::GLD1_SXTW: return "AArch64ISD::GLD1_SXTW"; @@ -2921,6 +2922,9 @@ SDValue AArch64TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, case Intrinsic::aarch64_sve_uunpklo: return DAG.getNode(AArch64ISD::UUNPKLO, dl, Op.getValueType(), Op.getOperand(1)); + case Intrinsic::aarch64_sve_ptrue: + return DAG.getNode(AArch64ISD::PTRUE, dl, Op.getValueType(), + Op.getOperand(1)); case Intrinsic::aarch64_sve_insr: { SDValue Scalar = Op.getOperand(2); diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.h b/llvm/lib/Target/AArch64/AArch64ISelLowering.h index fee8d21c2a6..1ee134c5bfc 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.h +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.h @@ -205,6 +205,7 @@ enum NodeType : unsigned { UUNPKLO, INSR, + PTRUE, // Unsigned gather loads. GLD1, diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td b/llvm/lib/Target/AArch64/SVEInstrFormats.td index 244397cbc37..99070b21480 100644 --- a/llvm/lib/Target/AArch64/SVEInstrFormats.td +++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td @@ -18,7 +18,7 @@ def SVEPatternOperand : AsmOperandClass { let DiagnosticType = "InvalidSVEPattern"; } -def sve_pred_enum : Operand, ImmLeaf, TImmLeaf { @@ -249,11 +249,12 @@ def sve_incdec_imm : Operand, ImmLeaf sz8_64, bits<3> opc, string asm, PPRRegOp pprty> +class sve_int_ptrue sz8_64, bits<3> opc, string asm, PPRRegOp pprty, + ValueType vt, SDPatternOperator op> : I<(outs pprty:$Pd), (ins sve_pred_enum:$pattern), asm, "\t$Pd, $pattern", "", - []>, Sched<[]> { + [(set (vt pprty:$Pd), (op sve_pred_enum:$pattern))]>, Sched<[]> { bits<4> Pd; bits<5> pattern; let Inst{31-24} = 0b00100101; @@ -269,11 +270,11 @@ class sve_int_ptrue sz8_64, bits<3> opc, string asm, PPRRegOp pprty> let Defs = !if(!eq (opc{0}, 1), [NZCV], []); } -multiclass sve_int_ptrue opc, string asm> { - def _B : sve_int_ptrue<0b00, opc, asm, PPR8>; - def _H : sve_int_ptrue<0b01, opc, asm, PPR16>; - def _S : sve_int_ptrue<0b10, opc, asm, PPR32>; - def _D : sve_int_ptrue<0b11, opc, asm, PPR64>; +multiclass sve_int_ptrue opc, string asm, SDPatternOperator op> { + def _B : sve_int_ptrue<0b00, opc, asm, PPR8, nxv16i1, op>; + def _H : sve_int_ptrue<0b01, opc, asm, PPR16, nxv8i1, op>; + def _S : sve_int_ptrue<0b10, opc, asm, PPR32, nxv4i1, op>; + def _D : sve_int_ptrue<0b11, opc, asm, PPR64, nxv2i1, op>; def : InstAlias(NAME # _B) PPR8:$Pd, 0b11111), 1>; @@ -285,9 +286,12 @@ multiclass sve_int_ptrue opc, string asm> { (!cast(NAME # _D) PPR64:$Pd, 0b11111), 1>; } +def SDT_AArch64PTrue : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVT<1, i32>]>; +def AArch64ptrue : SDNode<"AArch64ISD::PTRUE", SDT_AArch64PTrue>; + let Predicates = [HasSVE] in { - defm PTRUE : sve_int_ptrue<0b000, "ptrue">; - defm PTRUES : sve_int_ptrue<0b001, "ptrues">; + defm PTRUE : sve_int_ptrue<0b000, "ptrue", AArch64ptrue>; + defm PTRUES : sve_int_ptrue<0b001, "ptrues", null_frag>; } //===----------------------------------------------------------------------===// -- cgit v1.2.3