Skip to content

Commit

Permalink
[PowerPC] Add support for vmsumudm
Browse files Browse the repository at this point in the history
This patch adds support for Vector Multiply-Sum Unsigned Doubleword Modulo
instruction; vmsumudm.

Differential Revision: https://reviews.llvm.org/D80294

(cherry picked from commit a28e9f1)
  • Loading branch information
ahsansaghir authored and tstellar committed Jun 22, 2020
1 parent 6f71678 commit 3428405
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions llvm/include/llvm/IR/IntrinsicsPowerPC.td
Expand Up @@ -488,6 +488,9 @@ let TargetPrefix = "ppc" in { // All PPC intrinsics start with "llvm.ppc.".
def int_ppc_altivec_vmsumuhm : GCCBuiltin<"__builtin_altivec_vmsumuhm">,
Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
llvm_v4i32_ty], [IntrNoMem]>;
def int_ppc_altivec_vmsumudm : GCCBuiltin<"__builtin_altivec_vmsumudm">,
Intrinsic<[llvm_v1i128_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
llvm_v1i128_ty], [IntrNoMem]>;
def int_ppc_altivec_vmsumuhs : GCCBuiltin<"__builtin_altivec_vmsumuhs">,
Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
llvm_v4i32_ty], [IntrNoMem]>;
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/PowerPC/P9InstrResources.td
Expand Up @@ -373,6 +373,7 @@ def : InstRW<[P9_DPE_7C, P9_DPO_7C, IP_EXECE_1C, IP_EXECO_1C, DISP_1C],
VMSUMSHS,
VMSUMUBM,
VMSUMUHM,
VMSUMUDM,
VMSUMUHS,
VMULESB,
VMULESH,
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/PowerPC/PPCInstrAltivec.td
Expand Up @@ -1342,6 +1342,10 @@ def VSBOX : VXBX_Int_Ty<1480, "vsbox", int_ppc_altivec_crypto_vsbox, v2i64>;
def HasP9Altivec : Predicate<"PPCSubTarget->hasP9Altivec()">;
let Predicates = [HasP9Altivec] in {

// Vector Multiply-Sum
def VMSUMUDM : VA1a_Int_Ty3<35, "vmsumudm", int_ppc_altivec_vmsumudm,
v1i128, v2i64, v1i128>;

// i8 element comparisons.
def VCMPNEB : VCMP < 7, "vcmpneb $vD, $vA, $vB" , v16i8>;
def VCMPNEB_rec : VCMPo < 7, "vcmpneb. $vD, $vA, $vB" , v16i8>;
Expand Down
3 changes: 3 additions & 0 deletions llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-vmx.txt
Expand Up @@ -333,6 +333,9 @@
# CHECK: vmsumuhm 2, 3, 4, 5
0x10 0x43 0x21 0x66

# CHECK: vmsumudm 2, 3, 4, 5
0x10 0x43 0x21 0x63

# CHECK: vmsumuhs 2, 3, 4, 5
0x10 0x43 0x21 0x67

Expand Down
3 changes: 3 additions & 0 deletions llvm/test/MC/PowerPC/ppc64-encoding-vmx.s
Expand Up @@ -366,6 +366,9 @@
# CHECK-BE: vmsumuhm 2, 3, 4, 5 # encoding: [0x10,0x43,0x21,0x66]
# CHECK-LE: vmsumuhm 2, 3, 4, 5 # encoding: [0x66,0x21,0x43,0x10]
vmsumuhm 2, 3, 4, 5
# CHECK-BE: vmsumudm 2, 3, 4, 5 # encoding: [0x10,0x43,0x21,0x63]
# CHECK-LE: vmsumudm 2, 3, 4, 5 # encoding: [0x63,0x21,0x43,0x10]
vmsumudm 2, 3, 4, 5
# CHECK-BE: vmsumuhs 2, 3, 4, 5 # encoding: [0x10,0x43,0x21,0x67]
# CHECK-LE: vmsumuhs 2, 3, 4, 5 # encoding: [0x67,0x21,0x43,0x10]
vmsumuhs 2, 3, 4, 5
Expand Down

0 comments on commit 3428405

Please sign in to comment.