From 8e7359d3a7817d2719a76533340562989135398c Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Mon, 15 Dec 2014 20:17:46 +0000 Subject: [PATCH] [Hexagon] Adding doubleworld accumulating multiplies of halfwords. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224267 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Hexagon/HexagonInstrInfo.td | 74 ++++++++++++++++++++++ test/MC/Disassembler/Hexagon/xtype_mpy.txt | 32 ++++++++++ 2 files changed, 106 insertions(+) diff --git a/lib/Target/Hexagon/HexagonInstrInfo.td b/lib/Target/Hexagon/HexagonInstrInfo.td index fbf4e54310f..9cf057d1855 100644 --- a/lib/Target/Hexagon/HexagonInstrInfo.td +++ b/lib/Target/Hexagon/HexagonInstrInfo.td @@ -1934,6 +1934,80 @@ def M2_mpy_nac_sat_hh_s1: T_M2_mpy_acc <0b11, 1, 1, 1, 0>; def M2_mpy_nac_sat_hh_s0: T_M2_mpy_acc <0b11, 1, 1, 0, 0>; } +//===----------------------------------------------------------------------===// +// Template Class +// MPYS / Multipy signed/unsigned halfwords and add/subtract the +// result from the 64-bit destination register. +//Rxx [-+]= mpy[u](Rs.[H|L],Rt.[H|L])[:<<1][:sat] +//===----------------------------------------------------------------------===// + +class T_M2_mpyd_acc < bits<2> LHbits, bit isNac, bit hasShift, bit isUnsigned> + : MInst_acc<(outs DoubleRegs:$Rxx), + (ins DoubleRegs:$dst2, IntRegs:$Rs, IntRegs:$Rt), + "$Rxx "#!if(isNac,"-= ","+= ")#!if(isUnsigned,"mpyu","mpy") + #"($Rs."#!if(LHbits{1},"h","l") + #", $Rt."#!if(LHbits{0},"h)","l)") + #!if(hasShift,":<<1",""), + [], "$dst2 = $Rxx", M_tc_3x_SLOT23 > { + bits<5> Rxx; + bits<5> Rs; + bits<5> Rt; + + let IClass = 0b1110; + + let Inst{27-24} = 0b0110; + let Inst{23} = hasShift; + let Inst{22} = isUnsigned; + let Inst{21} = isNac; + let Inst{7} = 0; + let Inst{6-5} = LHbits; + let Inst{4-0} = Rxx; + let Inst{20-16} = Rs; + let Inst{12-8} = Rt; + } + +let isCodeGenOnly = 0 in { +def M2_mpyd_acc_hh_s0: T_M2_mpyd_acc <0b11, 0, 0, 0>; +def M2_mpyd_acc_hl_s0: T_M2_mpyd_acc <0b10, 0, 0, 0>; +def M2_mpyd_acc_lh_s0: T_M2_mpyd_acc <0b01, 0, 0, 0>; +def M2_mpyd_acc_ll_s0: T_M2_mpyd_acc <0b00, 0, 0, 0>; + +def M2_mpyd_acc_hh_s1: T_M2_mpyd_acc <0b11, 0, 1, 0>; +def M2_mpyd_acc_hl_s1: T_M2_mpyd_acc <0b10, 0, 1, 0>; +def M2_mpyd_acc_lh_s1: T_M2_mpyd_acc <0b01, 0, 1, 0>; +def M2_mpyd_acc_ll_s1: T_M2_mpyd_acc <0b00, 0, 1, 0>; + +def M2_mpyd_nac_hh_s0: T_M2_mpyd_acc <0b11, 1, 0, 0>; +def M2_mpyd_nac_hl_s0: T_M2_mpyd_acc <0b10, 1, 0, 0>; +def M2_mpyd_nac_lh_s0: T_M2_mpyd_acc <0b01, 1, 0, 0>; +def M2_mpyd_nac_ll_s0: T_M2_mpyd_acc <0b00, 1, 0, 0>; + +def M2_mpyd_nac_hh_s1: T_M2_mpyd_acc <0b11, 1, 1, 0>; +def M2_mpyd_nac_hl_s1: T_M2_mpyd_acc <0b10, 1, 1, 0>; +def M2_mpyd_nac_lh_s1: T_M2_mpyd_acc <0b01, 1, 1, 0>; +def M2_mpyd_nac_ll_s1: T_M2_mpyd_acc <0b00, 1, 1, 0>; + +def M2_mpyud_acc_hh_s0: T_M2_mpyd_acc <0b11, 0, 0, 1>; +def M2_mpyud_acc_hl_s0: T_M2_mpyd_acc <0b10, 0, 0, 1>; +def M2_mpyud_acc_lh_s0: T_M2_mpyd_acc <0b01, 0, 0, 1>; +def M2_mpyud_acc_ll_s0: T_M2_mpyd_acc <0b00, 0, 0, 1>; + +def M2_mpyud_acc_hh_s1: T_M2_mpyd_acc <0b11, 0, 1, 1>; +def M2_mpyud_acc_hl_s1: T_M2_mpyd_acc <0b10, 0, 1, 1>; +def M2_mpyud_acc_lh_s1: T_M2_mpyd_acc <0b01, 0, 1, 1>; +def M2_mpyud_acc_ll_s1: T_M2_mpyd_acc <0b00, 0, 1, 1>; + +def M2_mpyud_nac_hh_s0: T_M2_mpyd_acc <0b11, 1, 0, 1>; +def M2_mpyud_nac_hl_s0: T_M2_mpyd_acc <0b10, 1, 0, 1>; +def M2_mpyud_nac_lh_s0: T_M2_mpyd_acc <0b01, 1, 0, 1>; +def M2_mpyud_nac_ll_s0: T_M2_mpyd_acc <0b00, 1, 0, 1>; + +def M2_mpyud_nac_hh_s1: T_M2_mpyd_acc <0b11, 1, 1, 1>; +def M2_mpyud_nac_hl_s1: T_M2_mpyd_acc <0b10, 1, 1, 1>; +def M2_mpyud_nac_lh_s1: T_M2_mpyd_acc <0b01, 1, 1, 1>; +def M2_mpyud_nac_ll_s1: T_M2_mpyd_acc <0b00, 1, 1, 1>; +} + // Multiply and use lower result. // Rd=+mpyi(Rs,#u8) let isExtendable = 1, opExtendable = 2, isExtentSigned = 0, opExtentBits = 8 in diff --git a/test/MC/Disassembler/Hexagon/xtype_mpy.txt b/test/MC/Disassembler/Hexagon/xtype_mpy.txt index 9e5a170fa9c..f90310203c5 100644 --- a/test/MC/Disassembler/Hexagon/xtype_mpy.txt +++ b/test/MC/Disassembler/Hexagon/xtype_mpy.txt @@ -1,5 +1,21 @@ # RUN: llvm-mc --triple hexagon -disassemble < %s | FileCheck %s +0x10 0xdf 0x95 0xe6 +# CHECK: r17:16 += mpy(r21.l, r31.l):<<1 +0x30 0xdf 0x95 0xe6 +# CHECK: r17:16 += mpy(r21.l, r31.h):<<1 +0x50 0xdf 0x95 0xe6 +# CHECK: r17:16 += mpy(r21.h, r31.l):<<1 +0x70 0xdf 0x95 0xe6 +# CHECK: r17:16 += mpy(r21.h, r31.h):<<1 +0x10 0xdf 0xb5 0xe6 +# CHECK: r17:16 -= mpy(r21.l, r31.l):<<1 +0x30 0xdf 0xb5 0xe6 +# CHECK: r17:16 -= mpy(r21.l, r31.h):<<1 +0x50 0xdf 0xb5 0xe6 +# CHECK: r17:16 -= mpy(r21.h, r31.l):<<1 +0x70 0xdf 0xb5 0xe6 +# CHECK: r17:16 -= mpy(r21.h, r31.h):<<1 0x11 0xdf 0x95 0xec # CHECK: r17 = mpy(r21.l, r31.l):<<1 0x31 0xdf 0x95 0xec @@ -64,6 +80,22 @@ # CHECK: r17 -= mpy(r21.h, r31.l):<<1:sat 0xf1 0xdf 0xb5 0xee # CHECK: r17 -= mpy(r21.h, r31.h):<<1:sat +0x10 0xdf 0xd5 0xe6 +# CHECK: r17:16 += mpyu(r21.l, r31.l):<<1 +0x30 0xdf 0xd5 0xe6 +# CHECK: r17:16 += mpyu(r21.l, r31.h):<<1 +0x50 0xdf 0xd5 0xe6 +# CHECK: r17:16 += mpyu(r21.h, r31.l):<<1 +0x70 0xdf 0xd5 0xe6 +# CHECK: r17:16 += mpyu(r21.h, r31.h):<<1 +0x10 0xdf 0xf5 0xe6 +# CHECK: r17:16 -= mpyu(r21.l, r31.l):<<1 +0x30 0xdf 0xf5 0xe6 +# CHECK: r17:16 -= mpyu(r21.l, r31.h):<<1 +0x50 0xdf 0xf5 0xe6 +# CHECK: r17:16 -= mpyu(r21.h, r31.l):<<1 +0x70 0xdf 0xf5 0xe6 +# CHECK: r17:16 -= mpyu(r21.h, r31.h):<<1 0x11 0xdf 0xd5 0xec # CHECK: r17 = mpyu(r21.l, r31.l):<<1 0x31 0xdf 0xd5 0xec -- 2.34.1