Skip to content

Commit

Permalink
[SME2][AArch64] Add multi-vector rounding shift left intrinsics
Browse files Browse the repository at this point in the history
Adds intrinsics for the following SME2 instructions:
 - srshl (single, 2 & 4 vector)
 - srshl (multi, 2 & 4 vector)
 - urshl (single, 2 & 4 vector)
 - urshl (multi, 2 & 4 vector)

NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D144118
  • Loading branch information
kmclaughlin-arm committed Feb 23, 2023
1 parent 1387a13 commit 6c82d16
Show file tree
Hide file tree
Showing 3 changed files with 711 additions and 0 deletions.
14 changes: 14 additions & 0 deletions llvm/include/llvm/IR/IntrinsicsAArch64.td
Expand Up @@ -3017,6 +3017,20 @@ let TargetPrefix = "aarch64" in {
def int_aarch64_sme_bmopa_za32 : SME_OuterProduct_Intrinsic;
def int_aarch64_sme_bmops_za32 : SME_OuterProduct_Intrinsic;

//
// Multi-vector rounding shift left intrinsics
//

def int_aarch64_sve_srshl_single_x2 : SME2_VG2_Multi_Single_Intrinsic;
def int_aarch64_sve_urshl_single_x2 : SME2_VG2_Multi_Single_Intrinsic;
def int_aarch64_sve_srshl_single_x4 : SME2_VG4_Multi_Single_Intrinsic;
def int_aarch64_sve_urshl_single_x4 : SME2_VG4_Multi_Single_Intrinsic;

def int_aarch64_sve_srshl_x2 : SME2_VG2_Multi_Multi_Intrinsic;
def int_aarch64_sve_urshl_x2 : SME2_VG2_Multi_Multi_Intrinsic;
def int_aarch64_sve_srshl_x4 : SME2_VG4_Multi_Multi_Intrinsic;
def int_aarch64_sve_urshl_x4 : SME2_VG4_Multi_Multi_Intrinsic;

// Multi-vector saturating rounding shift right intrinsics

def int_aarch64_sve_sqrshr_x2 : SME2_VG2_Multi_Imm_Intrinsic;
Expand Down
56 changes: 56 additions & 0 deletions llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
Expand Up @@ -4956,6 +4956,62 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
if (tryMULLV64LaneV128(IntNo, Node))
return;
break;
case Intrinsic::aarch64_sve_srshl_single_x2:
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::Int>(
Node->getValueType(0),
{AArch64::SRSHL_VG2_2ZZ_B, AArch64::SRSHL_VG2_2ZZ_H,
AArch64::SRSHL_VG2_2ZZ_S, AArch64::SRSHL_VG2_2ZZ_D}))
SelectDestructiveMultiIntrinsic(Node, 2, false, Op);
return;
case Intrinsic::aarch64_sve_srshl_single_x4:
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::Int>(
Node->getValueType(0),
{AArch64::SRSHL_VG4_4ZZ_B, AArch64::SRSHL_VG4_4ZZ_H,
AArch64::SRSHL_VG4_4ZZ_S, AArch64::SRSHL_VG4_4ZZ_D}))
SelectDestructiveMultiIntrinsic(Node, 4, false, Op);
return;
case Intrinsic::aarch64_sve_urshl_single_x2:
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::Int>(
Node->getValueType(0),
{AArch64::URSHL_VG2_2ZZ_B, AArch64::URSHL_VG2_2ZZ_H,
AArch64::URSHL_VG2_2ZZ_S, AArch64::URSHL_VG2_2ZZ_D}))
SelectDestructiveMultiIntrinsic(Node, 2, false, Op);
return;
case Intrinsic::aarch64_sve_urshl_single_x4:
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::Int>(
Node->getValueType(0),
{AArch64::URSHL_VG4_4ZZ_B, AArch64::URSHL_VG4_4ZZ_H,
AArch64::URSHL_VG4_4ZZ_S, AArch64::URSHL_VG4_4ZZ_D}))
SelectDestructiveMultiIntrinsic(Node, 4, false, Op);
return;
case Intrinsic::aarch64_sve_srshl_x2:
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::Int>(
Node->getValueType(0),
{AArch64::SRSHL_VG2_2Z2Z_B, AArch64::SRSHL_VG2_2Z2Z_H,
AArch64::SRSHL_VG2_2Z2Z_S, AArch64::SRSHL_VG2_2Z2Z_D}))
SelectDestructiveMultiIntrinsic(Node, 2, true, Op);
return;
case Intrinsic::aarch64_sve_srshl_x4:
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::Int>(
Node->getValueType(0),
{AArch64::SRSHL_VG4_4Z4Z_B, AArch64::SRSHL_VG4_4Z4Z_H,
AArch64::SRSHL_VG4_4Z4Z_S, AArch64::SRSHL_VG4_4Z4Z_D}))
SelectDestructiveMultiIntrinsic(Node, 4, true, Op);
return;
case Intrinsic::aarch64_sve_urshl_x2:
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::Int>(
Node->getValueType(0),
{AArch64::URSHL_VG2_2Z2Z_B, AArch64::URSHL_VG2_2Z2Z_H,
AArch64::URSHL_VG2_2Z2Z_S, AArch64::URSHL_VG2_2Z2Z_D}))
SelectDestructiveMultiIntrinsic(Node, 2, true, Op);
return;
case Intrinsic::aarch64_sve_urshl_x4:
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::Int>(
Node->getValueType(0),
{AArch64::URSHL_VG4_4Z4Z_B, AArch64::URSHL_VG4_4Z4Z_H,
AArch64::URSHL_VG4_4Z4Z_S, AArch64::URSHL_VG4_4Z4Z_D}))
SelectDestructiveMultiIntrinsic(Node, 4, true, Op);
return;
case Intrinsic::aarch64_sve_sqdmulh_single_vgx2:
if (auto Op = SelectOpcodeFromVT<SelectTypeKind::Int>(
Node->getValueType(0),
Expand Down

0 comments on commit 6c82d16

Please sign in to comment.