[Hexagon] Adding encoding bits for halfword multiplies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224261 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Colin LeMahieu 2014-12-15 19:22:07 +00:00
parent 77effd8d7e
commit e9e8f1fe77
2 changed files with 49 additions and 0 deletions

View File

@ -1744,6 +1744,45 @@ let Defs = [R29, R30, R31], Uses = [R29], hasSideEffects = 0 in {
//===----------------------------------------------------------------------===//
// MTYPE/MPYH +
//===----------------------------------------------------------------------===//
let hasNewValue = 1, opNewValue = 0 in
class T_M2_mpy < bits<2> LHbits, bit isSat, bit isRnd,
bit hasShift, bit isUnsigned>
: MInst < (outs IntRegs:$Rd), (ins IntRegs:$Rs, IntRegs:$Rt),
"$Rd = "#!if(isUnsigned,"mpyu","mpy")#"($Rs."#!if(LHbits{1},"h","l")
#", $Rt."#!if(LHbits{0},"h)","l)")
#!if(hasShift,":<<1","")
#!if(isRnd,":rnd","")
#!if(isSat,":sat",""),
[], "", M_tc_3x_SLOT23 > {
bits<5> Rd;
bits<5> Rs;
bits<5> Rt;
let IClass = 0b1110;
let Inst{27-24} = 0b1100;
let Inst{23} = hasShift;
let Inst{22} = isUnsigned;
let Inst{21} = isRnd;
let Inst{7} = isSat;
let Inst{6-5} = LHbits;
let Inst{4-0} = Rd;
let Inst{20-16} = Rs;
let Inst{12-8} = Rt;
}
//Rd=mpy(Rs.[H|L],Rt.[H|L])[:<<1]
let isCodeGenOnly = 0 in {
def M2_mpy_ll_s1: T_M2_mpy<0b00, 0, 0, 1, 0>;
def M2_mpy_ll_s0: T_M2_mpy<0b00, 0, 0, 0, 0>;
def M2_mpy_lh_s1: T_M2_mpy<0b01, 0, 0, 1, 0>;
def M2_mpy_lh_s0: T_M2_mpy<0b01, 0, 0, 0, 0>;
def M2_mpy_hl_s1: T_M2_mpy<0b10, 0, 0, 1, 0>;
def M2_mpy_hl_s0: T_M2_mpy<0b10, 0, 0, 0, 0>;
def M2_mpy_hh_s1: T_M2_mpy<0b11, 0, 0, 1, 0>;
def M2_mpy_hh_s0: T_M2_mpy<0b11, 0, 0, 0, 0>;
}
// Multiply and use lower result.
// Rd=+mpyi(Rs,#u8)
let isExtendable = 1, opExtendable = 2, isExtentSigned = 0, opExtentBits = 8 in

View File

@ -0,0 +1,10 @@
# RUN: llvm-mc --triple hexagon -disassemble < %s | FileCheck %s
0x11 0xdf 0x95 0xec
# CHECK: r17 = mpy(r21.l, r31.l):<<1
0x31 0xdf 0x95 0xec
# CHECK: r17 = mpy(r21.l, r31.h):<<1
0x51 0xdf 0x95 0xec
# CHECK: r17 = mpy(r21.h, r31.l):<<1
0x71 0xdf 0x95 0xec
# CHECK: r17 = mpy(r21.h, r31.h):<<1