From cb5c5f59344e69926cf516920a71cd1a28cafc48 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Tue, 30 Dec 2014 23:22:39 +0000 Subject: [PATCH] [Hexagon] Adding double-logic on predicate instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225018 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Hexagon/HexagonInstrInfoV4.td | 60 ++++++++++++++++++++++++ test/MC/Disassembler/Hexagon/cr.txt | 24 +++++++++- 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/lib/Target/Hexagon/HexagonInstrInfoV4.td b/lib/Target/Hexagon/HexagonInstrInfoV4.td index 36f7432ffaf..639548509d1 100644 --- a/lib/Target/Hexagon/HexagonInstrInfoV4.td +++ b/lib/Target/Hexagon/HexagonInstrInfoV4.td @@ -1573,6 +1573,66 @@ def J4_hintjumpr: JRInst < // NV/J - //===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// +// CR + +//===----------------------------------------------------------------------===// + +// PC-relative add +let hasNewValue = 1, isExtendable = 1, opExtendable = 1, + isExtentSigned = 0, opExtentBits = 6, hasSideEffects = 0, + Uses = [PC], validSubTargets = HasV4SubT in +def C4_addipc : CRInst <(outs IntRegs:$Rd), (ins u6Ext:$u6), + "$Rd = add(pc, #$u6)", [], "", CR_tc_2_SLOT3 > { + bits<5> Rd; + bits<6> u6; + + let IClass = 0b0110; + let Inst{27-16} = 0b101001001001; + let Inst{12-7} = u6; + let Inst{4-0} = Rd; + } + + + +let hasSideEffects = 0 in +class T_LOGICAL_3OP OpBits, bit IsNeg> + : CRInst<(outs PredRegs:$Pd), + (ins PredRegs:$Ps, PredRegs:$Pt, PredRegs:$Pu), + "$Pd = " # MnOp1 # "($Ps, " # MnOp2 # "($Pt, " # + !if (IsNeg,"!","") # "$Pu))", + [], "", CR_tc_2early_SLOT23> { + bits<2> Pd; + bits<2> Ps; + bits<2> Pt; + bits<2> Pu; + + let IClass = 0b0110; + let Inst{27-24} = 0b1011; + let Inst{23} = IsNeg; + let Inst{22-21} = OpBits; + let Inst{20} = 0b1; + let Inst{17-16} = Ps; + let Inst{13} = 0b0; + let Inst{9-8} = Pt; + let Inst{7-6} = Pu; + let Inst{1-0} = Pd; +} + +let isCodeGenOnly = 0 in { +def C4_and_and : T_LOGICAL_3OP<"and", "and", 0b00, 0>; +def C4_and_or : T_LOGICAL_3OP<"and", "or", 0b01, 0>; +def C4_or_and : T_LOGICAL_3OP<"or", "and", 0b10, 0>; +def C4_or_or : T_LOGICAL_3OP<"or", "or", 0b11, 0>; +def C4_and_andn : T_LOGICAL_3OP<"and", "and", 0b00, 1>; +def C4_and_orn : T_LOGICAL_3OP<"and", "or", 0b01, 1>; +def C4_or_andn : T_LOGICAL_3OP<"or", "and", 0b10, 1>; +def C4_or_orn : T_LOGICAL_3OP<"or", "or", 0b11, 1>; +} + +//===----------------------------------------------------------------------===// +// CR - +//===----------------------------------------------------------------------===// + //===----------------------------------------------------------------------===// // XTYPE/ALU + //===----------------------------------------------------------------------===// diff --git a/test/MC/Disassembler/Hexagon/cr.txt b/test/MC/Disassembler/Hexagon/cr.txt index e72ec9f6d62..bcba0ba34c5 100644 --- a/test/MC/Disassembler/Hexagon/cr.txt +++ b/test/MC/Disassembler/Hexagon/cr.txt @@ -26,16 +26,36 @@ # CHECK: p3 = sp3loop0 0x01 0xc3 0x02 0x6b # CHECK: p1 = and(p3, p2) +0xc1 0xc3 0x12 0x6b +# CHECK: p1 = and(p2, and(p3, p3)) 0x01 0xc3 0x62 0x6b # CHECK: p1 = and(p3, !p2) 0x01 0xc3 0x22 0x6b # CHECK: p1 = or(p3, p2) +0xc1 0xc3 0x32 0x6b +# CHECK: p1 = and(p2, or(p3, p3)) 0x01 0xc3 0xe2 0x6b # CHECK: p1 = or(p3, !p2) -0x01 0xc0 0xc2 0x6b -# CHECK: p1 = not(p2) 0x01 0xc2 0x43 0x6b # CHECK: p1 = xor(p3, p2) +0xc1 0xc3 0x52 0x6b +# CHECK: p1 = or(p2, and(p3, p3)) +0x01 0xc2 0x63 0x6b +# CHECK: p1 = and(p2, !p3) +0xc1 0xc3 0x72 0x6b +# CHECK: p1 = or(p2, or(p3, p3)) +0xc1 0xc3 0x92 0x6b +# CHECK: p1 = and(p2, and(p3, !p3)) +0xc1 0xc3 0xb2 0x6b +# CHECK: p1 = and(p2, or(p3, !p3)) +0x01 0xc0 0xc2 0x6b +# CHECK: p1 = not(p2) +0xc1 0xc3 0xd2 0x6b +# CHECK: p1 = or(p2, and(p3, !p3)) +0x01 0xc2 0xe3 0x6b +# CHECK: p1 = or(p2, !p3) +0xc1 0xc3 0xf2 0x6b +# CHECK: p1 = or(p2, or(p3, !p3)) 0x0d 0xc0 0x35 0x62 # CHECK: cs1 = r21 0x11 0xc0 0x0d 0x6a -- 2.34.1