Valery Pykhtin | 2828b9b | 2016-09-19 14:39:49 +0000 | [diff] [blame] | 1 | //===-- VOPInstructions.td - Vector Instruction Defintions ----------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | class VOP3_PseudoNew <string opName, VOPProfile P, list<dag> pattern, bit VOP3Only = 0> : |
| 11 | InstSI <P.Outs64, P.Ins64, "", pattern>, |
| 12 | VOP <opName>, |
| 13 | SIMCInstr<opName#"_e64", SIEncodingFamily.NONE>, |
| 14 | MnemonicAlias<opName#"_e64", opName> { |
| 15 | |
| 16 | let isPseudo = 1; |
| 17 | let isCodeGenOnly = 1; |
| 18 | let UseNamedOperandTable = 1; |
| 19 | |
| 20 | string Mnemonic = opName; |
| 21 | string AsmOperands = P.Asm64; |
| 22 | |
| 23 | let Size = 8; |
| 24 | let mayLoad = 0; |
| 25 | let mayStore = 0; |
| 26 | let hasSideEffects = 0; |
| 27 | let SubtargetPredicate = isGCN; |
| 28 | |
| 29 | // Because SGPRs may be allowed if there are multiple operands, we |
| 30 | // need a post-isel hook to insert copies in order to avoid |
| 31 | // violating constant bus requirements. |
| 32 | let hasPostISelHook = 1; |
| 33 | |
| 34 | // Using complex patterns gives VOP3 patterns a very high complexity rating, |
| 35 | // but standalone patterns are almost always prefered, so we need to adjust the |
| 36 | // priority lower. The goal is to use a high number to reduce complexity to |
| 37 | // zero (or less than zero). |
| 38 | let AddedComplexity = -1000; |
| 39 | |
| 40 | let VOP3 = 1; |
| 41 | let VALU = 1; |
| 42 | let Uses = [EXEC]; |
| 43 | |
| 44 | let AsmVariantName = AMDGPUAsmVariants.VOP3; |
| 45 | let AsmMatchConverter = |
| 46 | !if(!eq(VOP3Only,1), |
| 47 | "cvtVOP3", |
| 48 | !if(!eq(P.HasModifiers, 1), "cvtVOP3_2_mod", "")); |
| 49 | |
| 50 | VOPProfile Pfl = P; |
| 51 | } |
| 52 | |
| 53 | class VOP3_Real <VOP3_PseudoNew ps, int EncodingFamily> : |
| 54 | InstSI <ps.OutOperandList, ps.InOperandList, ps.Mnemonic # ps.AsmOperands, []>, |
| 55 | SIMCInstr <ps.PseudoInstr, EncodingFamily> { |
| 56 | |
| 57 | let isPseudo = 0; |
| 58 | let isCodeGenOnly = 0; |
| 59 | |
| 60 | // copy relevant pseudo op flags |
| 61 | let SubtargetPredicate = ps.SubtargetPredicate; |
| 62 | let AsmMatchConverter = ps.AsmMatchConverter; |
| 63 | let AsmVariantName = ps.AsmVariantName; |
| 64 | let Constraints = ps.Constraints; |
| 65 | let DisableEncoding = ps.DisableEncoding; |
| 66 | let TSFlags = ps.TSFlags; |
| 67 | } |
| 68 | |
| 69 | class VOP3aNew<VOPProfile P> : Enc64 { |
| 70 | bits<2> src0_modifiers; |
| 71 | bits<9> src0; |
| 72 | bits<2> src1_modifiers; |
| 73 | bits<9> src1; |
| 74 | bits<2> src2_modifiers; |
| 75 | bits<9> src2; |
| 76 | bits<1> clamp; |
| 77 | bits<2> omod; |
| 78 | |
| 79 | let Inst{8} = !if(P.HasSrc0Mods, src0_modifiers{1}, 0); |
| 80 | let Inst{9} = !if(P.HasSrc1Mods, src1_modifiers{1}, 0); |
| 81 | let Inst{10} = !if(P.HasSrc2Mods, src2_modifiers{1}, 0); |
| 82 | |
| 83 | let Inst{31-26} = 0x34; //encoding |
| 84 | let Inst{40-32} = src0; |
| 85 | let Inst{49-41} = !if(P.HasSrc1, src1, 0); |
| 86 | let Inst{58-50} = !if(P.HasSrc2, src2, 0); |
| 87 | let Inst{60-59} = !if(P.HasOMod, omod, 0); |
| 88 | let Inst{61} = !if(P.HasSrc0Mods, src0_modifiers{0}, 0); |
| 89 | let Inst{62} = !if(P.HasSrc1Mods, src1_modifiers{0}, 0); |
| 90 | let Inst{63} = !if(P.HasSrc2Mods, src2_modifiers{0}, 0); |
| 91 | } |
| 92 | |
| 93 | class VOP3a_siNew <bits<9> op, VOPProfile P> : VOP3aNew<P> { |
| 94 | let Inst{25-17} = op; |
| 95 | let Inst{11} = !if(P.HasClamp, clamp, 0); |
| 96 | } |
| 97 | |
| 98 | class VOP3a_viNew <bits<10> op, VOPProfile P> : VOP3aNew<P> { |
| 99 | let Inst{25-16} = op; |
| 100 | let Inst{15} = !if(P.HasClamp, clamp, 0); |
| 101 | } |
| 102 | |
Valery Pykhtin | e330cfa | 2016-09-20 10:41:16 +0000 | [diff] [blame^] | 103 | class VOP3e_siNew <bits<9> op, VOPProfile P> : VOP3a_siNew <op, P> { |
| 104 | bits<8> vdst; |
| 105 | let Inst{7-0} = vdst; |
| 106 | } |
| 107 | |
| 108 | class VOP3e_viNew <bits<10> op, VOPProfile P> : VOP3a_viNew <op, P> { |
| 109 | bits<8> vdst; |
| 110 | let Inst{7-0} = vdst; |
| 111 | } |
| 112 | |
| 113 | class VOP3beNew <VOPProfile P> : Enc64 { |
| 114 | bits<8> vdst; |
| 115 | bits<2> src0_modifiers; |
| 116 | bits<9> src0; |
| 117 | bits<2> src1_modifiers; |
| 118 | bits<9> src1; |
| 119 | bits<2> src2_modifiers; |
| 120 | bits<9> src2; |
| 121 | bits<7> sdst; |
| 122 | bits<2> omod; |
| 123 | |
| 124 | let Inst{7-0} = vdst; |
| 125 | let Inst{14-8} = sdst; |
| 126 | let Inst{31-26} = 0x34; //encoding |
| 127 | let Inst{40-32} = !if(P.HasSrc0, src0, 0); |
| 128 | let Inst{49-41} = !if(P.HasSrc1, src1, 0); |
| 129 | let Inst{58-50} = !if(P.HasSrc2, src2, 0); |
| 130 | let Inst{60-59} = !if(P.HasOMod, omod, 0); |
| 131 | let Inst{61} = !if(P.HasSrc0Mods, src0_modifiers{0}, 0); |
| 132 | let Inst{62} = !if(P.HasSrc1Mods, src1_modifiers{0}, 0); |
| 133 | let Inst{63} = !if(P.HasSrc2Mods, src2_modifiers{0}, 0); |
| 134 | } |
| 135 | |
| 136 | class VOP3be_siNew <bits<9> op, VOPProfile P> : VOP3beNew<P> { |
| 137 | let Inst{25-17} = op; |
| 138 | } |
| 139 | |
| 140 | class VOP3be_viNew <bits<10> op, VOPProfile P> : VOP3beNew<P> { |
| 141 | bits<1> clamp; |
| 142 | let Inst{25-16} = op; |
| 143 | let Inst{15} = !if(P.HasClamp, clamp, 0); |
| 144 | } |
| 145 | |
Valery Pykhtin | 2828b9b | 2016-09-19 14:39:49 +0000 | [diff] [blame] | 146 | class VOP_SDWAeNew<VOPProfile P> : Enc64 { |
| 147 | bits<8> src0; |
| 148 | bits<3> src0_sel; |
| 149 | bits<2> src0_fmodifiers; // {abs,neg} |
| 150 | bits<1> src0_imodifiers; // sext |
| 151 | bits<3> src1_sel; |
| 152 | bits<2> src1_fmodifiers; |
| 153 | bits<1> src1_imodifiers; |
| 154 | bits<3> dst_sel; |
| 155 | bits<2> dst_unused; |
| 156 | bits<1> clamp; |
| 157 | |
| 158 | bits<3> SDWA_DWORD = 6; |
| 159 | bits<2> SDWA_UNUSED_PRESERVE = 2; |
| 160 | |
| 161 | let Inst{39-32} = !if(P.HasSrc0, src0{7-0}, 0); |
| 162 | let Inst{42-40} = !if(P.HasDst, dst_sel{2-0}, SDWA_DWORD{2-0}); |
| 163 | let Inst{44-43} = !if(P.HasDst, dst_unused{1-0}, SDWA_UNUSED_PRESERVE{1-0}); |
| 164 | let Inst{45} = !if(P.HasSDWAClamp, clamp{0}, 0); |
| 165 | let Inst{50-48} = !if(P.HasSrc0, src0_sel{2-0}, SDWA_DWORD{2-0}); |
| 166 | let Inst{53-52} = !if(P.HasSrc0Mods, src0_fmodifiers{1-0}, 0); |
| 167 | let Inst{51} = !if(P.HasSrc0IntMods, src0_imodifiers{0}, 0); |
| 168 | let Inst{58-56} = !if(P.HasSrc1, src1_sel{2-0}, SDWA_DWORD{2-0}); |
| 169 | let Inst{61-60} = !if(P.HasSrc1Mods, src1_fmodifiers{1-0}, 0); |
| 170 | let Inst{59} = !if(P.HasSrc1IntMods, src1_imodifiers{0}, 0); |
| 171 | } |
| 172 | |
| 173 | include "VOPCInstructions.td" |
Valery Pykhtin | e330cfa | 2016-09-20 10:41:16 +0000 | [diff] [blame^] | 174 | include "VOP3Instructions.td" |