From 63035ebee1dc118aa04f0c38cfddd68695bd297c Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Fri, 5 Dec 2014 17:58:06 +0000 Subject: [PATCH] [Hexagon] [NFC] Rearranging patterns and mux instruction. llvm-svn: 223488 --- llvm/lib/Target/Hexagon/HexagonInstrInfo.td | 76 ++++++++++++++--------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.td b/llvm/lib/Target/Hexagon/HexagonInstrInfo.td index c60e002..82f047c 100644 --- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.td +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.td @@ -229,6 +229,44 @@ let Itinerary = ALU32_3op_tc_2early_SLOT0123, isCodeGenOnly = 0 in { def C2_cmpgtu : T_ALU32_3op_cmp< "cmp.gtu", 0b11, 0, 0>; } +// Patfrag to convert the usual comparison patfrags (e.g. setlt) to ones +// that reverse the order of the operands. +class RevCmp : PatFrag<(ops node:$rhs, node:$lhs), F.Fragment>; + +// Pats for compares. They use PatFrags as operands, not SDNodes, +// since seteq/setgt/etc. are defined as ParFrags. +class T_cmp32_rr_pat + : Pat<(VT (Op (i32 IntRegs:$Rs), (i32 IntRegs:$Rt))), + (VT (MI IntRegs:$Rs, IntRegs:$Rt))>; + +def: T_cmp32_rr_pat; +def: T_cmp32_rr_pat; +def: T_cmp32_rr_pat; + +def: T_cmp32_rr_pat, i1>; +def: T_cmp32_rr_pat, i1>; + +let CextOpcode = "MUX", InputType = "reg", hasNewValue = 1 in +def C2_mux: ALU32_rr<(outs IntRegs:$Rd), + (ins PredRegs:$Pu, IntRegs:$Rs, IntRegs:$Rt), + "$Rd = mux($Pu, $Rs, $Rt)", [], "", ALU32_3op_tc_1_SLOT0123>, ImmRegRel { + bits<5> Rd; + bits<2> Pu; + bits<5> Rs; + bits<5> Rt; + + let CextOpcode = "mux"; + let InputType = "reg"; + let hasSideEffects = 0; + let IClass = 0b1111; + + let Inst{27-24} = 0b0100; + let Inst{20-16} = Rs; + let Inst{12-8} = Rt; + let Inst{6-5} = Pu; + let Inst{4-0} = Rd; +} + multiclass ALU32_Pbase { let isPredicatedNew = isPredNew in @@ -362,27 +400,6 @@ multiclass ZXTB_base minOp> { let isCodeGenOnly=0 in defm zxtb : ZXTB_base<"zxtb",0b100>, PredNewRel; -let CextOpcode = "MUX", InputType = "reg", hasNewValue = 1 in -def C2_mux: ALU32_rr<(outs IntRegs:$Rd), - (ins PredRegs:$Pu, IntRegs:$Rs, IntRegs:$Rt), - "$Rd = mux($Pu, $Rs, $Rt)", [], "", ALU32_3op_tc_1_SLOT0123>, ImmRegRel { - bits<5> Rd; - bits<2> Pu; - bits<5> Rs; - bits<5> Rt; - - let CextOpcode = "mux"; - let InputType = "reg"; - let hasSideEffects = 0; - let IClass = 0b1111; - - let Inst{27-24} = 0b0100; - let Inst{20-16} = Rs; - let Inst{12-8} = Rt; - let Inst{6-5} = Pu; - let Inst{4-0} = Rd; -} - def: Pat<(i32 (select (i1 PredRegs:$Pu), (i32 IntRegs:$Rs), (i32 IntRegs:$Rt))), (C2_mux PredRegs:$Pu, IntRegs:$Rs, IntRegs:$Rt)>; @@ -741,23 +758,6 @@ def: Pat<(i64 (and I64:$Rs, I64:$Rt)), (A2_andp I64:$Rs, I64:$Rt)>; def: Pat<(i64 (or I64:$Rs, I64:$Rt)), (A2_orp I64:$Rs, I64:$Rt)>; def: Pat<(i64 (xor I64:$Rs, I64:$Rt)), (A2_xorp I64:$Rs, I64:$Rt)>; -// Patfrag to convert the usual comparison patfrags (e.g. setlt) to ones -// that reverse the order of the operands. -class RevCmp : PatFrag<(ops node:$rhs, node:$lhs), F.Fragment>; - -// Pats for compares. They use PatFrags as operands, not SDNodes, -// since seteq/setgt/etc. are defined as ParFrags. -class T_cmp32_rr_pat - : Pat<(VT (Op (i32 IntRegs:$Rs), (i32 IntRegs:$Rt))), - (VT (MI IntRegs:$Rs, IntRegs:$Rt))>; - -def: T_cmp32_rr_pat; -def: T_cmp32_rr_pat; -def: T_cmp32_rr_pat; - -def: T_cmp32_rr_pat, i1>; -def: T_cmp32_rr_pat, i1>; - // SDNode for converting immediate C to C-1. def DEC_CONST_SIGNED : SDNodeXForm