From eabc0d0fd5fff7f2e6385b5b60d3fff5e9862b55 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Tue, 16 Aug 2016 17:14:44 +0000 Subject: [PATCH] [Hexagon] Clean up some miscellaneous V60 intrinsics a bit llvm-svn: 278823 --- .../Target/Hexagon/AsmParser/HexagonAsmParser.cpp | 2 +- llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp | 4 +- llvm/lib/Target/Hexagon/HexagonInstrAlias.td | 10 ++- llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp | 18 +++--- llvm/lib/Target/Hexagon/HexagonInstrInfoV60.td | 22 +++++++ llvm/lib/Target/Hexagon/HexagonIntrinsicsV60.td | 71 ++++++---------------- 6 files changed, 58 insertions(+), 69 deletions(-) diff --git a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp index c9a2ba4..ba4dfab 100644 --- a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp +++ b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp @@ -1642,7 +1642,7 @@ int HexagonAsmParser::processInstruction(MCInst &Inst, } // Translate a "$Vdd = $Vss" to "$Vdd = vcombine($Vs, $Vt)" - case Hexagon::HEXAGON_V6_vassignpair: { + case Hexagon::V6_vassignp: { MCOperand &MO = Inst.getOperand(1); unsigned int RegPairNum = RI->getEncodingValue(MO.getReg()); std::string R1 = v + llvm::utostr(RegPairNum + 1); diff --git a/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp b/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp index c95c893..e029ed4 100644 --- a/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp +++ b/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp @@ -550,8 +550,8 @@ void HexagonAsmPrinter::HexagonProcessInstruction(MCInst &Inst, Rt.setReg(getHexagonRegisterPair(Rt.getReg(), RI)); return; } - case Hexagon::HEXAGON_V6_vd0_pseudo: - case Hexagon::HEXAGON_V6_vd0_pseudo_128B: { + case Hexagon::V6_vd0: + case Hexagon::V6_vd0_128B: { MCInst TmpInst; assert (Inst.getOperand(0).isReg() && "Expected register and none was found"); diff --git a/llvm/lib/Target/Hexagon/HexagonInstrAlias.td b/llvm/lib/Target/Hexagon/HexagonInstrAlias.td index 9cbeae7..b5450ae 100644 --- a/llvm/lib/Target/Hexagon/HexagonInstrAlias.td +++ b/llvm/lib/Target/Hexagon/HexagonInstrAlias.td @@ -492,12 +492,10 @@ def : InstAlias<"if ($src1) jumpr $src2", def : InstAlias<"if (!$src1) jumpr $src2", (J2_jumprf PredRegs:$src1, IntRegs:$src2), 0>; -// V6_vassignp: Vector assign mapping. -let hasNewValue = 1, opNewValue = 0, isAsmParserOnly = 1 in -def HEXAGON_V6_vassignpair: CVI_VA_DV_Resource < - (outs VecDblRegs:$Vdd), - (ins VecDblRegs:$Vss), - "$Vdd = $Vss">; +// maps Vdd = Vss to Vdd = V6_vassignp(Vss) +def : InstAlias<"$Vdd = $Vss", + (V6_vassignp VecDblRegs:$Vdd, VecDblRegs:$Vss)>, + Requires<[HasV60T]>; // maps Vd = #0 to Vd = vxor(Vd, Vd) def : InstAlias<"$Vd = #0", diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp index 6cdc810..d36303f 100644 --- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp @@ -1013,17 +1013,19 @@ bool HexagonInstrInfo::expandPostRAPseudo(MachineInstr &MI) const { .addImm(-MI.getOperand(1).getImm()); MBB.erase(MI); return true; - case Hexagon::HEXAGON_V6_vassignp_128B: - case Hexagon::HEXAGON_V6_vassignp: { + case Hexagon::V6_vassignp_128B: + case Hexagon::V6_vassignp: { unsigned SrcReg = MI.getOperand(1).getReg(); unsigned DstReg = MI.getOperand(0).getReg(); - if (SrcReg != DstReg) - copyPhysReg(MBB, MI, DL, DstReg, SrcReg, MI.getOperand(1).isKill()); + unsigned Kill = getKillRegState(MI.getOperand(1).isKill()); + BuildMI(MBB, MI, DL, get(Hexagon::V6_vcombine), DstReg) + .addReg(HRI.getSubReg(SrcReg, Hexagon::subreg_hireg), Kill) + .addReg(HRI.getSubReg(SrcReg, Hexagon::subreg_loreg), Kill); MBB.erase(MI); return true; } - case Hexagon::HEXAGON_V6_lo_128B: - case Hexagon::HEXAGON_V6_lo: { + case Hexagon::V6_lo_128B: + case Hexagon::V6_lo: { unsigned SrcReg = MI.getOperand(1).getReg(); unsigned DstReg = MI.getOperand(0).getReg(); unsigned SrcSubLo = HRI.getSubReg(SrcReg, Hexagon::subreg_loreg); @@ -1032,8 +1034,8 @@ bool HexagonInstrInfo::expandPostRAPseudo(MachineInstr &MI) const { MRI.clearKillFlags(SrcSubLo); return true; } - case Hexagon::HEXAGON_V6_hi_128B: - case Hexagon::HEXAGON_V6_hi: { + case Hexagon::V6_hi_128B: + case Hexagon::V6_hi: { unsigned SrcReg = MI.getOperand(1).getReg(); unsigned DstReg = MI.getOperand(0).getReg(); unsigned SrcSubHi = HRI.getSubReg(SrcReg, Hexagon::subreg_hireg); diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfoV60.td b/llvm/lib/Target/Hexagon/HexagonInstrInfoV60.td index a625c06..eb14fe4 100644 --- a/llvm/lib/Target/Hexagon/HexagonInstrInfoV60.td +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfoV60.td @@ -2263,3 +2263,25 @@ def V6_vhistq def V6_vhist : CVI_HIST_Resource1 <(outs), (ins), "vhist" >, V6_vhist_enc; + + +let isPseudo = 1, isCodeGenOnly = 1, hasSideEffects = 0 in { + def V6_vd0: CVI_VA_Resource<(outs VectorRegs:$dst), (ins), "$dst = #0", []>; + def V6_vd0_128B: CVI_VA_Resource<(outs VectorRegs128B:$dst), (ins), + "$dst = #0", []>; + + def V6_vassignp: CVI_VA_Resource<(outs VecDblRegs:$dst), + (ins VecDblRegs:$src), "", []>; + def V6_vassignp_128B : CVI_VA_Resource<(outs VecDblRegs128B:$dst), + (ins VecDblRegs128B:$src), "", []>; + + def V6_lo: CVI_VA_Resource<(outs VectorRegs:$dst), (ins VecDblRegs:$src1), + "", []>; + def V6_lo_128B: CVI_VA_Resource<(outs VectorRegs128B:$dst), + (ins VecDblRegs128B:$src1), "", []>; + + def V6_hi: CVI_VA_Resource<(outs VectorRegs:$dst), (ins VecDblRegs:$src1), + "", []>; + def V6_hi_128B: CVI_VA_Resource<(outs VectorRegs128B:$dst), + (ins VecDblRegs128B:$src1), "", []>; +} diff --git a/llvm/lib/Target/Hexagon/HexagonIntrinsicsV60.td b/llvm/lib/Target/Hexagon/HexagonIntrinsicsV60.td index 82bc91b..43c1e2c 100644 --- a/llvm/lib/Target/Hexagon/HexagonIntrinsicsV60.td +++ b/llvm/lib/Target/Hexagon/HexagonIntrinsicsV60.td @@ -12,55 +12,6 @@ //===----------------------------------------------------------------------===// -let isCodeGenOnly = 1 in { -def HEXAGON_V6_vd0_pseudo : CVI_VA_Resource<(outs VectorRegs:$dst), - (ins ), - "$dst=#0", - [(set VectorRegs:$dst, (int_hexagon_V6_vd0 ))]>; - -def HEXAGON_V6_vd0_pseudo_128B : CVI_VA_Resource<(outs VectorRegs128B:$dst), - (ins ), - "$dst=#0", - [(set VectorRegs128B:$dst, (int_hexagon_V6_vd0_128B ))]>; -} - -let isPseudo = 1 in -def HEXAGON_V6_vassignp : CVI_VA_Resource<(outs VecDblRegs:$dst), - (ins VecDblRegs:$src1), - "$dst=vassignp_W($src1)", - [(set VecDblRegs:$dst, (int_hexagon_V6_vassignp VecDblRegs:$src1))]>; - -let isPseudo = 1 in -def HEXAGON_V6_vassignp_128B : CVI_VA_Resource<(outs VecDblRegs128B:$dst), - (ins VecDblRegs128B:$src1), - "$dst=vassignp_W_128B($src1)", - [(set VecDblRegs128B:$dst, (int_hexagon_V6_vassignp_128B - VecDblRegs128B:$src1))]>; - -let isPseudo = 1 in -def HEXAGON_V6_lo : CVI_VA_Resource<(outs VectorRegs:$dst), - (ins VecDblRegs:$src1), - "$dst=lo_W($src1)", - [(set VectorRegs:$dst, (int_hexagon_V6_lo VecDblRegs:$src1))]>; - -let isPseudo = 1 in -def HEXAGON_V6_hi : CVI_VA_Resource<(outs VectorRegs:$dst), - (ins VecDblRegs:$src1), - "$dst=hi_W($src1)", - [(set VectorRegs:$dst, (int_hexagon_V6_hi VecDblRegs:$src1))]>; - -let isPseudo = 1 in -def HEXAGON_V6_lo_128B : CVI_VA_Resource<(outs VectorRegs128B:$dst), - (ins VecDblRegs128B:$src1), - "$dst=lo_W($src1)", - [(set VectorRegs128B:$dst, (int_hexagon_V6_lo_128B VecDblRegs128B:$src1))]>; - -let isPseudo = 1 in -def HEXAGON_V6_hi_128B : CVI_VA_Resource<(outs VectorRegs128B:$dst), - (ins VecDblRegs128B:$src1), - "$dst=hi_W($src1)", - [(set VectorRegs128B:$dst, (int_hexagon_V6_hi_128B VecDblRegs128B:$src1))]>; - let AddedComplexity = 100 in { def : Pat < (v16i32 (int_hexagon_V6_lo (v32i32 VecDblRegs:$src1))), (v16i32 (EXTRACT_SUBREG (v32i32 VecDblRegs:$src1), subreg_loreg)) >, @@ -204,6 +155,16 @@ multiclass T_V_pat { Requires<[UseHVXDbl]>; } +multiclass T_W_pat { + def: Pat<(IntID VecDblRegs:$src1), + (MI VecDblRegs:$src1)>, + Requires<[UseHVXSgl]>; + + def: Pat<(!cast(IntID#"_128B") VecDblRegs128B:$src1), + (!cast(MI#"_128B") VecDblRegs128B:$src1)>, + Requires<[UseHVXDbl]>; +} + multiclass T_Q_pat { def: Pat<(IntID VecPredRegs:$src1), (MI VecPredRegs:$src1)>, @@ -495,7 +456,7 @@ multiclass T_WVVR_pat { Requires<[UseHVXDbl]>; } -defm : T_WR_pat; +defm : T_WR_pat ; defm : T_WR_pat ; defm : T_VR_pat ; defm : T_VR_pat ; @@ -751,6 +712,10 @@ defm : T_V_pat ; defm : T_V_pat ; defm : T_V_pat ; +defm : T_W_pat ; +defm : T_W_pat ; +defm : T_W_pat ; + defm : T_WRI_pat ; defm : T_WRI_pat ; defm : T_WRI_pat ; @@ -831,8 +796,10 @@ def : T_PPQ_pat ; def: Pat<(v64i16 (trunc v64i32:$Vdd)), (v64i16 (V6_vpackwh_sat_128B - (v32i32 (HEXAGON_V6_hi_128B VecDblRegs128B:$Vdd)), - (v32i32 (HEXAGON_V6_lo_128B VecDblRegs128B:$Vdd))))>, + (v32i32 (V6_hi_128B VecDblRegs128B:$Vdd)), + (v32i32 (V6_lo_128B VecDblRegs128B:$Vdd))))>, Requires<[UseHVXDbl]>; +def: Pat<(int_hexagon_V6_vd0), (V6_vd0)>; +def: Pat<(int_hexagon_V6_vd0_128B), (V6_vd0_128B)>; -- 2.7.4