PPCInstrPrefix.td 128 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889
  1. //-------------------------- Predicate definitions ---------------------------//
  2. def IsPPC32 : Predicate<"!Subtarget->isPPC64()">;
  3. // Mask immediates for MMA instructions (2, 4 and 8 bits).
  4. def Msk2Imm : ImmLeaf<i32, [{ return isUInt<2>(Imm); }]>;
  5. def Msk4Imm : ImmLeaf<i32, [{ return isUInt<4>(Imm); }]>;
  6. def Msk8Imm : ImmLeaf<i32, [{ return isUInt<8>(Imm); }]>;
  7. //===----------------------------------------------------------------------===//
  8. // PowerPC ISA 3.1 specific type constraints.
  9. //
  10. def SDT_PPCSplat32 : SDTypeProfile<1, 3, [ SDTCisVT<0, v2i64>,
  11. SDTCisVec<1>, SDTCisInt<2>, SDTCisInt<3>
  12. ]>;
  13. def SDT_PPCAccBuild : SDTypeProfile<1, 4, [
  14. SDTCisVT<0, v512i1>, SDTCisVT<1, v4i32>, SDTCisVT<2, v4i32>,
  15. SDTCisVT<3, v4i32>, SDTCisVT<4, v4i32>
  16. ]>;
  17. def SDT_PPCPairBuild : SDTypeProfile<1, 2, [
  18. SDTCisVT<0, v256i1>, SDTCisVT<1, v4i32>, SDTCisVT<2, v4i32>
  19. ]>;
  20. def SDT_PPCAccExtractVsx : SDTypeProfile<1, 2, [
  21. SDTCisVT<0, v4i32>, SDTCisVT<1, v512i1>, SDTCisPtrTy<2>
  22. ]>;
  23. def SDT_PPCPairExtractVsx : SDTypeProfile<1, 2, [
  24. SDTCisVT<0, v4i32>, SDTCisVT<1, v256i1>, SDTCisPtrTy<2>
  25. ]>;
  26. def SDT_PPCxxmfacc : SDTypeProfile<1, 1, [
  27. SDTCisVT<0, v512i1>, SDTCisVT<1, v512i1>
  28. ]>;
  29. //===----------------------------------------------------------------------===//
  30. // ISA 3.1 specific PPCISD nodes.
  31. //
  32. def PPCxxsplti32dx : SDNode<"PPCISD::XXSPLTI32DX", SDT_PPCSplat32, []>;
  33. def PPCAccBuild : SDNode<"PPCISD::ACC_BUILD", SDT_PPCAccBuild, []>;
  34. def PPCPairBuild : SDNode<"PPCISD::PAIR_BUILD", SDT_PPCPairBuild, []>;
  35. def PPCAccExtractVsx : SDNode<"PPCISD::EXTRACT_VSX_REG", SDT_PPCAccExtractVsx,
  36. []>;
  37. def PPCPairExtractVsx : SDNode<"PPCISD::EXTRACT_VSX_REG", SDT_PPCPairExtractVsx,
  38. []>;
  39. def PPCxxmfacc : SDNode<"PPCISD::XXMFACC", SDT_PPCxxmfacc, []>;
  40. //===----------------------------------------------------------------------===//
  41. // PC Relative flag (for instructions that use the address of the prefix for
  42. // address computations).
  43. class isPCRel { bit PCRel = 1; }
  44. // PowerPC specific type constraints.
  45. def SDT_PPCLXVRZX : SDTypeProfile<1, 2, [
  46. SDTCisVT<0, v1i128>, SDTCisPtrTy<1>, SDTCisPtrTy<2>
  47. ]>;
  48. // PPC Specific DAG Nodes.
  49. def PPClxvrzx : SDNode<"PPCISD::LXVRZX", SDT_PPCLXVRZX,
  50. [SDNPHasChain, SDNPMayLoad]>;
  51. // Top-level class for prefixed instructions.
  52. class PI<bits<6> pref, bits<6> opcode, dag OOL, dag IOL, string asmstr,
  53. InstrItinClass itin> : Instruction {
  54. field bits<64> Inst;
  55. field bits<64> SoftFail = 0;
  56. bit PCRel = 0; // Default value, set by isPCRel.
  57. let Size = 8;
  58. let Namespace = "PPC";
  59. let OutOperandList = OOL;
  60. let InOperandList = IOL;
  61. let AsmString = asmstr;
  62. let Itinerary = itin;
  63. let Inst{0-5} = pref;
  64. let Inst{32-37} = opcode;
  65. bits<1> PPC970_First = 0;
  66. bits<1> PPC970_Single = 0;
  67. bits<1> PPC970_Cracked = 0;
  68. bits<3> PPC970_Unit = 0;
  69. /// These fields correspond to the fields in PPCInstrInfo.h. Any changes to
  70. /// these must be reflected there! See comments there for what these are.
  71. let TSFlags{0} = PPC970_First;
  72. let TSFlags{1} = PPC970_Single;
  73. let TSFlags{2} = PPC970_Cracked;
  74. let TSFlags{5-3} = PPC970_Unit;
  75. bits<1> Prefixed = 1; // This is a prefixed instruction.
  76. let TSFlags{7} = Prefixed;
  77. // For cases where multiple instruction definitions really represent the
  78. // same underlying instruction but with one definition for 64-bit arguments
  79. // and one for 32-bit arguments, this bit breaks the degeneracy between
  80. // the two forms and allows TableGen to generate mapping tables.
  81. bit Interpretation64Bit = 0;
  82. // Fields used for relation models.
  83. string BaseName = "";
  84. }
  85. // VX-Form: [ PO VT R VB RC XO ]
  86. class VXForm_VTB5_RC<bits<10> xo, bits<5> R, dag OOL, dag IOL, string asmstr,
  87. InstrItinClass itin, list<dag> pattern>
  88. : I<4, OOL, IOL, asmstr, itin> {
  89. bits<5> VT;
  90. bits<5> VB;
  91. bit RC = 0;
  92. let Pattern = pattern;
  93. let Inst{6-10} = VT;
  94. let Inst{11-15} = R;
  95. let Inst{16-20} = VB;
  96. let Inst{21} = RC;
  97. let Inst{22-31} = xo;
  98. }
  99. // Multiclass definition to account for record and non-record form
  100. // instructions of VXRForm.
  101. multiclass VXForm_VTB5_RCr<bits<10> xo, bits<5> R, dag OOL, dag IOL,
  102. string asmbase, string asmstr,
  103. InstrItinClass itin, list<dag> pattern> {
  104. let BaseName = asmbase in {
  105. def NAME : VXForm_VTB5_RC<xo, R, OOL, IOL,
  106. !strconcat(asmbase, !strconcat(" ", asmstr)),
  107. itin, pattern>, RecFormRel;
  108. let Defs = [CR6] in
  109. def _rec : VXForm_VTB5_RC<xo, R, OOL, IOL,
  110. !strconcat(asmbase, !strconcat(". ", asmstr)),
  111. itin, []>, isRecordForm, RecFormRel;
  112. }
  113. }
  114. class MLS_DForm_R_SI34_RTA5_MEM<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  115. InstrItinClass itin, list<dag> pattern>
  116. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  117. bits<5> FRS;
  118. bits<39> D_RA;
  119. let Pattern = pattern;
  120. // The prefix.
  121. let Inst{6-7} = 2;
  122. let Inst{8-10} = 0;
  123. let Inst{11} = PCRel;
  124. let Inst{12-13} = 0;
  125. let Inst{14-31} = D_RA{33-16}; // d0
  126. // The instruction.
  127. let Inst{38-42} = FRS{4-0};
  128. let Inst{43-47} = D_RA{38-34}; // RA
  129. let Inst{48-63} = D_RA{15-0}; // d1
  130. }
  131. class MLS_DForm_R_SI34_RTA5<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  132. InstrItinClass itin, list<dag> pattern>
  133. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  134. bits<5> RT;
  135. bits<5> RA;
  136. bits<34> SI;
  137. let Pattern = pattern;
  138. // The prefix.
  139. let Inst{6-7} = 2;
  140. let Inst{8-10} = 0;
  141. let Inst{11} = PCRel;
  142. let Inst{12-13} = 0;
  143. let Inst{14-31} = SI{33-16};
  144. // The instruction.
  145. let Inst{38-42} = RT;
  146. let Inst{43-47} = RA;
  147. let Inst{48-63} = SI{15-0};
  148. }
  149. class MLS_DForm_SI34_RT5<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  150. InstrItinClass itin, list<dag> pattern>
  151. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  152. bits<5> RT;
  153. bits<34> SI;
  154. let Pattern = pattern;
  155. // The prefix.
  156. let Inst{6-7} = 2;
  157. let Inst{8-10} = 0;
  158. let Inst{11} = 0;
  159. let Inst{12-13} = 0;
  160. let Inst{14-31} = SI{33-16};
  161. // The instruction.
  162. let Inst{38-42} = RT;
  163. let Inst{43-47} = 0;
  164. let Inst{48-63} = SI{15-0};
  165. }
  166. multiclass MLS_DForm_R_SI34_RTA5_p<bits<6> opcode, dag OOL, dag IOL,
  167. dag PCRel_IOL, string asmstr,
  168. InstrItinClass itin> {
  169. def NAME : MLS_DForm_R_SI34_RTA5<opcode, OOL, IOL,
  170. !strconcat(asmstr, ", 0"), itin, []>;
  171. def pc : MLS_DForm_R_SI34_RTA5<opcode, OOL, PCRel_IOL,
  172. !strconcat(asmstr, ", 1"), itin, []>, isPCRel;
  173. }
  174. class 8LS_DForm_R_SI34_RTA5<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  175. InstrItinClass itin, list<dag> pattern>
  176. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  177. bits<5> RT;
  178. bits<39> D_RA;
  179. let Pattern = pattern;
  180. // The prefix.
  181. let Inst{6-10} = 0;
  182. let Inst{11} = PCRel;
  183. let Inst{12-13} = 0;
  184. let Inst{14-31} = D_RA{33-16}; // d0
  185. // The instruction.
  186. let Inst{38-42} = RT{4-0};
  187. let Inst{43-47} = D_RA{38-34}; // RA
  188. let Inst{48-63} = D_RA{15-0}; // d1
  189. }
  190. // 8LS:D-Form: [ 1 0 0 // R // d0
  191. // PO TX T RA d1 ]
  192. class 8LS_DForm_R_SI34_XT6_RA5<bits<5> opcode, dag OOL, dag IOL, string asmstr,
  193. InstrItinClass itin, list<dag> pattern>
  194. : PI<1, { opcode, ? }, OOL, IOL, asmstr, itin> {
  195. bits<6> XT;
  196. bits<39> D_RA;
  197. let Pattern = pattern;
  198. // The prefix.
  199. let Inst{6-7} = 0;
  200. let Inst{8} = 0;
  201. let Inst{9-10} = 0; // reserved
  202. let Inst{11} = PCRel;
  203. let Inst{12-13} = 0; // reserved
  204. let Inst{14-31} = D_RA{33-16}; // d0
  205. // The instruction.
  206. let Inst{37} = XT{5};
  207. let Inst{38-42} = XT{4-0};
  208. let Inst{43-47} = D_RA{38-34}; // RA
  209. let Inst{48-63} = D_RA{15-0}; // d1
  210. }
  211. // X-Form: [PO T IMM VRB XO TX]
  212. class XForm_XT6_IMM5_VB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  213. string asmstr, InstrItinClass itin, list<dag> pattern>
  214. : I<opcode, OOL, IOL, asmstr, itin> {
  215. bits<6> XT;
  216. bits<5> VRB;
  217. bits<5> IMM;
  218. let Pattern = pattern;
  219. let Inst{6-10} = XT{4-0};
  220. let Inst{11-15} = IMM;
  221. let Inst{16-20} = VRB;
  222. let Inst{21-30} = xo;
  223. let Inst{31} = XT{5};
  224. }
  225. class 8RR_XX4Form_IMM8_XTAB6<bits<6> opcode, bits<2> xo,
  226. dag OOL, dag IOL, string asmstr,
  227. InstrItinClass itin, list<dag> pattern>
  228. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  229. bits<6> XT;
  230. bits<6> XA;
  231. bits<6> XB;
  232. bits<6> XC;
  233. bits<8> IMM;
  234. let Pattern = pattern;
  235. // The prefix.
  236. let Inst{6-7} = 1;
  237. let Inst{8} = 0;
  238. let Inst{9-11} = 0;
  239. let Inst{12-13} = 0;
  240. let Inst{14-23} = 0;
  241. let Inst{24-31} = IMM;
  242. // The instruction.
  243. let Inst{38-42} = XT{4-0};
  244. let Inst{43-47} = XA{4-0};
  245. let Inst{48-52} = XB{4-0};
  246. let Inst{53-57} = XC{4-0};
  247. let Inst{58-59} = xo;
  248. let Inst{60} = XC{5};
  249. let Inst{61} = XA{5};
  250. let Inst{62} = XB{5};
  251. let Inst{63} = XT{5};
  252. }
  253. class VXForm_RD5_N3_VB5<bits<11> xo, dag OOL, dag IOL, string asmstr,
  254. InstrItinClass itin, list<dag> pattern>
  255. : I<4, OOL, IOL, asmstr, itin> {
  256. bits<5> RD;
  257. bits<5> VB;
  258. bits<3> N;
  259. let Pattern = pattern;
  260. let Inst{6-10} = RD;
  261. let Inst{11-12} = 0;
  262. let Inst{13-15} = N;
  263. let Inst{16-20} = VB;
  264. let Inst{21-31} = xo;
  265. }
  266. // VX-Form: [PO VRT RA VRB XO].
  267. // Destructive (insert) forms are suffixed with _ins.
  268. class VXForm_VTB5_RA5_ins<bits<11> xo, string opc, list<dag> pattern>
  269. : VXForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vDi, gprc:$rA, vrrc:$vB),
  270. !strconcat(opc, " $vD, $rA, $vB"), IIC_VecGeneral, pattern>,
  271. RegConstraint<"$vDi = $vD">, NoEncode<"$vDi">;
  272. // VX-Form: [PO VRT RA RB XO].
  273. // Destructive (insert) forms are suffixed with _ins.
  274. class VXForm_VRT5_RAB5_ins<bits<11> xo, string opc, list<dag> pattern>
  275. : VXForm_1<xo, (outs vrrc:$vD), (ins vrrc:$vDi, gprc:$rA, gprc:$rB),
  276. !strconcat(opc, " $vD, $rA, $rB"), IIC_VecGeneral, pattern>,
  277. RegConstraint<"$vDi = $vD">, NoEncode<"$vDi">;
  278. // VX-Form: [ PO BF // VRA VRB XO ]
  279. class VXForm_BF3_VAB5<bits<11> xo, dag OOL, dag IOL, string asmstr,
  280. InstrItinClass itin, list<dag> pattern>
  281. : I<4, OOL, IOL, asmstr, itin> {
  282. bits<3> BF;
  283. bits<5> VA;
  284. bits<5> VB;
  285. let Pattern = pattern;
  286. let Inst{6-8} = BF;
  287. let Inst{9-10} = 0;
  288. let Inst{11-15} = VA;
  289. let Inst{16-20} = VB;
  290. let Inst{21-31} = xo;
  291. }
  292. // VN-Form: [PO VRT VRA VRB PS SD XO]
  293. // SD is "Shift Direction"
  294. class VNForm_VTAB5_SD3<bits<6> xo, bits<2> ps, dag OOL, dag IOL, string asmstr,
  295. InstrItinClass itin, list<dag> pattern>
  296. : I<4, OOL, IOL, asmstr, itin> {
  297. bits<5> VRT;
  298. bits<5> VRA;
  299. bits<5> VRB;
  300. bits<3> SD;
  301. let Pattern = pattern;
  302. let Inst{6-10} = VRT;
  303. let Inst{11-15} = VRA;
  304. let Inst{16-20} = VRB;
  305. let Inst{21-22} = ps;
  306. let Inst{23-25} = SD;
  307. let Inst{26-31} = xo;
  308. }
  309. class VXForm_RD5_MP_VB5<bits<11> xo, bits<4> eo, dag OOL, dag IOL,
  310. string asmstr, InstrItinClass itin, list<dag> pattern>
  311. : I<4, OOL, IOL, asmstr, itin> {
  312. bits<5> RD;
  313. bits<5> VB;
  314. bit MP;
  315. let Pattern = pattern;
  316. let Inst{6-10} = RD;
  317. let Inst{11-14} = eo;
  318. let Inst{15} = MP;
  319. let Inst{16-20} = VB;
  320. let Inst{21-31} = xo;
  321. }
  322. // 8RR:D-Form: [ 1 1 0 // // imm0
  323. // PO T XO TX imm1 ].
  324. class 8RR_DForm_IMM32_XT6<bits<6> opcode, bits<4> xo, dag OOL, dag IOL,
  325. string asmstr, InstrItinClass itin,
  326. list<dag> pattern>
  327. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  328. bits<6> XT;
  329. bits<32> IMM32;
  330. let Pattern = pattern;
  331. // The prefix.
  332. let Inst{6-7} = 1;
  333. let Inst{8-11} = 0;
  334. let Inst{12-13} = 0; // reserved
  335. let Inst{14-15} = 0; // reserved
  336. let Inst{16-31} = IMM32{31-16};
  337. // The instruction.
  338. let Inst{38-42} = XT{4-0};
  339. let Inst{43-46} = xo;
  340. let Inst{47} = XT{5};
  341. let Inst{48-63} = IMM32{15-0};
  342. }
  343. // 8RR:D-Form: [ 1 1 0 // // imm0
  344. // PO T XO IX TX imm1 ].
  345. class 8RR_DForm_IMM32_XT6_IX<bits<6> opcode, bits<3> xo, dag OOL, dag IOL,
  346. string asmstr, InstrItinClass itin,
  347. list<dag> pattern>
  348. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  349. bits<6> XT;
  350. bit IX;
  351. bits<32> IMM32;
  352. let Pattern = pattern;
  353. // The prefix.
  354. let Inst{6-7} = 1;
  355. let Inst{8-11} = 0;
  356. let Inst{12-13} = 0; // reserved
  357. let Inst{14-15} = 0; // reserved
  358. let Inst{16-31} = IMM32{31-16};
  359. // The instruction.
  360. let Inst{38-42} = XT{4-0};
  361. let Inst{43-45} = xo;
  362. let Inst{46} = IX;
  363. let Inst{47} = XT{5};
  364. let Inst{48-63} = IMM32{15-0};
  365. }
  366. class 8RR_XX4Form_XTABC6<bits<6> opcode, bits<2> xo, dag OOL, dag IOL,
  367. string asmstr, InstrItinClass itin, list<dag> pattern>
  368. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  369. bits<6> XT;
  370. bits<6> XA;
  371. bits<6> XB;
  372. bits<6> XC;
  373. let Pattern = pattern;
  374. // The prefix.
  375. let Inst{6-7} = 1;
  376. let Inst{8-11} = 0;
  377. let Inst{12-13} = 0;
  378. let Inst{14-31} = 0;
  379. // The instruction.
  380. let Inst{38-42} = XT{4-0};
  381. let Inst{43-47} = XA{4-0};
  382. let Inst{48-52} = XB{4-0};
  383. let Inst{53-57} = XC{4-0};
  384. let Inst{58-59} = xo;
  385. let Inst{60} = XC{5};
  386. let Inst{61} = XA{5};
  387. let Inst{62} = XB{5};
  388. let Inst{63} = XT{5};
  389. }
  390. class 8RR_XX4Form_IMM3_XTABC6<bits<6> opcode, bits<2> xo, dag OOL, dag IOL,
  391. string asmstr, InstrItinClass itin,
  392. list<dag> pattern>
  393. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  394. bits<6> XT;
  395. bits<6> XA;
  396. bits<6> XB;
  397. bits<6> XC;
  398. bits<3> IMM;
  399. let Pattern = pattern;
  400. // The prefix.
  401. let Inst{6-7} = 1;
  402. let Inst{8-11} = 0;
  403. let Inst{12-13} = 0;
  404. let Inst{14-28} = 0;
  405. let Inst{29-31} = IMM;
  406. // The instruction.
  407. let Inst{38-42} = XT{4-0};
  408. let Inst{43-47} = XA{4-0};
  409. let Inst{48-52} = XB{4-0};
  410. let Inst{53-57} = XC{4-0};
  411. let Inst{58-59} = xo;
  412. let Inst{60} = XC{5};
  413. let Inst{61} = XA{5};
  414. let Inst{62} = XB{5};
  415. let Inst{63} = XT{5};
  416. }
  417. // [PO BF / XO2 B XO BX /]
  418. class XX2_BF3_XO5_XB6_XO9<bits<6> opcode, bits<5> xo2, bits<9> xo, dag OOL,
  419. dag IOL, string asmstr, InstrItinClass itin,
  420. list<dag> pattern>
  421. : I<opcode, OOL, IOL, asmstr, itin> {
  422. bits<3> BF;
  423. bits<6> XB;
  424. let Pattern = pattern;
  425. let Inst{6-8} = BF;
  426. let Inst{9-10} = 0;
  427. let Inst{11-15} = xo2;
  428. let Inst{16-20} = XB{4-0};
  429. let Inst{21-29} = xo;
  430. let Inst{30} = XB{5};
  431. let Inst{31} = 0;
  432. }
  433. // X-Form: [ PO RT BI /// XO / ]
  434. class XForm_XT5_BI5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  435. string asmstr, InstrItinClass itin, list<dag> pattern>
  436. : XForm_base_r3xo<opcode, xo, OOL, IOL, asmstr, itin, pattern> {
  437. let B = 0;
  438. }
  439. multiclass MLS_DForm_R_SI34_RTA5_MEM_p<bits<6> opcode, dag OOL, dag IOL,
  440. dag PCRel_IOL, string asmstr,
  441. InstrItinClass itin> {
  442. def NAME : MLS_DForm_R_SI34_RTA5_MEM<opcode, OOL, IOL,
  443. !strconcat(asmstr, ", 0"), itin, []>;
  444. def pc : MLS_DForm_R_SI34_RTA5_MEM<opcode, OOL, PCRel_IOL,
  445. !strconcat(asmstr, ", 1"), itin, []>,
  446. isPCRel;
  447. }
  448. multiclass 8LS_DForm_R_SI34_RTA5_p<bits<6> opcode, dag OOL, dag IOL,
  449. dag PCRel_IOL, string asmstr,
  450. InstrItinClass itin> {
  451. def NAME : 8LS_DForm_R_SI34_RTA5<opcode, OOL, IOL,
  452. !strconcat(asmstr, ", 0"), itin, []>;
  453. def pc : 8LS_DForm_R_SI34_RTA5<opcode, OOL, PCRel_IOL,
  454. !strconcat(asmstr, ", 1"), itin, []>, isPCRel;
  455. }
  456. multiclass 8LS_DForm_R_SI34_XT6_RA5_p<bits<5> opcode, dag OOL, dag IOL,
  457. dag PCRel_IOL, string asmstr,
  458. InstrItinClass itin> {
  459. def NAME : 8LS_DForm_R_SI34_XT6_RA5<opcode, OOL, IOL,
  460. !strconcat(asmstr, ", 0"), itin, []>;
  461. def pc : 8LS_DForm_R_SI34_XT6_RA5<opcode, OOL, PCRel_IOL,
  462. !strconcat(asmstr, ", 1"), itin, []>,
  463. isPCRel;
  464. }
  465. def PPCRegVSRpRCAsmOperand : AsmOperandClass {
  466. let Name = "RegVSRpRC"; let PredicateMethod = "isVSRpEvenRegNumber";
  467. }
  468. def vsrprc : RegisterOperand<VSRpRC> {
  469. let ParserMatchClass = PPCRegVSRpRCAsmOperand;
  470. }
  471. def PPCRegVSRpEvenRCAsmOperand : AsmOperandClass {
  472. let Name = "RegVSRpEvenRC"; let PredicateMethod = "isVSRpEvenRegNumber";
  473. }
  474. def vsrpevenrc : RegisterOperand<VSRpRC> {
  475. let ParserMatchClass = PPCRegVSRpEvenRCAsmOperand;
  476. let EncoderMethod = "getVSRpEvenEncoding";
  477. let DecoderMethod = "decodeVSRpEvenOperands";
  478. }
  479. class DQForm_XTp5_RA17_MEM<bits<6> opcode, bits<4> xo, dag OOL, dag IOL,
  480. string asmstr, InstrItinClass itin, list<dag> pattern>
  481. : I<opcode, OOL, IOL, asmstr, itin> {
  482. bits<5> XTp;
  483. bits<17> DQ_RA;
  484. let Pattern = pattern;
  485. let Inst{6-9} = XTp{3-0};
  486. let Inst{10} = XTp{4};
  487. let Inst{11-15} = DQ_RA{16-12}; // Register #
  488. let Inst{16-27} = DQ_RA{11-0}; // Displacement.
  489. let Inst{28-31} = xo;
  490. }
  491. class XForm_XTp5_XAB5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
  492. string asmstr, InstrItinClass itin, list<dag> pattern>
  493. : I<opcode, OOL, IOL, asmstr, itin>, XFormMemOp {
  494. bits<5> XTp;
  495. bits<5> A;
  496. bits<5> B;
  497. let Pattern = pattern;
  498. let Inst{6-9} = XTp{3-0};
  499. let Inst{10} = XTp{4};
  500. let Inst{11-15} = A;
  501. let Inst{16-20} = B;
  502. let Inst{21-30} = xo;
  503. let Inst{31} = 0;
  504. }
  505. class 8LS_DForm_R_XTp5_SI34_MEM<bits<6> opcode, dag OOL, dag IOL, string asmstr,
  506. InstrItinClass itin, list<dag> pattern>
  507. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  508. bits<5> XTp;
  509. bits<39> D_RA;
  510. let Pattern = pattern;
  511. // The prefix.
  512. let Inst{6-10} = 0;
  513. let Inst{11} = PCRel;
  514. let Inst{12-13} = 0;
  515. let Inst{14-31} = D_RA{33-16}; // Imm18
  516. // The instruction.
  517. let Inst{38-41} = XTp{3-0};
  518. let Inst{42} = XTp{4};
  519. let Inst{43-47} = D_RA{38-34}; // Register #
  520. let Inst{48-63} = D_RA{15-0}; // D
  521. }
  522. multiclass 8LS_DForm_R_XTp5_SI34_MEM_p<bits<6> opcode, dag OOL,
  523. dag IOL, dag PCRel_IOL,
  524. string asmstr, InstrItinClass itin> {
  525. def NAME : 8LS_DForm_R_XTp5_SI34_MEM<opcode, OOL, IOL,
  526. !strconcat(asmstr, ", 0"), itin, []>;
  527. def pc : 8LS_DForm_R_XTp5_SI34_MEM<opcode, OOL, PCRel_IOL,
  528. !strconcat(asmstr, ", 1"), itin, []>,
  529. isPCRel;
  530. }
  531. def PPCRegACCRCAsmOperand : AsmOperandClass {
  532. let Name = "RegACCRC"; let PredicateMethod = "isACCRegNumber";
  533. }
  534. def acc : RegisterOperand<ACCRC> {
  535. let ParserMatchClass = PPCRegACCRCAsmOperand;
  536. }
  537. def uacc : RegisterOperand<UACCRC> {
  538. let ParserMatchClass = PPCRegACCRCAsmOperand;
  539. }
  540. // [PO AS XO2 XO]
  541. class XForm_AT3<bits<6> opcode, bits<5> xo2, bits<10> xo, dag OOL, dag IOL,
  542. string asmstr, InstrItinClass itin, list<dag> pattern>
  543. : I<opcode, OOL, IOL, asmstr, itin> {
  544. bits<3> AT;
  545. let Pattern = pattern;
  546. let Inst{6-8} = AT;
  547. let Inst{9-10} = 0;
  548. let Inst{11-15} = xo2;
  549. let Inst{16-20} = 0;
  550. let Inst{21-30} = xo;
  551. let Inst{31} = 0;
  552. }
  553. class XX3Form_AT3_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
  554. string asmstr, InstrItinClass itin,
  555. list<dag> pattern>
  556. : I<opcode, OOL, IOL, asmstr, itin> {
  557. bits<3> AT;
  558. bits<6> XA;
  559. bits<6> XB;
  560. let Pattern = pattern;
  561. let Inst{6-8} = AT;
  562. let Inst{9-10} = 0;
  563. let Inst{11-15} = XA{4-0};
  564. let Inst{16-20} = XB{4-0};
  565. let Inst{21-28} = xo;
  566. let Inst{29} = XA{5};
  567. let Inst{30} = XB{5};
  568. let Inst{31} = 0;
  569. }
  570. class MMIRR_XX3Form_XY4P2_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
  571. string asmstr, InstrItinClass itin,
  572. list<dag> pattern>
  573. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  574. bits<3> AT;
  575. bits<6> XA;
  576. bits<6> XB;
  577. bits<4> XMSK;
  578. bits<4> YMSK;
  579. bits<2> PMSK;
  580. let Pattern = pattern;
  581. // The prefix.
  582. let Inst{6-7} = 3;
  583. let Inst{8-11} = 9;
  584. let Inst{12-15} = 0;
  585. let Inst{16-17} = PMSK;
  586. let Inst{18-23} = 0;
  587. let Inst{24-27} = XMSK;
  588. let Inst{28-31} = YMSK;
  589. // The instruction.
  590. let Inst{38-40} = AT;
  591. let Inst{41-42} = 0;
  592. let Inst{43-47} = XA{4-0};
  593. let Inst{48-52} = XB{4-0};
  594. let Inst{53-60} = xo;
  595. let Inst{61} = XA{5};
  596. let Inst{62} = XB{5};
  597. let Inst{63} = 0;
  598. }
  599. class MMIRR_XX3Form_XY4_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
  600. string asmstr, InstrItinClass itin,
  601. list<dag> pattern>
  602. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  603. bits<3> AT;
  604. bits<6> XA;
  605. bits<6> XB;
  606. bits<4> XMSK;
  607. bits<4> YMSK;
  608. let Pattern = pattern;
  609. // The prefix.
  610. let Inst{6-7} = 3;
  611. let Inst{8-11} = 9;
  612. let Inst{12-23} = 0;
  613. let Inst{24-27} = XMSK;
  614. let Inst{28-31} = YMSK;
  615. // The instruction.
  616. let Inst{38-40} = AT;
  617. let Inst{41-42} = 0;
  618. let Inst{43-47} = XA{4-0};
  619. let Inst{48-52} = XB{4-0};
  620. let Inst{53-60} = xo;
  621. let Inst{61} = XA{5};
  622. let Inst{62} = XB{5};
  623. let Inst{63} = 0;
  624. }
  625. class MMIRR_XX3Form_X4Y2_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
  626. string asmstr, InstrItinClass itin,
  627. list<dag> pattern>
  628. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  629. bits<3> AT;
  630. bits<6> XA;
  631. bits<6> XB;
  632. bits<4> XMSK;
  633. bits<2> YMSK;
  634. let Pattern = pattern;
  635. // The prefix.
  636. let Inst{6-7} = 3;
  637. let Inst{8-11} = 9;
  638. let Inst{12-23} = 0;
  639. let Inst{24-27} = XMSK;
  640. let Inst{28-29} = YMSK;
  641. let Inst{30-31} = 0;
  642. // The instruction.
  643. let Inst{38-40} = AT;
  644. let Inst{41-42} = 0;
  645. let Inst{43-47} = XA{4-0};
  646. let Inst{48-52} = XB{4-0};
  647. let Inst{53-60} = xo;
  648. let Inst{61} = XA{5};
  649. let Inst{62} = XB{5};
  650. let Inst{63} = 0;
  651. }
  652. class MMIRR_XX3Form_XY4P8_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
  653. string asmstr, InstrItinClass itin,
  654. list<dag> pattern>
  655. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  656. bits<3> AT;
  657. bits<6> XA;
  658. bits<6> XB;
  659. bits<4> XMSK;
  660. bits<4> YMSK;
  661. bits<8> PMSK;
  662. let Pattern = pattern;
  663. // The prefix.
  664. let Inst{6-7} = 3;
  665. let Inst{8-11} = 9;
  666. let Inst{12-15} = 0;
  667. let Inst{16-23} = PMSK;
  668. let Inst{24-27} = XMSK;
  669. let Inst{28-31} = YMSK;
  670. // The instruction.
  671. let Inst{38-40} = AT;
  672. let Inst{41-42} = 0;
  673. let Inst{43-47} = XA{4-0};
  674. let Inst{48-52} = XB{4-0};
  675. let Inst{53-60} = xo;
  676. let Inst{61} = XA{5};
  677. let Inst{62} = XB{5};
  678. let Inst{63} = 0;
  679. }
  680. class MMIRR_XX3Form_XYP4_XAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL,
  681. string asmstr, InstrItinClass itin,
  682. list<dag> pattern>
  683. : PI<1, opcode, OOL, IOL, asmstr, itin> {
  684. bits<3> AT;
  685. bits<6> XA;
  686. bits<6> XB;
  687. bits<4> XMSK;
  688. bits<4> YMSK;
  689. bits<4> PMSK;
  690. let Pattern = pattern;
  691. // The prefix.
  692. let Inst{6-7} = 3;
  693. let Inst{8-11} = 9;
  694. let Inst{12-15} = 0;
  695. let Inst{16-19} = PMSK;
  696. let Inst{20-23} = 0;
  697. let Inst{24-27} = XMSK;
  698. let Inst{28-31} = YMSK;
  699. // The instruction.
  700. let Inst{38-40} = AT;
  701. let Inst{41-42} = 0;
  702. let Inst{43-47} = XA{4-0};
  703. let Inst{48-52} = XB{4-0};
  704. let Inst{53-60} = xo;
  705. let Inst{61} = XA{5};
  706. let Inst{62} = XB{5};
  707. let Inst{63} = 0;
  708. }
  709. def PrefixInstrs : Predicate<"Subtarget->hasPrefixInstrs()">;
  710. def IsISA3_1 : Predicate<"Subtarget->isISA3_1()">;
  711. def PairedVectorMemops : Predicate<"Subtarget->pairedVectorMemops()">;
  712. def MMA : Predicate<"Subtarget->hasMMA()">;
  713. def RCCp {
  714. dag AToVSRC = (COPY_TO_REGCLASS $XA, VSRC);
  715. dag BToVSRC = (COPY_TO_REGCLASS $XB, VSRC);
  716. }
  717. let Predicates = [PrefixInstrs] in {
  718. let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
  719. defm PADDI8 :
  720. MLS_DForm_R_SI34_RTA5_p<14, (outs g8rc:$RT), (ins g8rc:$RA, s34imm:$SI),
  721. (ins immZero:$RA, s34imm_pcrel:$SI),
  722. "paddi $RT, $RA, $SI", IIC_LdStLFD>;
  723. let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in {
  724. def PLI8 : MLS_DForm_SI34_RT5<14, (outs g8rc:$RT),
  725. (ins s34imm:$SI),
  726. "pli $RT, $SI", IIC_IntSimple, []>;
  727. }
  728. }
  729. defm PADDI :
  730. MLS_DForm_R_SI34_RTA5_p<14, (outs gprc:$RT), (ins gprc:$RA, s34imm:$SI),
  731. (ins immZero:$RA, s34imm_pcrel:$SI),
  732. "paddi $RT, $RA, $SI", IIC_LdStLFD>;
  733. let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in {
  734. def PLI : MLS_DForm_SI34_RT5<14, (outs gprc:$RT),
  735. (ins s34imm:$SI),
  736. "pli $RT, $SI", IIC_IntSimple, []>;
  737. }
  738. let mayLoad = 1, mayStore = 0 in {
  739. defm PLXV :
  740. 8LS_DForm_R_SI34_XT6_RA5_p<25, (outs vsrc:$XT), (ins memri34:$D_RA),
  741. (ins memri34_pcrel:$D_RA), "plxv $XT, $D_RA",
  742. IIC_LdStLFD>;
  743. defm PLFS :
  744. MLS_DForm_R_SI34_RTA5_MEM_p<48, (outs f4rc:$FRT), (ins memri34:$D_RA),
  745. (ins memri34_pcrel:$D_RA), "plfs $FRT, $D_RA",
  746. IIC_LdStLFD>;
  747. defm PLFD :
  748. MLS_DForm_R_SI34_RTA5_MEM_p<50, (outs f8rc:$FRT), (ins memri34:$D_RA),
  749. (ins memri34_pcrel:$D_RA), "plfd $FRT, $D_RA",
  750. IIC_LdStLFD>;
  751. defm PLXSSP :
  752. 8LS_DForm_R_SI34_RTA5_p<43, (outs vfrc:$VRT), (ins memri34:$D_RA),
  753. (ins memri34_pcrel:$D_RA), "plxssp $VRT, $D_RA",
  754. IIC_LdStLFD>;
  755. defm PLXSD :
  756. 8LS_DForm_R_SI34_RTA5_p<42, (outs vfrc:$VRT), (ins memri34:$D_RA),
  757. (ins memri34_pcrel:$D_RA), "plxsd $VRT, $D_RA",
  758. IIC_LdStLFD>;
  759. let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
  760. defm PLBZ8 :
  761. MLS_DForm_R_SI34_RTA5_MEM_p<34, (outs g8rc:$RT), (ins memri34:$D_RA),
  762. (ins memri34_pcrel:$D_RA), "plbz $RT, $D_RA",
  763. IIC_LdStLFD>;
  764. defm PLHZ8 :
  765. MLS_DForm_R_SI34_RTA5_MEM_p<40, (outs g8rc:$RT), (ins memri34:$D_RA),
  766. (ins memri34_pcrel:$D_RA), "plhz $RT, $D_RA",
  767. IIC_LdStLFD>;
  768. defm PLHA8 :
  769. MLS_DForm_R_SI34_RTA5_MEM_p<42, (outs g8rc:$RT), (ins memri34:$D_RA),
  770. (ins memri34_pcrel:$D_RA), "plha $RT, $D_RA",
  771. IIC_LdStLFD>;
  772. defm PLWA8 :
  773. 8LS_DForm_R_SI34_RTA5_p<41, (outs g8rc:$RT), (ins memri34:$D_RA),
  774. (ins memri34_pcrel:$D_RA), "plwa $RT, $D_RA",
  775. IIC_LdStLFD>;
  776. defm PLWZ8 :
  777. MLS_DForm_R_SI34_RTA5_MEM_p<32, (outs g8rc:$RT), (ins memri34:$D_RA),
  778. (ins memri34_pcrel:$D_RA), "plwz $RT, $D_RA",
  779. IIC_LdStLFD>;
  780. }
  781. defm PLBZ :
  782. MLS_DForm_R_SI34_RTA5_MEM_p<34, (outs gprc:$RT), (ins memri34:$D_RA),
  783. (ins memri34_pcrel:$D_RA), "plbz $RT, $D_RA",
  784. IIC_LdStLFD>;
  785. defm PLHZ :
  786. MLS_DForm_R_SI34_RTA5_MEM_p<40, (outs gprc:$RT), (ins memri34:$D_RA),
  787. (ins memri34_pcrel:$D_RA), "plhz $RT, $D_RA",
  788. IIC_LdStLFD>;
  789. defm PLHA :
  790. MLS_DForm_R_SI34_RTA5_MEM_p<42, (outs gprc:$RT), (ins memri34:$D_RA),
  791. (ins memri34_pcrel:$D_RA), "plha $RT, $D_RA",
  792. IIC_LdStLFD>;
  793. defm PLWZ :
  794. MLS_DForm_R_SI34_RTA5_MEM_p<32, (outs gprc:$RT), (ins memri34:$D_RA),
  795. (ins memri34_pcrel:$D_RA), "plwz $RT, $D_RA",
  796. IIC_LdStLFD>;
  797. defm PLWA :
  798. 8LS_DForm_R_SI34_RTA5_p<41, (outs gprc:$RT), (ins memri34:$D_RA),
  799. (ins memri34_pcrel:$D_RA), "plwa $RT, $D_RA",
  800. IIC_LdStLFD>;
  801. defm PLD :
  802. 8LS_DForm_R_SI34_RTA5_p<57, (outs g8rc:$RT), (ins memri34:$D_RA),
  803. (ins memri34_pcrel:$D_RA), "pld $RT, $D_RA",
  804. IIC_LdStLFD>;
  805. }
  806. let mayStore = 1, mayLoad = 0 in {
  807. defm PSTXV :
  808. 8LS_DForm_R_SI34_XT6_RA5_p<27, (outs), (ins vsrc:$XS, memri34:$D_RA),
  809. (ins vsrc:$XS, memri34_pcrel:$D_RA),
  810. "pstxv $XS, $D_RA", IIC_LdStLFD>;
  811. defm PSTFS :
  812. MLS_DForm_R_SI34_RTA5_MEM_p<52, (outs), (ins f4rc:$FRS, memri34:$D_RA),
  813. (ins f4rc:$FRS, memri34_pcrel:$D_RA),
  814. "pstfs $FRS, $D_RA", IIC_LdStLFD>;
  815. defm PSTFD :
  816. MLS_DForm_R_SI34_RTA5_MEM_p<54, (outs), (ins f8rc:$FRS, memri34:$D_RA),
  817. (ins f8rc:$FRS, memri34_pcrel:$D_RA),
  818. "pstfd $FRS, $D_RA", IIC_LdStLFD>;
  819. defm PSTXSSP :
  820. 8LS_DForm_R_SI34_RTA5_p<47, (outs), (ins vfrc:$VRS, memri34:$D_RA),
  821. (ins vfrc:$VRS, memri34_pcrel:$D_RA),
  822. "pstxssp $VRS, $D_RA", IIC_LdStLFD>;
  823. defm PSTXSD :
  824. 8LS_DForm_R_SI34_RTA5_p<46, (outs), (ins vfrc:$VRS, memri34:$D_RA),
  825. (ins vfrc:$VRS, memri34_pcrel:$D_RA),
  826. "pstxsd $VRS, $D_RA", IIC_LdStLFD>;
  827. let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
  828. defm PSTB8 :
  829. MLS_DForm_R_SI34_RTA5_MEM_p<38, (outs), (ins g8rc:$RS, memri34:$D_RA),
  830. (ins g8rc:$RS, memri34_pcrel:$D_RA),
  831. "pstb $RS, $D_RA", IIC_LdStLFD>;
  832. defm PSTH8 :
  833. MLS_DForm_R_SI34_RTA5_MEM_p<44, (outs), (ins g8rc:$RS, memri34:$D_RA),
  834. (ins g8rc:$RS, memri34_pcrel:$D_RA),
  835. "psth $RS, $D_RA", IIC_LdStLFD>;
  836. defm PSTW8 :
  837. MLS_DForm_R_SI34_RTA5_MEM_p<36, (outs), (ins g8rc:$RS, memri34:$D_RA),
  838. (ins g8rc:$RS, memri34_pcrel:$D_RA),
  839. "pstw $RS, $D_RA", IIC_LdStLFD>;
  840. }
  841. defm PSTB :
  842. MLS_DForm_R_SI34_RTA5_MEM_p<38, (outs), (ins gprc:$RS, memri34:$D_RA),
  843. (ins gprc:$RS, memri34_pcrel:$D_RA),
  844. "pstb $RS, $D_RA", IIC_LdStLFD>;
  845. defm PSTH :
  846. MLS_DForm_R_SI34_RTA5_MEM_p<44, (outs), (ins gprc:$RS, memri34:$D_RA),
  847. (ins gprc:$RS, memri34_pcrel:$D_RA),
  848. "psth $RS, $D_RA", IIC_LdStLFD>;
  849. defm PSTW :
  850. MLS_DForm_R_SI34_RTA5_MEM_p<36, (outs), (ins gprc:$RS, memri34:$D_RA),
  851. (ins gprc:$RS, memri34_pcrel:$D_RA),
  852. "pstw $RS, $D_RA", IIC_LdStLFD>;
  853. defm PSTD :
  854. 8LS_DForm_R_SI34_RTA5_p<61, (outs), (ins g8rc:$RS, memri34:$D_RA),
  855. (ins g8rc:$RS, memri34_pcrel:$D_RA),
  856. "pstd $RS, $D_RA", IIC_LdStLFD>;
  857. }
  858. }
  859. // Multiclass definitions for MMA accumulator instructions.
  860. // ----------------------------------------------------------------------------
  861. // Defines 2 unmasked instructions where the xo field for acc/non-acc version
  862. // is even/odd.
  863. multiclass ACC_UM_XOEO<bits<6> opcode, bits<8> xo, dag IOL, string asmbase,
  864. string asmstr> {
  865. let Predicates = [MMA] in {
  866. def NAME :
  867. XX3Form_AT3_XAB6<opcode, !or(xo, 0x01), (outs acc:$AT), IOL,
  868. !strconcat(asmbase#" ", asmstr), IIC_VecFP, []>,
  869. RegConstraint<"@earlyclobber $AT">;
  870. def PP :
  871. XX3Form_AT3_XAB6<opcode, xo, (outs acc:$AT), !con((ins acc:$ATi), IOL),
  872. !strconcat(asmbase#"pp ", asmstr), IIC_VecFP, []>,
  873. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  874. }
  875. }
  876. // Defines 4 instructions, masked/unmasked with masks 8, 4, 4 bits.
  877. // The XO field for acc/non-acc version is even/odd.
  878. multiclass ACC_UM_M844_XOEO<bits<6> opcode, bits<8> xo, dag IOL, string asmbase,
  879. string asmstr> {
  880. defm NAME : ACC_UM_XOEO<opcode, xo, IOL, asmbase, asmstr>;
  881. let Predicates = [MMA, PrefixInstrs] in {
  882. def PM#NAME :
  883. MMIRR_XX3Form_XY4P8_XAB6<
  884. opcode, !or(xo, 0x01), (outs acc:$AT),
  885. !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u8imm:$PMSK)),
  886. !strconcat("pm"#asmbase#" ", asmstr#", $XMSK, $YMSK, $PMSK"),
  887. IIC_VecFP, []>,
  888. RegConstraint<"@earlyclobber $AT">;
  889. def PM#NAME#PP :
  890. MMIRR_XX3Form_XY4P8_XAB6<
  891. opcode, xo, (outs acc:$AT),
  892. !con((ins acc:$ATi),
  893. !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u8imm:$PMSK))),
  894. !strconcat("pm"#asmbase#"pp ", asmstr#", $XMSK, $YMSK, $PMSK"),
  895. IIC_VecFP, []>,
  896. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  897. }
  898. }
  899. // Defines 4 instructions, masked/unmasked with masks 4, 4, 4 bits.
  900. // The XO field for acc/non-acc version is even/odd.
  901. multiclass ACC_UM_M444_XOEO<bits<6> opcode, bits<8> xo, dag IOL, string asmbase,
  902. string asmstr> {
  903. defm NAME : ACC_UM_XOEO<opcode, xo, IOL, asmbase, asmstr>;
  904. let Predicates = [MMA, PrefixInstrs] in {
  905. def PM#NAME :
  906. MMIRR_XX3Form_XYP4_XAB6<
  907. opcode, !or(xo, 0x01), (outs acc:$AT),
  908. !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u4imm:$PMSK)),
  909. !strconcat("pm"#asmbase#" ", asmstr#", $XMSK, $YMSK, $PMSK"),
  910. IIC_VecFP, []>,
  911. RegConstraint<"@earlyclobber $AT">;
  912. def PM#NAME#PP :
  913. MMIRR_XX3Form_XYP4_XAB6<
  914. opcode, xo, (outs acc:$AT),
  915. !con((ins acc:$ATi),
  916. !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u4imm:$PMSK))),
  917. !strconcat("pm"#asmbase#"pp ", asmstr#", $XMSK, $YMSK, $PMSK"),
  918. IIC_VecFP, []>,
  919. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  920. }
  921. }
  922. // Defines 4 instructions, masked/unmasked with masks 2, 4, 4 bits.
  923. // The XO field for acc/non-acc version is even/odd.
  924. multiclass ACC_UM_M244_XOEO<bits<6> opcode, bits<8> xo, dag IOL, string asmbase,
  925. string asmstr> {
  926. defm NAME : ACC_UM_XOEO<opcode, xo, IOL, asmbase, asmstr>;
  927. let Predicates = [MMA, PrefixInstrs] in {
  928. def PM#NAME :
  929. MMIRR_XX3Form_XY4P2_XAB6<
  930. opcode, !or(xo, 0x01), (outs acc:$AT),
  931. !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u2imm:$PMSK)),
  932. !strconcat("pm"#asmbase#" ", asmstr#", $XMSK, $YMSK, $PMSK"),
  933. IIC_VecFP, []>,
  934. RegConstraint<"@earlyclobber $AT">;
  935. def PM#NAME#PP :
  936. MMIRR_XX3Form_XY4P2_XAB6<
  937. opcode, xo, (outs acc:$AT),
  938. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u2imm:$PMSK))),
  939. !strconcat("pm"#asmbase#"pp ", asmstr#", $XMSK, $YMSK, $PMSK"),
  940. IIC_VecFP, []>,
  941. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  942. }
  943. }
  944. // Defines 4 instructions, masked/unmasked with masks 2, 4, 4 bits.
  945. // Upper nibble of XO field for acc/non-acc version is 0x4/0x6.
  946. multiclass ACC_UM_M244_XO46<bits<6> opcode, bits<8> xo, dag IOL, string asmbase,
  947. string asmstr> {
  948. let Predicates = [MMA] in {
  949. def NAME :
  950. XX3Form_AT3_XAB6<opcode, xo, (outs acc:$AT), IOL,
  951. !strconcat(asmbase#" ", asmstr), IIC_VecFP, []>,
  952. RegConstraint<"@earlyclobber $AT">;
  953. def PP :
  954. XX3Form_AT3_XAB6<
  955. opcode, !or(xo, 0x20), (outs acc:$AT), !con((ins acc:$ATi), IOL),
  956. !strconcat(asmbase#"pp ", asmstr), IIC_VecFP, []>,
  957. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  958. }
  959. let Predicates = [MMA, PrefixInstrs] in {
  960. def PM#NAME :
  961. MMIRR_XX3Form_XY4P2_XAB6<
  962. opcode, xo, (outs acc:$AT),
  963. !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u2imm:$PMSK)),
  964. !strconcat("pm"#asmbase#" ", asmstr#", $XMSK, $YMSK, $PMSK"),
  965. IIC_VecFP, []>,
  966. RegConstraint<"@earlyclobber $AT">;
  967. def PM#NAME#PP :
  968. MMIRR_XX3Form_XY4P2_XAB6<
  969. opcode, !or(xo, 0x20), (outs acc:$AT),
  970. !con((ins acc:$ATi),
  971. !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u2imm:$PMSK))),
  972. !strconcat("pm"#asmbase#"pp ", asmstr#", $XMSK, $YMSK, $PMSK"),
  973. IIC_VecFP, []>,
  974. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  975. }
  976. }
  977. // Defines 10 instructions, operand negating, unmasked, masked with 2, 4, 4
  978. // bits. Upper nibble are masked with 0x8, 0x4, 0xC for negating operands.
  979. multiclass ACC_NEG_UM_M244_XOM84C<bits<6> opcode, bits<8> xo, dag IOL,
  980. string asmbase, string asmstr> {
  981. defm NAME : ACC_UM_M244_XOEO<opcode, xo, IOL, asmbase, asmstr>;
  982. let Predicates = [MMA] in {
  983. def PN : XX3Form_AT3_XAB6<
  984. opcode, !or(xo, 0x80), (outs acc:$AT), !con((ins acc:$ATi), IOL),
  985. !strconcat(asmbase#"pn ", asmstr), IIC_VecFP, []>,
  986. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  987. def NP : XX3Form_AT3_XAB6<
  988. opcode, !or(xo, 0x40), (outs acc:$AT), !con((ins acc:$ATi), IOL),
  989. !strconcat(asmbase#"np ", asmstr), IIC_VecFP, []>,
  990. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  991. def NN : XX3Form_AT3_XAB6<
  992. opcode, !or(xo, 0xC0), (outs acc:$AT), !con((ins acc:$ATi), IOL),
  993. !strconcat(asmbase#"nn ", asmstr), IIC_VecFP, []>,
  994. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  995. }
  996. let Predicates = [MMA, PrefixInstrs] in {
  997. def PM#NAME#PN :
  998. MMIRR_XX3Form_XY4P2_XAB6<
  999. opcode, !or(xo, 0x80), (outs acc:$AT),
  1000. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u2imm:$PMSK))),
  1001. !strconcat("pm"#asmbase#"pn ", asmstr#", $XMSK, $YMSK, $PMSK"),
  1002. IIC_VecFP, []>,
  1003. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1004. def PM#NAME#NP :
  1005. MMIRR_XX3Form_XY4P2_XAB6<
  1006. opcode, !or(xo, 0x40), (outs acc:$AT),
  1007. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u2imm:$PMSK))),
  1008. !strconcat("pm"#asmbase#"np ", asmstr#", $XMSK, $YMSK, $PMSK"),
  1009. IIC_VecFP, []>,
  1010. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1011. def PM#NAME#NN :
  1012. MMIRR_XX3Form_XY4P2_XAB6<
  1013. opcode, !or(xo, 0xC0), (outs acc:$AT),
  1014. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK, u2imm:$PMSK))),
  1015. !strconcat("pm"#asmbase#"nn ", asmstr#", $XMSK, $YMSK, $PMSK"),
  1016. IIC_VecFP, []>,
  1017. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1018. }
  1019. }
  1020. // Defines 5 instructions, unmasked, operand negating.
  1021. // Upper nibble are masked with 0x8, 0x4, 0xC for negating operands.
  1022. multiclass ACC_NEG_UM_XOM84C<bits<6> opcode, bits<8> xo, dag IOL,
  1023. string asmbase, string asmstr> {
  1024. defm NAME : ACC_UM_XOEO<opcode, xo, IOL, asmbase, asmstr>;
  1025. let Predicates = [MMA] in {
  1026. def PN : XX3Form_AT3_XAB6<opcode, !or(xo, 0x80), (outs acc:$AT),
  1027. !con((ins acc:$ATi), IOL),
  1028. !strconcat(asmbase#"pn ", asmstr), IIC_VecFP, []>,
  1029. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1030. def NP : XX3Form_AT3_XAB6<opcode, !or(xo, 0x40), (outs acc:$AT),
  1031. !con((ins acc:$ATi), IOL),
  1032. !strconcat(asmbase#"np ", asmstr), IIC_VecFP, []>,
  1033. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1034. def NN : XX3Form_AT3_XAB6<opcode, !or(xo, 0xC0), (outs acc:$AT),
  1035. !con((ins acc:$ATi), IOL),
  1036. !strconcat(asmbase#"nn ", asmstr), IIC_VecFP, []>,
  1037. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1038. }
  1039. }
  1040. // Defines 10 instructions, operand negating, unmasked, masked with 4, 4 bits.
  1041. // Upper nibble are masked with 0x8, 0x4, 0xC for negating operands.
  1042. multiclass ACC_NEG_UM_M44_XOM84C<bits<6> opcode, bits<8> xo, dag IOL,
  1043. string asmbase, string asmstr> {
  1044. defm NAME : ACC_NEG_UM_XOM84C<opcode, xo, IOL, asmbase, asmstr>;
  1045. let Predicates = [MMA, PrefixInstrs] in {
  1046. def PM#NAME :
  1047. MMIRR_XX3Form_XY4_XAB6<
  1048. opcode, !or(xo, 0x01), (outs acc:$AT),
  1049. !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK)),
  1050. !strconcat("pm"#asmbase#" ", asmstr#", $XMSK, $YMSK"),
  1051. IIC_VecFP, []>,
  1052. RegConstraint<"@earlyclobber $AT">;
  1053. def PM#NAME#PP :
  1054. MMIRR_XX3Form_XY4_XAB6<
  1055. opcode, xo, (outs acc:$AT),
  1056. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK))),
  1057. !strconcat("pm"#asmbase#"pp ", asmstr#", $XMSK, $YMSK"),
  1058. IIC_VecFP, []>,
  1059. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1060. def PM#NAME#PN :
  1061. MMIRR_XX3Form_XY4_XAB6<
  1062. opcode, !or(xo, 0x80), (outs acc:$AT),
  1063. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK))),
  1064. !strconcat("pm"#asmbase#"pn ", asmstr#", $XMSK, $YMSK"),
  1065. IIC_VecFP, []>,
  1066. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1067. def PM#NAME#NP :
  1068. MMIRR_XX3Form_XY4_XAB6<
  1069. opcode, !or(xo, 0x40), (outs acc:$AT),
  1070. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK))),
  1071. !strconcat("pm"#asmbase#"np ", asmstr#", $XMSK, $YMSK"),
  1072. IIC_VecFP, []>,
  1073. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1074. def PM#NAME#NN :
  1075. MMIRR_XX3Form_XY4_XAB6<
  1076. opcode, !or(xo, 0xC0), (outs acc:$AT),
  1077. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u4imm:$YMSK))),
  1078. !strconcat("pm"#asmbase#"nn ", asmstr#", $XMSK, $YMSK"),
  1079. IIC_VecFP, []>,
  1080. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1081. }
  1082. }
  1083. // Defines 10 instructions, operand negating, unmasked, masked with 4, 2 bits.
  1084. // Upper nibble are masked with 0x8, 0x4, 0xC for negating operands.
  1085. multiclass ACC_NEG_UM_M42_XOM84C<bits<6> opcode, bits<8> xo, dag IOL,
  1086. string asmbase, string asmstr> {
  1087. defm NAME : ACC_NEG_UM_XOM84C<opcode, xo, IOL, asmbase, asmstr>;
  1088. let Predicates = [MMA, PrefixInstrs] in {
  1089. def PM#NAME :
  1090. MMIRR_XX3Form_X4Y2_XAB6<
  1091. opcode, !or(xo, 0x01), (outs acc:$AT),
  1092. !con(IOL, (ins u4imm:$XMSK, u2imm:$YMSK)),
  1093. !strconcat("pm"#asmbase#" ", asmstr#", $XMSK, $YMSK"),
  1094. IIC_VecFP, []>,
  1095. RegConstraint<"@earlyclobber $AT">;
  1096. def PM#NAME#PP :
  1097. MMIRR_XX3Form_X4Y2_XAB6<
  1098. opcode, xo, (outs acc:$AT),
  1099. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u2imm:$YMSK))),
  1100. !strconcat("pm"#asmbase#"pp ", asmstr#", $XMSK, $YMSK"),
  1101. IIC_VecFP, []>,
  1102. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1103. def PM#NAME#PN :
  1104. MMIRR_XX3Form_X4Y2_XAB6<
  1105. opcode, !or(xo, 0x80), (outs acc:$AT),
  1106. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u2imm:$YMSK))),
  1107. !strconcat("pm"#asmbase#"pn ", asmstr#", $XMSK, $YMSK"),
  1108. IIC_VecFP, []>,
  1109. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1110. def PM#NAME#NP :
  1111. MMIRR_XX3Form_X4Y2_XAB6<
  1112. opcode, !or(xo, 0x40), (outs acc:$AT),
  1113. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u2imm:$YMSK))),
  1114. !strconcat("pm"#asmbase#"np ", asmstr#", $XMSK, $YMSK"),
  1115. IIC_VecFP, []>,
  1116. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1117. def PM#NAME#NN :
  1118. MMIRR_XX3Form_X4Y2_XAB6<
  1119. opcode, !or(xo, 0xC0), (outs acc:$AT),
  1120. !con((ins acc:$ATi), !con(IOL, (ins u4imm:$XMSK, u2imm:$YMSK))),
  1121. !strconcat("pm"#asmbase#"nn ", asmstr#", $XMSK, $YMSK"),
  1122. IIC_VecFP, []>,
  1123. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1124. }
  1125. }
  1126. // End of class definitions.
  1127. //-----------------------------------------------------------------------------
  1128. let Predicates = [MMA] in {
  1129. def XXMFACC :
  1130. XForm_AT3<31, 0, 177, (outs acc:$ASo), (ins acc:$AS), "xxmfacc $AS",
  1131. IIC_VecGeneral,
  1132. [(set v512i1:$ASo, (int_ppc_mma_xxmfacc v512i1:$AS))]>,
  1133. RegConstraint<"$ASo = $AS">, NoEncode<"$ASo">;
  1134. def XXMTACC :
  1135. XForm_AT3<31, 1, 177, (outs acc:$AT), (ins acc:$ATi), "xxmtacc $AT",
  1136. IIC_VecGeneral,
  1137. [(set v512i1:$AT, (int_ppc_mma_xxmtacc v512i1:$ATi))]>,
  1138. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1139. def KILL_PAIR : PPCPostRAExpPseudo<(outs vsrprc:$XTp), (ins vsrprc:$XSp),
  1140. "#KILL_PAIR", []>,
  1141. RegConstraint<"$XTp = $XSp">;
  1142. def BUILD_UACC : PPCPostRAExpPseudo<(outs acc:$AT), (ins uacc:$AS),
  1143. "#BUILD_UACC $AT, $AS", []>;
  1144. // We define XXSETACCZ as rematerializable to undo CSE of that intrinsic in
  1145. // the backend. We avoid CSE here because it generates a copy of the acc
  1146. // register and this copy is more expensive than calling the intrinsic again.
  1147. let isAsCheapAsAMove = 1, isReMaterializable = 1 in {
  1148. def XXSETACCZ :
  1149. XForm_AT3<31, 3, 177, (outs acc:$AT), (ins), "xxsetaccz $AT", IIC_VecGeneral,
  1150. [(set v512i1:$AT, (int_ppc_mma_xxsetaccz))]>;
  1151. }
  1152. def XVI8GER4SPP :
  1153. XX3Form_AT3_XAB6<59, 99, (outs acc:$AT), (ins acc:$ATi, vsrc:$XA, vsrc:$XB),
  1154. "xvi8ger4spp $AT, $XA, $XB", IIC_VecGeneral, []>,
  1155. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1156. let mayStore = 1 in {
  1157. def SPILL_ACC: PPCEmitTimePseudo<(outs), (ins acc:$AT, memrix16:$dst),
  1158. "#SPILL_ACC", []>;
  1159. def SPILL_UACC: PPCEmitTimePseudo<(outs), (ins uacc:$AT, memrix16:$dst),
  1160. "#SPILL_UACC", []>;
  1161. }
  1162. let mayLoad = 1, hasSideEffects = 0 in {
  1163. def RESTORE_ACC: PPCEmitTimePseudo<(outs acc:$AT), (ins memrix16:$src),
  1164. "#RESTORE_ACC", []>;
  1165. def RESTORE_UACC: PPCEmitTimePseudo<(outs uacc:$AT), (ins memrix16:$src),
  1166. "#RESTORE_UACC", []>;
  1167. }
  1168. }
  1169. let Predicates = [MMA, PrefixInstrs] in {
  1170. def PMXVI8GER4SPP :
  1171. MMIRR_XX3Form_XYP4_XAB6<59, 99, (outs acc:$AT),
  1172. (ins acc:$ATi, vsrc:$XA,vsrc:$XB, u4imm:$XMSK,
  1173. u4imm:$YMSK, u4imm:$PMSK),
  1174. "pmxvi8ger4spp $AT, $XA, $XB, $XMSK, $YMSK, $PMSK",
  1175. IIC_VecGeneral, []>,
  1176. RegConstraint<"$ATi = $AT">, NoEncode<"$ATi">;
  1177. }
  1178. // MMA accumulating/non-accumulating instructions.
  1179. //------------------------------------------------------------------------------
  1180. // XVBF16GER2, XVBF16GER2PP, XVBF16GER2PN, XVBF16GER2NP, XVBF16GER2NN
  1181. // PMXVBF16GER2, PMXVBF16GER2PP, PMXVBF16GER2PN, PMXVBF16GER2NP, PMXVBF16GER2NN
  1182. defm XVBF16GER2 : ACC_NEG_UM_M244_XOM84C<59, 50, (ins vsrc:$XA, vsrc:$XB),
  1183. "xvbf16ger2", "$AT, $XA, $XB">;
  1184. // XVI4GER8, XVI4GER8PP, PMXVI4GER8, PMXVI4GER8PP
  1185. defm XVI4GER8 : ACC_UM_M844_XOEO<59, 34, (ins vsrc:$XA, vsrc:$XB),
  1186. "xvi4ger8", "$AT, $XA, $XB">;
  1187. // XVI8GER4, XVI8GER4PP, PMXVI8GER4, PMXVI8GER4PP
  1188. defm XVI8GER4 : ACC_UM_M444_XOEO<59, 2, (ins vsrc:$XA, vsrc:$XB),
  1189. "xvi8ger4", "$AT, $XA, $XB">;
  1190. // XVI16GER2, XVI16GER2PP, PMXVI16GER2, PMXVI16GER2PP
  1191. defm XVI16GER2 : ACC_UM_M244_XO46<59, 75, (ins vsrc:$XA, vsrc:$XB),
  1192. "xvi16ger2", "$AT, $XA, $XB">;
  1193. // XVI16GER2S, XVI16GER2SPP, PMXVI16GER2S, PMXVI16GER2SPP
  1194. defm XVI16GER2S : ACC_UM_M244_XOEO<59, 42, (ins vsrc:$XA, vsrc:$XB),
  1195. "xvi16ger2s", "$AT, $XA, $XB">;
  1196. // XVF16GER2, XVF16GER2PP, XVF16GER2PN, XVF16GER2NP, XVF16GER2NN
  1197. // PMXVF16GER2, PMXVF16GER2PP, PMXVF16GER2PN, PMXVF16GER2NP, PMXVF16GER2NN
  1198. defm XVF16GER2 : ACC_NEG_UM_M244_XOM84C<59, 18, (ins vsrc:$XA, vsrc:$XB),
  1199. "xvf16ger2", "$AT, $XA, $XB">;
  1200. // XVF32GER, XVF32GERPP, XVF32GERPN, XVF32GERNP, XVF32GERPP
  1201. // PMXVF32GER, PMXVF32GERPP, PMXVF32GERPN, PMXVF32GERNP, PMXVF32GERPP
  1202. defm XVF32GER : ACC_NEG_UM_M44_XOM84C<59, 26, (ins vsrc:$XA, vsrc:$XB),
  1203. "xvf32ger", "$AT, $XA, $XB">;
  1204. // XVF64GER, XVF64GERPP, XVF64GERPN, XVF64GERNP, XVF64GERNN
  1205. // PMXVF64GER, PMXVF64GERPP, PMXVF64GERPN, PMXVF64GERNP, PMXVF64GERNN
  1206. defm XVF64GER : ACC_NEG_UM_M42_XOM84C<59, 58, (ins vsrpevenrc:$XA, vsrc:$XB),
  1207. "xvf64ger", "$AT, $XA, $XB">;
  1208. //------------------------------------------------------------------------------
  1209. // MMA Intrinsics
  1210. let Predicates = [MMA] in {
  1211. def : Pat<(v512i1 (int_ppc_mma_xvi4ger8 v16i8:$XA, v16i8:$XB)),
  1212. (XVI4GER8 RCCp.AToVSRC, RCCp.BToVSRC)>;
  1213. def : Pat<(v512i1 (int_ppc_mma_xvi4ger8pp v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1214. (XVI4GER8PP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1215. def : Pat<(v512i1 (int_ppc_mma_xvi8ger4 v16i8:$XA, v16i8:$XB)),
  1216. (XVI8GER4 RCCp.AToVSRC, RCCp.BToVSRC)>;
  1217. def : Pat<(v512i1 (int_ppc_mma_xvi8ger4pp v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1218. (XVI8GER4PP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1219. def : Pat<(v512i1 (int_ppc_mma_xvi16ger2s v16i8:$XA, v16i8:$XB)),
  1220. (XVI16GER2S RCCp.AToVSRC, RCCp.BToVSRC)>;
  1221. def : Pat<(v512i1 (int_ppc_mma_xvi16ger2spp v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1222. (XVI16GER2SPP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1223. def : Pat<(v512i1 (int_ppc_mma_xvf16ger2 v16i8:$XA, v16i8:$XB)),
  1224. (XVF16GER2 RCCp.AToVSRC, RCCp.BToVSRC)>;
  1225. def : Pat<(v512i1 (int_ppc_mma_xvf16ger2pp v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1226. (XVF16GER2PP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1227. def : Pat<(v512i1 (int_ppc_mma_xvf16ger2pn v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1228. (XVF16GER2PN $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1229. def : Pat<(v512i1 (int_ppc_mma_xvf16ger2np v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1230. (XVF16GER2NP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1231. def : Pat<(v512i1 (int_ppc_mma_xvf16ger2nn v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1232. (XVF16GER2NN $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1233. def : Pat<(v512i1 (int_ppc_mma_xvf32ger v16i8:$XA, v16i8:$XB)),
  1234. (XVF32GER RCCp.AToVSRC, RCCp.BToVSRC)>;
  1235. def : Pat<(v512i1 (int_ppc_mma_xvf32gerpp v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1236. (XVF32GERPP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1237. def : Pat<(v512i1 (int_ppc_mma_xvf32gerpn v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1238. (XVF32GERPN $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1239. def : Pat<(v512i1 (int_ppc_mma_xvf32gernp v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1240. (XVF32GERNP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1241. def : Pat<(v512i1 (int_ppc_mma_xvf32gernn v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1242. (XVF32GERNN $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1243. def : Pat<(v512i1 (int_ppc_mma_xvf64ger v256i1:$XA, v16i8:$XB)),
  1244. (XVF64GER $XA, RCCp.BToVSRC)>;
  1245. def : Pat<(v512i1 (int_ppc_mma_xvf64gerpp v512i1:$ATi, v256i1:$XA, v16i8:$XB)),
  1246. (XVF64GERPP $ATi, $XA, RCCp.BToVSRC)>;
  1247. def : Pat<(v512i1 (int_ppc_mma_xvf64gerpn v512i1:$ATi, v256i1:$XA, v16i8:$XB)),
  1248. (XVF64GERPN $ATi, $XA, RCCp.BToVSRC)>;
  1249. def : Pat<(v512i1 (int_ppc_mma_xvf64gernp v512i1:$ATi, v256i1:$XA, v16i8:$XB)),
  1250. (XVF64GERNP $ATi, $XA, RCCp.BToVSRC)>;
  1251. def : Pat<(v512i1 (int_ppc_mma_xvf64gernn v512i1:$ATi, v256i1:$XA, v16i8:$XB)),
  1252. (XVF64GERNN $ATi, $XA, RCCp.BToVSRC)>;
  1253. def : Pat<(v512i1 (int_ppc_mma_xvbf16ger2 v16i8:$XA, v16i8:$XB)),
  1254. (XVBF16GER2 RCCp.AToVSRC, RCCp.BToVSRC)>;
  1255. def : Pat<(v512i1 (int_ppc_mma_xvbf16ger2pp v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1256. (XVBF16GER2PP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1257. def : Pat<(v512i1 (int_ppc_mma_xvbf16ger2pn v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1258. (XVBF16GER2PN $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1259. def : Pat<(v512i1 (int_ppc_mma_xvbf16ger2np v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1260. (XVBF16GER2NP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1261. def : Pat<(v512i1 (int_ppc_mma_xvbf16ger2nn v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1262. (XVBF16GER2NN $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1263. def : Pat<(v512i1 (int_ppc_mma_xvi16ger2 v16i8:$XA, v16i8:$XB)),
  1264. (XVI16GER2 RCCp.AToVSRC, RCCp.BToVSRC)>;
  1265. def : Pat<(v512i1 (int_ppc_mma_xvi16ger2pp v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1266. (XVI16GER2PP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1267. def : Pat<(v512i1 (int_ppc_mma_xvi8ger4spp v512i1:$ATi, v16i8:$XA, v16i8:$XB)),
  1268. (XVI8GER4SPP $ATi, RCCp.AToVSRC, RCCp.BToVSRC)>;
  1269. }
  1270. // MMA Intrinsics
  1271. let Predicates = [MMA, PrefixInstrs] in {
  1272. def : Pat<(v512i1 (int_ppc_mma_pmxvi4ger8 v16i8:$XA, v16i8:$XB, Msk4Imm:$XMSK,
  1273. Msk4Imm:$YMSK, Msk8Imm:$PMSK)),
  1274. (PMXVI4GER8 RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1275. Msk4Imm:$YMSK, Msk8Imm:$PMSK)>;
  1276. def : Pat<(v512i1 (int_ppc_mma_pmxvi4ger8pp v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1277. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1278. Msk8Imm:$PMSK)),
  1279. (PMXVI4GER8PP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1280. Msk4Imm:$YMSK, Msk8Imm:$PMSK)>;
  1281. def : Pat<(v512i1 (int_ppc_mma_pmxvi8ger4 v16i8:$XA, v16i8:$XB, Msk4Imm:$XMSK,
  1282. Msk4Imm:$YMSK, Msk4Imm:$PMSK)),
  1283. (PMXVI8GER4 RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1284. Msk4Imm:$YMSK, Msk4Imm:$PMSK)>;
  1285. def : Pat<(v512i1 (int_ppc_mma_pmxvi8ger4pp v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1286. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1287. Msk4Imm:$PMSK)),
  1288. (PMXVI8GER4PP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1289. Msk4Imm:$YMSK, Msk4Imm:$PMSK)>;
  1290. def : Pat<(v512i1 (int_ppc_mma_pmxvi16ger2s v16i8:$XA, v16i8:$XB, Msk4Imm:$XMSK,
  1291. Msk4Imm:$YMSK, Msk2Imm:$PMSK)),
  1292. (PMXVI16GER2S RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1293. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1294. def : Pat<(v512i1 (int_ppc_mma_pmxvi16ger2spp v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1295. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1296. Msk2Imm:$PMSK)),
  1297. (PMXVI16GER2SPP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1298. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1299. def : Pat<(v512i1 (int_ppc_mma_pmxvf16ger2 v16i8:$XA, v16i8:$XB, Msk4Imm:$XMSK,
  1300. Msk4Imm:$YMSK, Msk2Imm:$PMSK)),
  1301. (PMXVF16GER2 RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1302. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1303. def : Pat<(v512i1 (int_ppc_mma_pmxvf16ger2pp v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1304. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1305. Msk2Imm:$PMSK)),
  1306. (PMXVF16GER2PP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1307. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1308. def : Pat<(v512i1 (int_ppc_mma_pmxvf16ger2pn v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1309. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1310. Msk2Imm:$PMSK)),
  1311. (PMXVF16GER2PN $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1312. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1313. def : Pat<(v512i1 (int_ppc_mma_pmxvf16ger2np v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1314. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1315. Msk2Imm:$PMSK)),
  1316. (PMXVF16GER2NP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1317. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1318. def : Pat<(v512i1 (int_ppc_mma_pmxvf16ger2pn v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1319. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1320. Msk2Imm:$PMSK)),
  1321. (PMXVF16GER2PN $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1322. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1323. def : Pat<(v512i1 (int_ppc_mma_pmxvf16ger2np v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1324. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1325. Msk2Imm:$PMSK)),
  1326. (PMXVF16GER2NP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1327. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1328. def : Pat<(v512i1 (int_ppc_mma_pmxvf16ger2nn v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1329. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1330. Msk2Imm:$PMSK)),
  1331. (PMXVF16GER2NN $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1332. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1333. def : Pat<(v512i1 (int_ppc_mma_pmxvf32ger v16i8:$XA, v16i8:$XB, Msk4Imm:$XMSK,
  1334. Msk4Imm:$YMSK)),
  1335. (PMXVF32GER RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1336. Msk4Imm:$YMSK)>;
  1337. def : Pat<(v512i1 (int_ppc_mma_pmxvf32gerpp v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1338. Msk4Imm:$XMSK, Msk4Imm:$YMSK)),
  1339. (PMXVF32GERPP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1340. Msk4Imm:$YMSK)>;
  1341. def : Pat<(v512i1 (int_ppc_mma_pmxvf32gerpn v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1342. Msk4Imm:$XMSK, Msk4Imm:$YMSK)),
  1343. (PMXVF32GERPN $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1344. Msk4Imm:$YMSK)>;
  1345. def : Pat<(v512i1 (int_ppc_mma_pmxvf32gernp v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1346. Msk4Imm:$XMSK, Msk4Imm:$YMSK)),
  1347. (PMXVF32GERNP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1348. Msk4Imm:$YMSK)>;
  1349. def : Pat<(v512i1 (int_ppc_mma_pmxvf32gernn v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1350. Msk4Imm:$XMSK, Msk4Imm:$YMSK)),
  1351. (PMXVF32GERNN $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1352. Msk4Imm:$YMSK)>;
  1353. def : Pat<(v512i1 (int_ppc_mma_pmxvf64ger v256i1:$XA, v16i8:$XB, Msk4Imm:$XMSK,
  1354. Msk2Imm:$YMSK)),
  1355. (PMXVF64GER $XA, RCCp.BToVSRC, Msk4Imm:$XMSK, Msk2Imm:$YMSK)>;
  1356. def : Pat<(v512i1 (int_ppc_mma_pmxvf64gerpp v512i1:$ATi, v256i1:$XA, v16i8:$XB,
  1357. Msk4Imm:$XMSK, Msk2Imm:$YMSK)),
  1358. (PMXVF64GERPP $ATi, $XA, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1359. Msk2Imm:$YMSK)>;
  1360. def : Pat<(v512i1 (int_ppc_mma_pmxvf64gerpn v512i1:$ATi, v256i1:$XA, v16i8:$XB,
  1361. Msk4Imm:$XMSK, Msk2Imm:$YMSK)),
  1362. (PMXVF64GERPN $ATi, $XA, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1363. Msk2Imm:$YMSK)>;
  1364. def : Pat<(v512i1 (int_ppc_mma_pmxvf64gernp v512i1:$ATi, v256i1:$XA, v16i8:$XB,
  1365. Msk4Imm:$XMSK, Msk2Imm:$YMSK)),
  1366. (PMXVF64GERNP $ATi, $XA, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1367. Msk2Imm:$YMSK)>;
  1368. def : Pat<(v512i1 (int_ppc_mma_pmxvf64gernn v512i1:$ATi, v256i1:$XA, v16i8:$XB,
  1369. Msk4Imm:$XMSK, Msk2Imm:$YMSK)),
  1370. (PMXVF64GERNN $ATi, $XA, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1371. Msk2Imm:$YMSK)>;
  1372. def : Pat<(v512i1 (int_ppc_mma_pmxvbf16ger2 v16i8:$XA, v16i8:$XB, Msk4Imm:$XMSK,
  1373. Msk4Imm:$YMSK, Msk2Imm:$PMSK)),
  1374. (PMXVBF16GER2 RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1375. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1376. def : Pat<(v512i1 (int_ppc_mma_pmxvbf16ger2pp v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1377. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1378. Msk2Imm:$PMSK)),
  1379. (PMXVBF16GER2PP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1380. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1381. def : Pat<(v512i1 (int_ppc_mma_pmxvbf16ger2pn v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1382. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1383. Msk2Imm:$PMSK)),
  1384. (PMXVBF16GER2PN $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1385. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1386. def : Pat<(v512i1 (int_ppc_mma_pmxvbf16ger2np v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1387. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1388. Msk2Imm:$PMSK)),
  1389. (PMXVBF16GER2NP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1390. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1391. def : Pat<(v512i1 (int_ppc_mma_pmxvbf16ger2nn v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1392. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1393. Msk2Imm:$PMSK)),
  1394. (PMXVBF16GER2NN $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1395. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1396. def : Pat<(v512i1 (int_ppc_mma_pmxvi16ger2 v16i8:$XA, v16i8:$XB, Msk4Imm:$XMSK,
  1397. Msk4Imm:$YMSK, Msk2Imm:$PMSK)),
  1398. (PMXVI16GER2 RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1399. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1400. def : Pat<(v512i1 (int_ppc_mma_pmxvi8ger4spp v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1401. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1402. Msk2Imm:$PMSK)),
  1403. (PMXVI8GER4SPP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1404. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1405. def : Pat<(v512i1 (int_ppc_mma_pmxvi16ger2pp v512i1:$ATi, v16i8:$XA, v16i8:$XB,
  1406. Msk4Imm:$XMSK, Msk4Imm:$YMSK,
  1407. Msk2Imm:$PMSK)),
  1408. (PMXVI16GER2PP $ATi, RCCp.AToVSRC, RCCp.BToVSRC, Msk4Imm:$XMSK,
  1409. Msk4Imm:$YMSK, Msk2Imm:$PMSK)>;
  1410. }
  1411. def Concats {
  1412. dag VecsToVecPair0 =
  1413. (v256i1 (INSERT_SUBREG
  1414. (INSERT_SUBREG (IMPLICIT_DEF), $vs0, sub_vsx1),
  1415. $vs1, sub_vsx0));
  1416. dag VecsToVecPair1 =
  1417. (v256i1 (INSERT_SUBREG
  1418. (INSERT_SUBREG (IMPLICIT_DEF), $vs2, sub_vsx1),
  1419. $vs3, sub_vsx0));
  1420. dag VecsToVecQuad =
  1421. (BUILD_UACC (INSERT_SUBREG
  1422. (INSERT_SUBREG (v512i1 (IMPLICIT_DEF)),
  1423. (KILL_PAIR VecsToVecPair0), sub_pair0),
  1424. (KILL_PAIR VecsToVecPair1), sub_pair1));
  1425. }
  1426. def Extracts {
  1427. dag Pair0 = (v256i1 (EXTRACT_SUBREG $v, sub_pair0));
  1428. dag Pair1 = (v256i1 (EXTRACT_SUBREG $v, sub_pair1));
  1429. dag Vec0 = (v4i32 (EXTRACT_SUBREG Pair0, sub_vsx0));
  1430. dag Vec1 = (v4i32 (EXTRACT_SUBREG Pair0, sub_vsx1));
  1431. dag Vec2 = (v4i32 (EXTRACT_SUBREG Pair1, sub_vsx0));
  1432. dag Vec3 = (v4i32 (EXTRACT_SUBREG Pair1, sub_vsx1));
  1433. }
  1434. let Predicates = [MMA] in {
  1435. def : Pat<(v512i1 (PPCAccBuild v4i32:$vs1, v4i32:$vs0, v4i32:$vs3, v4i32:$vs2)),
  1436. (XXMTACC Concats.VecsToVecQuad)>;
  1437. def : Pat<(v512i1 (int_ppc_mma_assemble_acc v16i8:$vs1, v16i8:$vs0,
  1438. v16i8:$vs3, v16i8:$vs2)),
  1439. (XXMTACC Concats.VecsToVecQuad)>;
  1440. def : Pat<(v512i1 (PPCxxmfacc v512i1:$AS)), (XXMFACC acc:$AS)>;
  1441. def : Pat<(v4i32 (PPCAccExtractVsx acc:$v, 0)),
  1442. Extracts.Vec0>;
  1443. def : Pat<(v4i32 (PPCAccExtractVsx acc:$v, 1)),
  1444. Extracts.Vec1>;
  1445. def : Pat<(v4i32 (PPCAccExtractVsx acc:$v, 2)),
  1446. Extracts.Vec2>;
  1447. def : Pat<(v4i32 (PPCAccExtractVsx acc:$v, 3)),
  1448. Extracts.Vec3>;
  1449. }
  1450. let Predicates = [PairedVectorMemops] in {
  1451. def : Pat<(v256i1 (PPCPairBuild v4i32:$vs1, v4i32:$vs0)),
  1452. Concats.VecsToVecPair0>;
  1453. def : Pat<(v256i1 (int_ppc_vsx_assemble_pair v16i8:$vs1, v16i8:$vs0)),
  1454. Concats.VecsToVecPair0>;
  1455. def : Pat<(v4i32 (PPCPairExtractVsx vsrpevenrc:$v, 0)),
  1456. (v4i32 (EXTRACT_SUBREG $v, sub_vsx0))>;
  1457. def : Pat<(v4i32 (PPCPairExtractVsx vsrpevenrc:$v, 1)),
  1458. (v4i32 (EXTRACT_SUBREG $v, sub_vsx1))>;
  1459. }
  1460. let mayLoad = 1, mayStore = 0, Predicates = [PairedVectorMemops] in {
  1461. def LXVP : DQForm_XTp5_RA17_MEM<6, 0, (outs vsrprc:$XTp),
  1462. (ins memrix16:$DQ_RA), "lxvp $XTp, $DQ_RA",
  1463. IIC_LdStLFD, []>;
  1464. def LXVPX : XForm_XTp5_XAB5<31, 333, (outs vsrprc:$XTp), (ins memrr:$src),
  1465. "lxvpx $XTp, $src", IIC_LdStLFD,
  1466. []>;
  1467. }
  1468. let mayLoad = 0, mayStore = 1, Predicates = [PairedVectorMemops] in {
  1469. def STXVP : DQForm_XTp5_RA17_MEM<6, 1, (outs), (ins vsrprc:$XTp,
  1470. memrix16:$DQ_RA), "stxvp $XTp, $DQ_RA",
  1471. IIC_LdStLFD, []>;
  1472. def STXVPX : XForm_XTp5_XAB5<31, 461, (outs), (ins vsrprc:$XTp, memrr:$dst),
  1473. "stxvpx $XTp, $dst", IIC_LdStLFD,
  1474. []>;
  1475. }
  1476. let mayLoad = 1, mayStore = 0, Predicates = [PairedVectorMemops, PrefixInstrs] in {
  1477. defm PLXVP :
  1478. 8LS_DForm_R_XTp5_SI34_MEM_p<58, (outs vsrprc:$XTp), (ins memri34:$D_RA),
  1479. (ins memri34_pcrel:$D_RA), "plxvp $XTp, $D_RA",
  1480. IIC_LdStLFD>;
  1481. }
  1482. let mayLoad = 0, mayStore = 1, Predicates = [PairedVectorMemops, PrefixInstrs] in {
  1483. defm PSTXVP :
  1484. 8LS_DForm_R_XTp5_SI34_MEM_p<62, (outs), (ins vsrprc:$XTp, memri34:$D_RA),
  1485. (ins vsrprc:$XTp, memri34_pcrel:$D_RA),
  1486. "pstxvp $XTp, $D_RA", IIC_LdStLFD>;
  1487. }
  1488. let Predicates = [PairedVectorMemops] in {
  1489. // Intrinsics for Paired Vector Loads.
  1490. def : Pat<(v256i1 (int_ppc_vsx_lxvp DQForm:$src)), (LXVP memrix16:$src)>;
  1491. def : Pat<(v256i1 (int_ppc_vsx_lxvp XForm:$src)), (LXVPX XForm:$src)>;
  1492. let Predicates = [PairedVectorMemops, PrefixInstrs] in {
  1493. def : Pat<(v256i1 (int_ppc_vsx_lxvp PDForm:$src)), (PLXVP memri34:$src)>;
  1494. }
  1495. // Intrinsics for Paired Vector Stores.
  1496. def : Pat<(int_ppc_vsx_stxvp v256i1:$XSp, DQForm:$dst),
  1497. (STXVP $XSp, memrix16:$dst)>;
  1498. def : Pat<(int_ppc_vsx_stxvp v256i1:$XSp, XForm:$dst),
  1499. (STXVPX $XSp, XForm:$dst)>;
  1500. let Predicates = [PairedVectorMemops, PrefixInstrs] in {
  1501. def : Pat<(int_ppc_vsx_stxvp v256i1:$XSp, PDForm:$dst),
  1502. (PSTXVP $XSp, memri34:$dst)>;
  1503. }
  1504. }
  1505. let Predicates = [PCRelativeMemops] in {
  1506. // Load i32
  1507. def : Pat<(i32 (zextloadi1 (PPCmatpcreladdr PCRelForm:$ga))),
  1508. (PLBZpc $ga, 0)>;
  1509. def : Pat<(i32 (extloadi1 (PPCmatpcreladdr PCRelForm:$ga))),
  1510. (PLBZpc $ga, 0)>;
  1511. def : Pat<(i32 (zextloadi8 (PPCmatpcreladdr PCRelForm:$ga))),
  1512. (PLBZpc $ga, 0)>;
  1513. def : Pat<(i32 (extloadi8 (PPCmatpcreladdr PCRelForm:$ga))),
  1514. (PLBZpc $ga, 0)>;
  1515. def : Pat<(i32 (sextloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
  1516. (PLHApc $ga, 0)>;
  1517. def : Pat<(i32 (zextloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
  1518. (PLHZpc $ga, 0)>;
  1519. def : Pat<(i32 (extloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
  1520. (PLHZpc $ga, 0)>;
  1521. def : Pat<(i32 (load (PPCmatpcreladdr PCRelForm:$ga))), (PLWZpc $ga, 0)>;
  1522. // Store i32
  1523. def : Pat<(truncstorei8 i32:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
  1524. (PSTBpc $RS, $ga, 0)>;
  1525. def : Pat<(truncstorei16 i32:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
  1526. (PSTHpc $RS, $ga, 0)>;
  1527. def : Pat<(store i32:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
  1528. (PSTWpc $RS, $ga, 0)>;
  1529. // Load i64
  1530. def : Pat<(i64 (zextloadi1 (PPCmatpcreladdr PCRelForm:$ga))),
  1531. (PLBZ8pc $ga, 0)>;
  1532. def : Pat<(i64 (extloadi1 (PPCmatpcreladdr PCRelForm:$ga))),
  1533. (PLBZ8pc $ga, 0)>;
  1534. def : Pat<(i64 (zextloadi8 (PPCmatpcreladdr PCRelForm:$ga))),
  1535. (PLBZ8pc $ga, 0)>;
  1536. def : Pat<(i64 (extloadi8 (PPCmatpcreladdr PCRelForm:$ga))),
  1537. (PLBZ8pc $ga, 0)>;
  1538. def : Pat<(i64 (sextloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
  1539. (PLHA8pc $ga, 0)>;
  1540. def : Pat<(i64 (zextloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
  1541. (PLHZ8pc $ga, 0)>;
  1542. def : Pat<(i64 (extloadi16 (PPCmatpcreladdr PCRelForm:$ga))),
  1543. (PLHZ8pc $ga, 0)>;
  1544. def : Pat<(i64 (zextloadi32 (PPCmatpcreladdr PCRelForm:$ga))),
  1545. (PLWZ8pc $ga, 0)>;
  1546. def : Pat<(i64 (sextloadi32 (PPCmatpcreladdr PCRelForm:$ga))),
  1547. (PLWA8pc $ga, 0)>;
  1548. def : Pat<(i64 (extloadi32 (PPCmatpcreladdr PCRelForm:$ga))),
  1549. (PLWZ8pc $ga, 0)>;
  1550. def : Pat<(i64 (load (PPCmatpcreladdr PCRelForm:$ga))), (PLDpc $ga, 0)>;
  1551. // Store i64
  1552. def : Pat<(truncstorei8 i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
  1553. (PSTB8pc $RS, $ga, 0)>;
  1554. def : Pat<(truncstorei16 i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
  1555. (PSTH8pc $RS, $ga, 0)>;
  1556. def : Pat<(truncstorei32 i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
  1557. (PSTW8pc $RS, $ga, 0)>;
  1558. def : Pat<(store i64:$RS, (PPCmatpcreladdr PCRelForm:$ga)),
  1559. (PSTDpc $RS, $ga, 0)>;
  1560. // Load f32
  1561. def : Pat<(f32 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLFSpc $addr, 0)>;
  1562. // Store f32
  1563. def : Pat<(store f32:$FRS, (PPCmatpcreladdr PCRelForm:$ga)),
  1564. (PSTFSpc $FRS, $ga, 0)>;
  1565. // Load f64
  1566. def : Pat<(f64 (extloadf32 (PPCmatpcreladdr PCRelForm:$addr))),
  1567. (COPY_TO_REGCLASS (PLFSpc $addr, 0), VSFRC)>;
  1568. def : Pat<(f64 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLFDpc $addr, 0)>;
  1569. // Store f64
  1570. def : Pat<(store f64:$FRS, (PPCmatpcreladdr PCRelForm:$ga)),
  1571. (PSTFDpc $FRS, $ga, 0)>;
  1572. // Load f128
  1573. def : Pat<(f128 (load (PPCmatpcreladdr PCRelForm:$addr))),
  1574. (COPY_TO_REGCLASS (PLXVpc $addr, 0), VRRC)>;
  1575. // Store f128
  1576. def : Pat<(store f128:$XS, (PPCmatpcreladdr PCRelForm:$ga)),
  1577. (PSTXVpc (COPY_TO_REGCLASS $XS, VSRC), $ga, 0)>;
  1578. // Load v4i32
  1579. def : Pat<(v4i32 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLXVpc $addr, 0)>;
  1580. // Store v4i32
  1581. def : Pat<(store v4i32:$XS, (PPCmatpcreladdr PCRelForm:$ga)),
  1582. (PSTXVpc $XS, $ga, 0)>;
  1583. // Load v2i64
  1584. def : Pat<(v2i64 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLXVpc $addr, 0)>;
  1585. // Store v2i64
  1586. def : Pat<(store v2i64:$XS, (PPCmatpcreladdr PCRelForm:$ga)),
  1587. (PSTXVpc $XS, $ga, 0)>;
  1588. // Load v4f32
  1589. def : Pat<(v4f32 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLXVpc $addr, 0)>;
  1590. // Store v4f32
  1591. def : Pat<(store v4f32:$XS, (PPCmatpcreladdr PCRelForm:$ga)),
  1592. (PSTXVpc $XS, $ga, 0)>;
  1593. // Load v2f64
  1594. def : Pat<(v2f64 (load (PPCmatpcreladdr PCRelForm:$addr))), (PLXVpc $addr, 0)>;
  1595. // Store v2f64
  1596. def : Pat<(store v2f64:$XS, (PPCmatpcreladdr PCRelForm:$ga)),
  1597. (PSTXVpc $XS, $ga, 0)>;
  1598. // Atomic Load
  1599. def : Pat<(atomic_load_8 (PPCmatpcreladdr PCRelForm:$ga)),
  1600. (PLBZpc $ga, 0)>;
  1601. def : Pat<(atomic_load_16 (PPCmatpcreladdr PCRelForm:$ga)),
  1602. (PLHZpc $ga, 0)>;
  1603. def : Pat<(atomic_load_32 (PPCmatpcreladdr PCRelForm:$ga)),
  1604. (PLWZpc $ga, 0)>;
  1605. def : Pat<(atomic_load_64 (PPCmatpcreladdr PCRelForm:$ga)),
  1606. (PLDpc $ga, 0)>;
  1607. // Atomic Store
  1608. def : Pat<(atomic_store_8 (PPCmatpcreladdr PCRelForm:$ga), i32:$RS),
  1609. (PSTBpc $RS, $ga, 0)>;
  1610. def : Pat<(atomic_store_16 (PPCmatpcreladdr PCRelForm:$ga), i32:$RS),
  1611. (PSTHpc $RS, $ga, 0)>;
  1612. def : Pat<(atomic_store_32 (PPCmatpcreladdr PCRelForm:$ga), i32:$RS),
  1613. (PSTWpc $RS, $ga, 0)>;
  1614. def : Pat<(atomic_store_8 (PPCmatpcreladdr PCRelForm:$ga), i64:$RS),
  1615. (PSTB8pc $RS, $ga, 0)>;
  1616. def : Pat<(atomic_store_16 (PPCmatpcreladdr PCRelForm:$ga), i64:$RS),
  1617. (PSTH8pc $RS, $ga, 0)>;
  1618. def : Pat<(atomic_store_32 (PPCmatpcreladdr PCRelForm:$ga), i64:$RS),
  1619. (PSTW8pc $RS, $ga, 0)>;
  1620. def : Pat<(atomic_store_64 (PPCmatpcreladdr PCRelForm:$ga), i64:$RS),
  1621. (PSTDpc $RS, $ga, 0)>;
  1622. // Special Cases For PPCstore_scal_int_from_vsr
  1623. def : Pat<(PPCstore_scal_int_from_vsr
  1624. (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)),
  1625. (PPCmatpcreladdr PCRelForm:$dst), 8),
  1626. (PSTXSDpc (XSCVDPSXDS f64:$src), $dst, 0)>;
  1627. def : Pat<(PPCstore_scal_int_from_vsr
  1628. (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)),
  1629. (PPCmatpcreladdr PCRelForm:$dst), 8),
  1630. (PSTXSDpc (COPY_TO_REGCLASS (XSCVQPSDZ f128:$src), VFRC), $dst, 0)>;
  1631. def : Pat<(PPCstore_scal_int_from_vsr
  1632. (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)),
  1633. (PPCmatpcreladdr PCRelForm:$dst), 8),
  1634. (PSTXSDpc (XSCVDPUXDS f64:$src), $dst, 0)>;
  1635. def : Pat<(PPCstore_scal_int_from_vsr
  1636. (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)),
  1637. (PPCmatpcreladdr PCRelForm:$dst), 8),
  1638. (PSTXSDpc (COPY_TO_REGCLASS (XSCVQPUDZ f128:$src), VFRC), $dst, 0)>;
  1639. def : Pat<(v4f32 (PPCldvsxlh (PPCmatpcreladdr PCRelForm:$addr))),
  1640. (SUBREG_TO_REG (i64 1), (PLFDpc $addr, 0), sub_64)>;
  1641. // If the PPCmatpcreladdr node is not caught by any other pattern it should be
  1642. // caught here and turned into a paddi instruction to materialize the address.
  1643. def : Pat<(PPCmatpcreladdr PCRelForm:$addr), (PADDI8pc 0, $addr)>;
  1644. // PPCtlsdynamatpcreladdr node is used for TLS dynamic models to materialize
  1645. // tls global address with paddi instruction.
  1646. def : Pat<(PPCtlsdynamatpcreladdr PCRelForm:$addr), (PADDI8pc 0, $addr)>;
  1647. // PPCtlslocalexecmataddr node is used for TLS local exec models to
  1648. // materialize tls global address with paddi instruction.
  1649. def : Pat<(PPCaddTls i64:$in, (PPCtlslocalexecmataddr tglobaltlsaddr:$addr)),
  1650. (PADDI8 $in, $addr)>;
  1651. }
  1652. let Predicates = [PrefixInstrs] in {
  1653. def XXPERMX :
  1654. 8RR_XX4Form_IMM3_XTABC6<34, 0, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
  1655. vsrc:$XC, u3imm:$UIM),
  1656. "xxpermx $XT, $XA, $XB, $XC, $UIM",
  1657. IIC_VecPerm, []>;
  1658. def XXBLENDVB :
  1659. 8RR_XX4Form_XTABC6<33, 0, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
  1660. vsrc:$XC), "xxblendvb $XT, $XA, $XB, $XC",
  1661. IIC_VecGeneral, []>;
  1662. def XXBLENDVH :
  1663. 8RR_XX4Form_XTABC6<33, 1, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
  1664. vsrc:$XC), "xxblendvh $XT, $XA, $XB, $XC",
  1665. IIC_VecGeneral, []>;
  1666. def XXBLENDVW :
  1667. 8RR_XX4Form_XTABC6<33, 2, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
  1668. vsrc:$XC), "xxblendvw $XT, $XA, $XB, $XC",
  1669. IIC_VecGeneral, []>;
  1670. def XXBLENDVD :
  1671. 8RR_XX4Form_XTABC6<33, 3, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
  1672. vsrc:$XC), "xxblendvd $XT, $XA, $XB, $XC",
  1673. IIC_VecGeneral, []>;
  1674. }
  1675. // XXSPLTIW/DP/32DX need extra flags to make sure the compiler does not attempt
  1676. // to spill part of the instruction when the values are similar.
  1677. let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1, Predicates = [PrefixInstrs] in {
  1678. def XXSPLTIW : 8RR_DForm_IMM32_XT6<32, 3, (outs vsrc:$XT),
  1679. (ins i32imm:$IMM32),
  1680. "xxspltiw $XT, $IMM32", IIC_VecGeneral,
  1681. []>;
  1682. def XXSPLTIDP : 8RR_DForm_IMM32_XT6<32, 2, (outs vsrc:$XT),
  1683. (ins i32imm:$IMM32),
  1684. "xxspltidp $XT, $IMM32", IIC_VecGeneral,
  1685. [(set v2f64:$XT,
  1686. (PPCxxspltidp i32:$IMM32))]>;
  1687. def XXSPLTI32DX :
  1688. 8RR_DForm_IMM32_XT6_IX<32, 0, (outs vsrc:$XT),
  1689. (ins vsrc:$XTi, u1imm:$IX, i32imm:$IMM32),
  1690. "xxsplti32dx $XT, $IX, $IMM32", IIC_VecGeneral,
  1691. [(set v2i64:$XT,
  1692. (PPCxxsplti32dx v2i64:$XTi, i32:$IX,
  1693. i32:$IMM32))]>,
  1694. RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">;
  1695. }
  1696. let Predicates = [IsISA3_1] in {
  1697. def SETBC : XForm_XT5_BI5<31, 384, (outs gprc:$RT), (ins crbitrc:$BI),
  1698. "setbc $RT, $BI", IIC_IntCompare, []>;
  1699. def SETBCR : XForm_XT5_BI5<31, 416, (outs gprc:$RT), (ins crbitrc:$BI),
  1700. "setbcr $RT, $BI", IIC_IntCompare, []>;
  1701. def SETNBC : XForm_XT5_BI5<31, 448, (outs gprc:$RT), (ins crbitrc:$BI),
  1702. "setnbc $RT, $BI", IIC_IntCompare, []>;
  1703. def SETNBCR : XForm_XT5_BI5<31, 480, (outs gprc:$RT), (ins crbitrc:$BI),
  1704. "setnbcr $RT, $BI", IIC_IntCompare, []>;
  1705. let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
  1706. def SETBC8 : XForm_XT5_BI5<31, 384, (outs g8rc:$RT), (ins crbitrc:$BI),
  1707. "setbc $RT, $BI", IIC_IntCompare, []>;
  1708. def SETBCR8 : XForm_XT5_BI5<31, 416, (outs g8rc:$RT), (ins crbitrc:$BI),
  1709. "setbcr $RT, $BI", IIC_IntCompare, []>;
  1710. def SETNBC8 : XForm_XT5_BI5<31, 448, (outs g8rc:$RT), (ins crbitrc:$BI),
  1711. "setnbc $RT, $BI", IIC_IntCompare, []>;
  1712. def SETNBCR8 : XForm_XT5_BI5<31, 480, (outs g8rc:$RT), (ins crbitrc:$BI),
  1713. "setnbcr $RT, $BI", IIC_IntCompare, []>;
  1714. }
  1715. def VSLDBI : VNForm_VTAB5_SD3<22, 0, (outs vrrc:$VRT),
  1716. (ins vrrc:$VRA, vrrc:$VRB, u3imm:$SH),
  1717. "vsldbi $VRT, $VRA, $VRB, $SH",
  1718. IIC_VecGeneral,
  1719. [(set v16i8:$VRT,
  1720. (int_ppc_altivec_vsldbi v16i8:$VRA,
  1721. v16i8:$VRB,
  1722. timm:$SH))]>;
  1723. def VSRDBI : VNForm_VTAB5_SD3<22, 1, (outs vrrc:$VRT),
  1724. (ins vrrc:$VRA, vrrc:$VRB, u3imm:$SH),
  1725. "vsrdbi $VRT, $VRA, $VRB, $SH",
  1726. IIC_VecGeneral,
  1727. [(set v16i8:$VRT,
  1728. (int_ppc_altivec_vsrdbi v16i8:$VRA,
  1729. v16i8:$VRB,
  1730. timm:$SH))]>;
  1731. defm VSTRIBR : VXForm_VTB5_RCr<13, 1, (outs vrrc:$vT), (ins vrrc:$vB),
  1732. "vstribr", "$vT, $vB", IIC_VecGeneral,
  1733. [(set v16i8:$vT,
  1734. (int_ppc_altivec_vstribr v16i8:$vB))]>;
  1735. defm VSTRIBL : VXForm_VTB5_RCr<13, 0, (outs vrrc:$vT), (ins vrrc:$vB),
  1736. "vstribl", "$vT, $vB", IIC_VecGeneral,
  1737. [(set v16i8:$vT,
  1738. (int_ppc_altivec_vstribl v16i8:$vB))]>;
  1739. defm VSTRIHR : VXForm_VTB5_RCr<13, 3, (outs vrrc:$vT), (ins vrrc:$vB),
  1740. "vstrihr", "$vT, $vB", IIC_VecGeneral,
  1741. [(set v8i16:$vT,
  1742. (int_ppc_altivec_vstrihr v8i16:$vB))]>;
  1743. defm VSTRIHL : VXForm_VTB5_RCr<13, 2, (outs vrrc:$vT), (ins vrrc:$vB),
  1744. "vstrihl", "$vT, $vB", IIC_VecGeneral,
  1745. [(set v8i16:$vT,
  1746. (int_ppc_altivec_vstrihl v8i16:$vB))]>;
  1747. def VINSW :
  1748. VXForm_1<207, (outs vrrc:$vD), (ins vrrc:$vDi, u4imm:$UIM, gprc:$rB),
  1749. "vinsw $vD, $rB, $UIM", IIC_VecGeneral,
  1750. [(set v4i32:$vD,
  1751. (int_ppc_altivec_vinsw v4i32:$vDi, i32:$rB, timm:$UIM))]>,
  1752. RegConstraint<"$vDi = $vD">, NoEncode<"$vDi">;
  1753. def VINSD :
  1754. VXForm_1<463, (outs vrrc:$vD), (ins vrrc:$vDi, u4imm:$UIM, g8rc:$rB),
  1755. "vinsd $vD, $rB, $UIM", IIC_VecGeneral,
  1756. [(set v2i64:$vD,
  1757. (int_ppc_altivec_vinsd v2i64:$vDi, i64:$rB, timm:$UIM))]>,
  1758. RegConstraint<"$vDi = $vD">, NoEncode<"$vDi">;
  1759. def VINSBVLX :
  1760. VXForm_VTB5_RA5_ins<15, "vinsbvlx",
  1761. [(set v16i8:$vD,
  1762. (int_ppc_altivec_vinsbvlx v16i8:$vDi, i32:$rA,
  1763. v16i8:$vB))]>;
  1764. def VINSBVRX :
  1765. VXForm_VTB5_RA5_ins<271, "vinsbvrx",
  1766. [(set v16i8:$vD,
  1767. (int_ppc_altivec_vinsbvrx v16i8:$vDi, i32:$rA,
  1768. v16i8:$vB))]>;
  1769. def VINSHVLX :
  1770. VXForm_VTB5_RA5_ins<79, "vinshvlx",
  1771. [(set v8i16:$vD,
  1772. (int_ppc_altivec_vinshvlx v8i16:$vDi, i32:$rA,
  1773. v8i16:$vB))]>;
  1774. def VINSHVRX :
  1775. VXForm_VTB5_RA5_ins<335, "vinshvrx",
  1776. [(set v8i16:$vD,
  1777. (int_ppc_altivec_vinshvrx v8i16:$vDi, i32:$rA,
  1778. v8i16:$vB))]>;
  1779. def VINSWVLX :
  1780. VXForm_VTB5_RA5_ins<143, "vinswvlx",
  1781. [(set v4i32:$vD,
  1782. (int_ppc_altivec_vinswvlx v4i32:$vDi, i32:$rA,
  1783. v4i32:$vB))]>;
  1784. def VINSWVRX :
  1785. VXForm_VTB5_RA5_ins<399, "vinswvrx",
  1786. [(set v4i32:$vD,
  1787. (int_ppc_altivec_vinswvrx v4i32:$vDi, i32:$rA,
  1788. v4i32:$vB))]>;
  1789. def VINSBLX :
  1790. VXForm_VRT5_RAB5_ins<527, "vinsblx",
  1791. [(set v16i8:$vD,
  1792. (int_ppc_altivec_vinsblx v16i8:$vDi, i32:$rA,
  1793. i32:$rB))]>;
  1794. def VINSBRX :
  1795. VXForm_VRT5_RAB5_ins<783, "vinsbrx",
  1796. [(set v16i8:$vD,
  1797. (int_ppc_altivec_vinsbrx v16i8:$vDi, i32:$rA,
  1798. i32:$rB))]>;
  1799. def VINSHLX :
  1800. VXForm_VRT5_RAB5_ins<591, "vinshlx",
  1801. [(set v8i16:$vD,
  1802. (int_ppc_altivec_vinshlx v8i16:$vDi, i32:$rA,
  1803. i32:$rB))]>;
  1804. def VINSHRX :
  1805. VXForm_VRT5_RAB5_ins<847, "vinshrx",
  1806. [(set v8i16:$vD,
  1807. (int_ppc_altivec_vinshrx v8i16:$vDi, i32:$rA,
  1808. i32:$rB))]>;
  1809. def VINSWLX :
  1810. VXForm_VRT5_RAB5_ins<655, "vinswlx",
  1811. [(set v4i32:$vD,
  1812. (int_ppc_altivec_vinswlx v4i32:$vDi, i32:$rA,
  1813. i32:$rB))]>;
  1814. def VINSWRX :
  1815. VXForm_VRT5_RAB5_ins<911, "vinswrx",
  1816. [(set v4i32:$vD,
  1817. (int_ppc_altivec_vinswrx v4i32:$vDi, i32:$rA,
  1818. i32:$rB))]>;
  1819. def VINSDLX :
  1820. VXForm_1<719, (outs vrrc:$vD), (ins vrrc:$vDi, g8rc:$rA, g8rc:$rB),
  1821. "vinsdlx $vD, $rA, $rB", IIC_VecGeneral,
  1822. [(set v2i64:$vD,
  1823. (int_ppc_altivec_vinsdlx v2i64:$vDi, i64:$rA, i64:$rB))]>,
  1824. RegConstraint<"$vDi = $vD">, NoEncode<"$vDi">;
  1825. def VINSDRX :
  1826. VXForm_1<975, (outs vrrc:$vD), (ins vrrc:$vDi, g8rc:$rA, g8rc:$rB),
  1827. "vinsdrx $vD, $rA, $rB", IIC_VecGeneral,
  1828. [(set v2i64:$vD,
  1829. (int_ppc_altivec_vinsdrx v2i64:$vDi, i64:$rA, i64:$rB))]>,
  1830. RegConstraint<"$vDi = $vD">, NoEncode<"$vDi">;
  1831. def VEXTRACTBM : VXForm_RD5_XO5_RS5<1602, 8, (outs gprc:$rD), (ins vrrc:$vB),
  1832. "vextractbm $rD, $vB", IIC_VecGeneral,
  1833. [(set i32:$rD,
  1834. (int_ppc_altivec_vextractbm v16i8:$vB))]>;
  1835. def VEXTRACTHM : VXForm_RD5_XO5_RS5<1602, 9, (outs gprc:$rD), (ins vrrc:$vB),
  1836. "vextracthm $rD, $vB", IIC_VecGeneral,
  1837. [(set i32:$rD,
  1838. (int_ppc_altivec_vextracthm v8i16:$vB))]>;
  1839. def VEXTRACTWM : VXForm_RD5_XO5_RS5<1602, 10, (outs gprc:$rD), (ins vrrc:$vB),
  1840. "vextractwm $rD, $vB", IIC_VecGeneral,
  1841. [(set i32:$rD,
  1842. (int_ppc_altivec_vextractwm v4i32:$vB))]>;
  1843. def VEXTRACTDM : VXForm_RD5_XO5_RS5<1602, 11, (outs gprc:$rD), (ins vrrc:$vB),
  1844. "vextractdm $rD, $vB", IIC_VecGeneral,
  1845. [(set i32:$rD,
  1846. (int_ppc_altivec_vextractdm v2i64:$vB))]>;
  1847. def VEXTRACTQM : VXForm_RD5_XO5_RS5<1602, 12, (outs gprc:$rD), (ins vrrc:$vB),
  1848. "vextractqm $rD, $vB", IIC_VecGeneral,
  1849. [(set i32:$rD,
  1850. (int_ppc_altivec_vextractqm v1i128:$vB))]>;
  1851. def VEXPANDBM : VXForm_RD5_XO5_RS5<1602, 0, (outs vrrc:$vD), (ins vrrc:$vB),
  1852. "vexpandbm $vD, $vB", IIC_VecGeneral,
  1853. [(set v16i8:$vD, (int_ppc_altivec_vexpandbm
  1854. v16i8:$vB))]>;
  1855. def VEXPANDHM : VXForm_RD5_XO5_RS5<1602, 1, (outs vrrc:$vD), (ins vrrc:$vB),
  1856. "vexpandhm $vD, $vB", IIC_VecGeneral,
  1857. [(set v8i16:$vD, (int_ppc_altivec_vexpandhm
  1858. v8i16:$vB))]>;
  1859. def VEXPANDWM : VXForm_RD5_XO5_RS5<1602, 2, (outs vrrc:$vD), (ins vrrc:$vB),
  1860. "vexpandwm $vD, $vB", IIC_VecGeneral,
  1861. [(set v4i32:$vD, (int_ppc_altivec_vexpandwm
  1862. v4i32:$vB))]>;
  1863. def VEXPANDDM : VXForm_RD5_XO5_RS5<1602, 3, (outs vrrc:$vD), (ins vrrc:$vB),
  1864. "vexpanddm $vD, $vB", IIC_VecGeneral,
  1865. [(set v2i64:$vD, (int_ppc_altivec_vexpanddm
  1866. v2i64:$vB))]>;
  1867. def VEXPANDQM : VXForm_RD5_XO5_RS5<1602, 4, (outs vrrc:$vD), (ins vrrc:$vB),
  1868. "vexpandqm $vD, $vB", IIC_VecGeneral,
  1869. [(set v1i128:$vD, (int_ppc_altivec_vexpandqm
  1870. v1i128:$vB))]>;
  1871. def MTVSRBM : VXForm_RD5_XO5_RS5<1602, 16, (outs vrrc:$vD), (ins g8rc:$rB),
  1872. "mtvsrbm $vD, $rB", IIC_VecGeneral,
  1873. [(set v16i8:$vD,
  1874. (int_ppc_altivec_mtvsrbm i64:$rB))]>;
  1875. def MTVSRHM : VXForm_RD5_XO5_RS5<1602, 17, (outs vrrc:$vD), (ins g8rc:$rB),
  1876. "mtvsrhm $vD, $rB", IIC_VecGeneral,
  1877. [(set v8i16:$vD,
  1878. (int_ppc_altivec_mtvsrhm i64:$rB))]>;
  1879. def MTVSRWM : VXForm_RD5_XO5_RS5<1602, 18, (outs vrrc:$vD), (ins g8rc:$rB),
  1880. "mtvsrwm $vD, $rB", IIC_VecGeneral,
  1881. [(set v4i32:$vD,
  1882. (int_ppc_altivec_mtvsrwm i64:$rB))]>;
  1883. def MTVSRDM : VXForm_RD5_XO5_RS5<1602, 19, (outs vrrc:$vD), (ins g8rc:$rB),
  1884. "mtvsrdm $vD, $rB", IIC_VecGeneral,
  1885. [(set v2i64:$vD,
  1886. (int_ppc_altivec_mtvsrdm i64:$rB))]>;
  1887. def MTVSRQM : VXForm_RD5_XO5_RS5<1602, 20, (outs vrrc:$vD), (ins g8rc:$rB),
  1888. "mtvsrqm $vD, $rB", IIC_VecGeneral,
  1889. [(set v1i128:$vD,
  1890. (int_ppc_altivec_mtvsrqm i64:$rB))]>;
  1891. def MTVSRBMI : DXForm<4, 10, (outs vrrc:$vD), (ins u16imm64:$D),
  1892. "mtvsrbmi $vD, $D", IIC_VecGeneral,
  1893. [(set v16i8:$vD,
  1894. (int_ppc_altivec_mtvsrbm imm:$D))]>;
  1895. def VCNTMBB : VXForm_RD5_MP_VB5<1602, 12, (outs g8rc:$rD),
  1896. (ins vrrc:$vB, u1imm:$MP),
  1897. "vcntmbb $rD, $vB, $MP", IIC_VecGeneral,
  1898. [(set i64:$rD, (int_ppc_altivec_vcntmbb
  1899. v16i8:$vB, timm:$MP))]>;
  1900. def VCNTMBH : VXForm_RD5_MP_VB5<1602, 13, (outs g8rc:$rD),
  1901. (ins vrrc:$vB, u1imm:$MP),
  1902. "vcntmbh $rD, $vB, $MP", IIC_VecGeneral,
  1903. [(set i64:$rD, (int_ppc_altivec_vcntmbh
  1904. v8i16:$vB, timm:$MP))]>;
  1905. def VCNTMBW : VXForm_RD5_MP_VB5<1602, 14, (outs g8rc:$rD),
  1906. (ins vrrc:$vB, u1imm:$MP),
  1907. "vcntmbw $rD, $vB, $MP", IIC_VecGeneral,
  1908. [(set i64:$rD, (int_ppc_altivec_vcntmbw
  1909. v4i32:$vB, timm:$MP))]>;
  1910. def VCNTMBD : VXForm_RD5_MP_VB5<1602, 15, (outs g8rc:$rD),
  1911. (ins vrrc:$vB, u1imm:$MP),
  1912. "vcntmbd $rD, $vB, $MP", IIC_VecGeneral,
  1913. [(set i64:$rD, (int_ppc_altivec_vcntmbd
  1914. v2i64:$vB, timm:$MP))]>;
  1915. def VEXTDUBVLX : VAForm_1a<24, (outs vrrc:$vD),
  1916. (ins vrrc:$vA, vrrc:$vB, gprc:$rC),
  1917. "vextdubvlx $vD, $vA, $vB, $rC",
  1918. IIC_VecGeneral,
  1919. [(set v2i64:$vD,
  1920. (int_ppc_altivec_vextdubvlx v16i8:$vA,
  1921. v16i8:$vB,
  1922. i32:$rC))]>;
  1923. def VEXTDUBVRX : VAForm_1a<25, (outs vrrc:$vD),
  1924. (ins vrrc:$vA, vrrc:$vB, gprc:$rC),
  1925. "vextdubvrx $vD, $vA, $vB, $rC",
  1926. IIC_VecGeneral,
  1927. [(set v2i64:$vD,
  1928. (int_ppc_altivec_vextdubvrx v16i8:$vA,
  1929. v16i8:$vB,
  1930. i32:$rC))]>;
  1931. def VEXTDUHVLX : VAForm_1a<26, (outs vrrc:$vD),
  1932. (ins vrrc:$vA, vrrc:$vB, gprc:$rC),
  1933. "vextduhvlx $vD, $vA, $vB, $rC",
  1934. IIC_VecGeneral,
  1935. [(set v2i64:$vD,
  1936. (int_ppc_altivec_vextduhvlx v8i16:$vA,
  1937. v8i16:$vB,
  1938. i32:$rC))]>;
  1939. def VEXTDUHVRX : VAForm_1a<27, (outs vrrc:$vD),
  1940. (ins vrrc:$vA, vrrc:$vB, gprc:$rC),
  1941. "vextduhvrx $vD, $vA, $vB, $rC",
  1942. IIC_VecGeneral,
  1943. [(set v2i64:$vD,
  1944. (int_ppc_altivec_vextduhvrx v8i16:$vA,
  1945. v8i16:$vB,
  1946. i32:$rC))]>;
  1947. def VEXTDUWVLX : VAForm_1a<28, (outs vrrc:$vD),
  1948. (ins vrrc:$vA, vrrc:$vB, gprc:$rC),
  1949. "vextduwvlx $vD, $vA, $vB, $rC",
  1950. IIC_VecGeneral,
  1951. [(set v2i64:$vD,
  1952. (int_ppc_altivec_vextduwvlx v4i32:$vA,
  1953. v4i32:$vB,
  1954. i32:$rC))]>;
  1955. def VEXTDUWVRX : VAForm_1a<29, (outs vrrc:$vD),
  1956. (ins vrrc:$vA, vrrc:$vB, gprc:$rC),
  1957. "vextduwvrx $vD, $vA, $vB, $rC",
  1958. IIC_VecGeneral,
  1959. [(set v2i64:$vD,
  1960. (int_ppc_altivec_vextduwvrx v4i32:$vA,
  1961. v4i32:$vB,
  1962. i32:$rC))]>;
  1963. def VEXTDDVLX : VAForm_1a<30, (outs vrrc:$vD),
  1964. (ins vrrc:$vA, vrrc:$vB, gprc:$rC),
  1965. "vextddvlx $vD, $vA, $vB, $rC",
  1966. IIC_VecGeneral,
  1967. [(set v2i64:$vD,
  1968. (int_ppc_altivec_vextddvlx v2i64:$vA,
  1969. v2i64:$vB,
  1970. i32:$rC))]>;
  1971. def VEXTDDVRX : VAForm_1a<31, (outs vrrc:$vD),
  1972. (ins vrrc:$vA, vrrc:$vB, gprc:$rC),
  1973. "vextddvrx $vD, $vA, $vB, $rC",
  1974. IIC_VecGeneral,
  1975. [(set v2i64:$vD,
  1976. (int_ppc_altivec_vextddvrx v2i64:$vA,
  1977. v2i64:$vB,
  1978. i32:$rC))]>;
  1979. def VPDEPD : VXForm_1<1485, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  1980. "vpdepd $vD, $vA, $vB", IIC_VecGeneral,
  1981. [(set v2i64:$vD,
  1982. (int_ppc_altivec_vpdepd v2i64:$vA, v2i64:$vB))]>;
  1983. def VPEXTD : VXForm_1<1421, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  1984. "vpextd $vD, $vA, $vB", IIC_VecGeneral,
  1985. [(set v2i64:$vD,
  1986. (int_ppc_altivec_vpextd v2i64:$vA, v2i64:$vB))]>;
  1987. def PDEPD : XForm_6<31, 156, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB),
  1988. "pdepd $rA, $rS, $rB", IIC_IntGeneral,
  1989. [(set i64:$rA, (int_ppc_pdepd i64:$rS, i64:$rB))]>;
  1990. def PEXTD : XForm_6<31, 188, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB),
  1991. "pextd $rA, $rS, $rB", IIC_IntGeneral,
  1992. [(set i64:$rA, (int_ppc_pextd i64:$rS, i64:$rB))]>;
  1993. def VCFUGED : VXForm_1<1357, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  1994. "vcfuged $vD, $vA, $vB", IIC_VecGeneral,
  1995. [(set v2i64:$vD,
  1996. (int_ppc_altivec_vcfuged v2i64:$vA, v2i64:$vB))]>;
  1997. def VGNB : VXForm_RD5_N3_VB5<1228, (outs g8rc:$rD), (ins vrrc:$vB, u3imm:$N),
  1998. "vgnb $rD, $vB, $N", IIC_VecGeneral,
  1999. [(set i64:$rD,
  2000. (int_ppc_altivec_vgnb v1i128:$vB, timm:$N))]>;
  2001. def CFUGED : XForm_6<31, 220, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB),
  2002. "cfuged $rA, $rS, $rB", IIC_IntGeneral,
  2003. [(set i64:$rA, (int_ppc_cfuged i64:$rS, i64:$rB))]>;
  2004. def XXEVAL :
  2005. 8RR_XX4Form_IMM8_XTAB6<34, 1, (outs vsrc:$XT), (ins vsrc:$XA, vsrc:$XB,
  2006. vsrc:$XC, u8imm:$IMM),
  2007. "xxeval $XT, $XA, $XB, $XC, $IMM", IIC_VecGeneral,
  2008. [(set v2i64:$XT, (int_ppc_vsx_xxeval v2i64:$XA,
  2009. v2i64:$XB, v2i64:$XC, timm:$IMM))]>;
  2010. def VCLZDM : VXForm_1<1924, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2011. "vclzdm $vD, $vA, $vB", IIC_VecGeneral,
  2012. [(set v2i64:$vD,
  2013. (int_ppc_altivec_vclzdm v2i64:$vA, v2i64:$vB))]>;
  2014. def VCTZDM : VXForm_1<1988, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2015. "vctzdm $vD, $vA, $vB", IIC_VecGeneral,
  2016. [(set v2i64:$vD,
  2017. (int_ppc_altivec_vctzdm v2i64:$vA, v2i64:$vB))]>;
  2018. def CNTLZDM : XForm_6<31, 59, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB),
  2019. "cntlzdm $rA, $rS, $rB", IIC_IntGeneral,
  2020. [(set i64:$rA,
  2021. (int_ppc_cntlzdm i64:$rS, i64:$rB))]>;
  2022. def CNTTZDM : XForm_6<31, 571, (outs g8rc:$rA), (ins g8rc:$rS, g8rc:$rB),
  2023. "cnttzdm $rA, $rS, $rB", IIC_IntGeneral,
  2024. [(set i64:$rA,
  2025. (int_ppc_cnttzdm i64:$rS, i64:$rB))]>;
  2026. def XXGENPCVBM :
  2027. XForm_XT6_IMM5_VB5<60, 916, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
  2028. "xxgenpcvbm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
  2029. def XXGENPCVHM :
  2030. XForm_XT6_IMM5_VB5<60, 917, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
  2031. "xxgenpcvhm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
  2032. def XXGENPCVWM :
  2033. XForm_XT6_IMM5_VB5<60, 948, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
  2034. "xxgenpcvwm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
  2035. def XXGENPCVDM :
  2036. XForm_XT6_IMM5_VB5<60, 949, (outs vsrc:$XT), (ins vrrc:$VRB, s5imm:$IMM),
  2037. "xxgenpcvdm $XT, $VRB, $IMM", IIC_VecGeneral, []>;
  2038. def VCLRLB : VXForm_1<397, (outs vrrc:$vD), (ins vrrc:$vA, gprc:$rB),
  2039. "vclrlb $vD, $vA, $rB", IIC_VecGeneral,
  2040. [(set v16i8:$vD,
  2041. (int_ppc_altivec_vclrlb v16i8:$vA, i32:$rB))]>;
  2042. def VCLRRB : VXForm_1<461, (outs vrrc:$vD), (ins vrrc:$vA, gprc:$rB),
  2043. "vclrrb $vD, $vA, $rB", IIC_VecGeneral,
  2044. [(set v16i8:$vD,
  2045. (int_ppc_altivec_vclrrb v16i8:$vA, i32:$rB))]>;
  2046. def VMULLD : VXForm_1<457, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2047. "vmulld $vD, $vA, $vB", IIC_VecGeneral,
  2048. [(set v2i64:$vD, (mul v2i64:$vA, v2i64:$vB))]>;
  2049. def VMULHSW : VXForm_1<905, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2050. "vmulhsw $vD, $vA, $vB", IIC_VecGeneral,
  2051. [(set v4i32:$vD, (mulhs v4i32:$vA, v4i32:$vB))]>;
  2052. def VMULHUW : VXForm_1<649, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2053. "vmulhuw $vD, $vA, $vB", IIC_VecGeneral,
  2054. [(set v4i32:$vD, (mulhu v4i32:$vA, v4i32:$vB))]>;
  2055. def VMULHSD : VXForm_1<969, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2056. "vmulhsd $vD, $vA, $vB", IIC_VecGeneral,
  2057. [(set v2i64:$vD, (mulhs v2i64:$vA, v2i64:$vB))]>;
  2058. def VMULHUD : VXForm_1<713, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2059. "vmulhud $vD, $vA, $vB", IIC_VecGeneral,
  2060. [(set v2i64:$vD, (mulhu v2i64:$vA, v2i64:$vB))]>;
  2061. def VMODSW : VXForm_1<1931, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2062. "vmodsw $vD, $vA, $vB", IIC_VecGeneral,
  2063. [(set v4i32:$vD, (srem v4i32:$vA, v4i32:$vB))]>;
  2064. def VMODUW : VXForm_1<1675, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2065. "vmoduw $vD, $vA, $vB", IIC_VecGeneral,
  2066. [(set v4i32:$vD, (urem v4i32:$vA, v4i32:$vB))]>;
  2067. def VMODSD : VXForm_1<1995, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2068. "vmodsd $vD, $vA, $vB", IIC_VecGeneral,
  2069. [(set v2i64:$vD, (srem v2i64:$vA, v2i64:$vB))]>;
  2070. def VMODUD : VXForm_1<1739, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2071. "vmodud $vD, $vA, $vB", IIC_VecGeneral,
  2072. [(set v2i64:$vD, (urem v2i64:$vA, v2i64:$vB))]>;
  2073. def VDIVSW : VXForm_1<395, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2074. "vdivsw $vD, $vA, $vB", IIC_VecGeneral,
  2075. [(set v4i32:$vD, (sdiv v4i32:$vA, v4i32:$vB))]>;
  2076. def VDIVUW : VXForm_1<139, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2077. "vdivuw $vD, $vA, $vB", IIC_VecGeneral,
  2078. [(set v4i32:$vD, (udiv v4i32:$vA, v4i32:$vB))]>;
  2079. def VDIVSD : VXForm_1<459, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2080. "vdivsd $vD, $vA, $vB", IIC_VecGeneral,
  2081. [(set v2i64:$vD, (sdiv v2i64:$vA, v2i64:$vB))]>;
  2082. def VDIVUD : VXForm_1<203, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2083. "vdivud $vD, $vA, $vB", IIC_VecGeneral,
  2084. [(set v2i64:$vD, (udiv v2i64:$vA, v2i64:$vB))]>;
  2085. def VDIVESW : VXForm_1<907, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2086. "vdivesw $vD, $vA, $vB", IIC_VecGeneral,
  2087. [(set v4i32:$vD, (int_ppc_altivec_vdivesw v4i32:$vA,
  2088. v4i32:$vB))]>;
  2089. def VDIVEUW : VXForm_1<651, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2090. "vdiveuw $vD, $vA, $vB", IIC_VecGeneral,
  2091. [(set v4i32:$vD, (int_ppc_altivec_vdiveuw v4i32:$vA,
  2092. v4i32:$vB))]>;
  2093. def VDIVESD : VXForm_1<971, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2094. "vdivesd $vD, $vA, $vB", IIC_VecGeneral,
  2095. [(set v2i64:$vD, (int_ppc_altivec_vdivesd v2i64:$vA,
  2096. v2i64:$vB))]>;
  2097. def VDIVEUD : VXForm_1<715, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2098. "vdiveud $vD, $vA, $vB", IIC_VecGeneral,
  2099. [(set v2i64:$vD, (int_ppc_altivec_vdiveud v2i64:$vA,
  2100. v2i64:$vB))]>;
  2101. def XVTLSBB : XX2_BF3_XO5_XB6_XO9<60, 2, 475, (outs crrc:$BF), (ins vsrc:$XB),
  2102. "xvtlsbb $BF, $XB", IIC_VecGeneral, []>;
  2103. // The XFormMemOp flag for the following 8 instructions is set on
  2104. // the instruction format.
  2105. let mayLoad = 1, mayStore = 0 in {
  2106. def LXVRBX : X_XT6_RA5_RB5<31, 13, "lxvrbx", vsrc, []>;
  2107. def LXVRHX : X_XT6_RA5_RB5<31, 45, "lxvrhx", vsrc, []>;
  2108. def LXVRWX : X_XT6_RA5_RB5<31, 77, "lxvrwx", vsrc, []>;
  2109. def LXVRDX : X_XT6_RA5_RB5<31, 109, "lxvrdx", vsrc, []>;
  2110. }
  2111. let mayLoad = 0, mayStore = 1 in {
  2112. def STXVRBX : X_XS6_RA5_RB5<31, 141, "stxvrbx", vsrc, []>;
  2113. def STXVRHX : X_XS6_RA5_RB5<31, 173, "stxvrhx", vsrc, []>;
  2114. def STXVRWX : X_XS6_RA5_RB5<31, 205, "stxvrwx", vsrc, []>;
  2115. def STXVRDX : X_XS6_RA5_RB5<31, 237, "stxvrdx", vsrc, []>;
  2116. }
  2117. def VMULESD : VXForm_1<968, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2118. "vmulesd $vD, $vA, $vB", IIC_VecGeneral,
  2119. [(set v1i128:$vD, (int_ppc_altivec_vmulesd v2i64:$vA,
  2120. v2i64:$vB))]>;
  2121. def VMULEUD : VXForm_1<712, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2122. "vmuleud $vD, $vA, $vB", IIC_VecGeneral,
  2123. [(set v1i128:$vD, (int_ppc_altivec_vmuleud v2i64:$vA,
  2124. v2i64:$vB))]>;
  2125. def VMULOSD : VXForm_1<456, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2126. "vmulosd $vD, $vA, $vB", IIC_VecGeneral,
  2127. [(set v1i128:$vD, (int_ppc_altivec_vmulosd v2i64:$vA,
  2128. v2i64:$vB))]>;
  2129. def VMULOUD : VXForm_1<200, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2130. "vmuloud $vD, $vA, $vB", IIC_VecGeneral,
  2131. [(set v1i128:$vD, (int_ppc_altivec_vmuloud v2i64:$vA,
  2132. v2i64:$vB))]>;
  2133. def VMSUMCUD : VAForm_1a<23, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB, vrrc:$vC),
  2134. "vmsumcud $vD, $vA, $vB, $vC", IIC_VecGeneral,
  2135. [(set v1i128:$vD, (int_ppc_altivec_vmsumcud
  2136. v2i64:$vA, v2i64:$vB, v1i128:$vC))]>;
  2137. def VDIVSQ : VXForm_1<267, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2138. "vdivsq $vD, $vA, $vB", IIC_VecGeneral,
  2139. [(set v1i128:$vD, (sdiv v1i128:$vA, v1i128:$vB))]>;
  2140. def VDIVUQ : VXForm_1<11, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2141. "vdivuq $vD, $vA, $vB", IIC_VecGeneral,
  2142. [(set v1i128:$vD, (udiv v1i128:$vA, v1i128:$vB))]>;
  2143. def VDIVESQ : VXForm_1<779, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2144. "vdivesq $vD, $vA, $vB", IIC_VecGeneral,
  2145. [(set v1i128:$vD, (int_ppc_altivec_vdivesq v1i128:$vA,
  2146. v1i128:$vB))]>;
  2147. def VDIVEUQ : VXForm_1<523, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2148. "vdiveuq $vD, $vA, $vB", IIC_VecGeneral,
  2149. [(set v1i128:$vD, (int_ppc_altivec_vdiveuq v1i128:$vA,
  2150. v1i128:$vB))]>;
  2151. def VCMPEQUQ : VCMP <455, "vcmpequq $vD, $vA, $vB" , v1i128>;
  2152. def VCMPGTSQ : VCMP <903, "vcmpgtsq $vD, $vA, $vB" , v1i128>;
  2153. def VCMPGTUQ : VCMP <647, "vcmpgtuq $vD, $vA, $vB" , v1i128>;
  2154. def VCMPEQUQ_rec : VCMP_rec <455, "vcmpequq. $vD, $vA, $vB" , v1i128>;
  2155. def VCMPGTSQ_rec : VCMP_rec <903, "vcmpgtsq. $vD, $vA, $vB" , v1i128>;
  2156. def VCMPGTUQ_rec : VCMP_rec <647, "vcmpgtuq. $vD, $vA, $vB" , v1i128>;
  2157. def VMODSQ : VXForm_1<1803, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2158. "vmodsq $vD, $vA, $vB", IIC_VecGeneral,
  2159. [(set v1i128:$vD, (srem v1i128:$vA, v1i128:$vB))]>;
  2160. def VMODUQ : VXForm_1<1547, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
  2161. "vmoduq $vD, $vA, $vB", IIC_VecGeneral,
  2162. [(set v1i128:$vD, (urem v1i128:$vA, v1i128:$vB))]>;
  2163. def VEXTSD2Q : VXForm_RD5_XO5_RS5<1538, 27, (outs vrrc:$vD), (ins vrrc:$vB),
  2164. "vextsd2q $vD, $vB", IIC_VecGeneral,
  2165. [(set v1i128:$vD, (int_ppc_altivec_vextsd2q v2i64:$vB))]>;
  2166. def VCMPUQ : VXForm_BF3_VAB5<257, (outs crrc:$BF), (ins vrrc:$vA, vrrc:$vB),
  2167. "vcmpuq $BF, $vA, $vB", IIC_VecGeneral, []>;
  2168. def VCMPSQ : VXForm_BF3_VAB5<321, (outs crrc:$BF), (ins vrrc:$vA, vrrc:$vB),
  2169. "vcmpsq $BF, $vA, $vB", IIC_VecGeneral, []>;
  2170. def VRLQNM : VX1_VT5_VA5_VB5<325, "vrlqnm",
  2171. [(set v1i128:$vD,
  2172. (int_ppc_altivec_vrlqnm v1i128:$vA,
  2173. v1i128:$vB))]>;
  2174. def VRLQMI : VXForm_1<69, (outs vrrc:$vD),
  2175. (ins vrrc:$vA, vrrc:$vB, vrrc:$vDi),
  2176. "vrlqmi $vD, $vA, $vB", IIC_VecFP,
  2177. [(set v1i128:$vD,
  2178. (int_ppc_altivec_vrlqmi v1i128:$vA, v1i128:$vB,
  2179. v1i128:$vDi))]>,
  2180. RegConstraint<"$vDi = $vD">, NoEncode<"$vDi">;
  2181. def VSLQ : VX1_VT5_VA5_VB5<261, "vslq", []>;
  2182. def VSRAQ : VX1_VT5_VA5_VB5<773, "vsraq", []>;
  2183. def VSRQ : VX1_VT5_VA5_VB5<517, "vsrq", []>;
  2184. def VRLQ : VX1_VT5_VA5_VB5<5, "vrlq", []>;
  2185. def XSCVQPUQZ : X_VT5_XO5_VB5<63, 0, 836, "xscvqpuqz", []>;
  2186. def XSCVQPSQZ : X_VT5_XO5_VB5<63, 8, 836, "xscvqpsqz", []>;
  2187. def XSCVUQQP : X_VT5_XO5_VB5<63, 3, 836, "xscvuqqp", []>;
  2188. def XSCVSQQP : X_VT5_XO5_VB5<63, 11, 836, "xscvsqqp", []>;
  2189. }
  2190. let Predicates = [IsISA3_1, HasVSX] in {
  2191. def XVCVSPBF16 : XX2_XT6_XO5_XB6<60, 17, 475, "xvcvspbf16", vsrc, []>;
  2192. def XVCVBF16SPN : XX2_XT6_XO5_XB6<60, 16, 475, "xvcvbf16spn", vsrc, []>;
  2193. def XSMAXCQP : X_VT5_VA5_VB5<63, 676, "xsmaxcqp", []>;
  2194. def XSMINCQP : X_VT5_VA5_VB5<63, 740, "xsmincqp", []>;
  2195. }
  2196. // Multiclass defining patterns for Set Boolean Extension Reverse Instructions.
  2197. // This is analogous to the CRNotPat multiclass but specifically for Power10
  2198. // and newer subtargets since the extended forms use Set Boolean instructions.
  2199. // The first two anonymous patterns defined are actually a duplicate of those
  2200. // in CRNotPat, but it is preferable to define both multiclasses as complete
  2201. // ones rather than pulling that small common section out.
  2202. multiclass P10ReverseSetBool<dag pattern, dag result> {
  2203. def : Pat<pattern, (crnot result)>;
  2204. def : Pat<(not pattern), result>;
  2205. def : Pat<(i32 (zext pattern)),
  2206. (SETBCR result)>;
  2207. def : Pat<(i64 (zext pattern)),
  2208. (SETBCR8 result)>;
  2209. def : Pat<(i32 (sext pattern)),
  2210. (SETNBCR result)>;
  2211. def : Pat<(i64 (sext pattern)),
  2212. (SETNBCR8 result)>;
  2213. def : Pat<(i32 (anyext pattern)),
  2214. (SETBCR result)>;
  2215. def : Pat<(i64 (anyext pattern)),
  2216. (SETBCR8 result)>;
  2217. }
  2218. multiclass IntSetP10RevSetBool<SDNode SetCC, ValueType Ty, PatLeaf ZExtTy,
  2219. ImmLeaf SExtTy, I Cmpi, I Cmpli,
  2220. I Cmp, I Cmpl> {
  2221. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETUGE)),
  2222. (EXTRACT_SUBREG (Cmpl $s1, $s2), sub_lt)>;
  2223. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETGE)),
  2224. (EXTRACT_SUBREG (Cmp $s1, $s2), sub_lt)>;
  2225. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETULE)),
  2226. (EXTRACT_SUBREG (Cmpl $s1, $s2), sub_gt)>;
  2227. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETLE)),
  2228. (EXTRACT_SUBREG (Cmp $s1, $s2), sub_gt)>;
  2229. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETNE)),
  2230. (EXTRACT_SUBREG (Cmp $s1, $s2), sub_eq)>;
  2231. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, ZExtTy:$imm, SETUGE)),
  2232. (EXTRACT_SUBREG (Cmpli $s1, imm:$imm), sub_lt)>;
  2233. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, SExtTy:$imm, SETGE)),
  2234. (EXTRACT_SUBREG (Cmpi $s1, imm:$imm), sub_lt)>;
  2235. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, ZExtTy:$imm, SETULE)),
  2236. (EXTRACT_SUBREG (Cmpli $s1, imm:$imm), sub_gt)>;
  2237. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, SExtTy:$imm, SETLE)),
  2238. (EXTRACT_SUBREG (Cmpi $s1, imm:$imm), sub_gt)>;
  2239. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, SExtTy:$imm, SETNE)),
  2240. (EXTRACT_SUBREG (Cmpi $s1, imm:$imm), sub_eq)>;
  2241. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, ZExtTy:$imm, SETNE)),
  2242. (EXTRACT_SUBREG (Cmpli $s1, imm:$imm), sub_eq)>;
  2243. }
  2244. multiclass FSetP10RevSetBool<SDNode SetCC, ValueType Ty, I FCmp> {
  2245. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETUGE)),
  2246. (EXTRACT_SUBREG (FCmp $s1, $s2), sub_lt)>;
  2247. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETGE)),
  2248. (EXTRACT_SUBREG (FCmp $s1, $s2), sub_lt)>;
  2249. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETULE)),
  2250. (EXTRACT_SUBREG (FCmp $s1, $s2), sub_gt)>;
  2251. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETLE)),
  2252. (EXTRACT_SUBREG (FCmp $s1, $s2), sub_gt)>;
  2253. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETUNE)),
  2254. (EXTRACT_SUBREG (FCmp $s1, $s2), sub_eq)>;
  2255. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETNE)),
  2256. (EXTRACT_SUBREG (FCmp $s1, $s2), sub_eq)>;
  2257. defm : P10ReverseSetBool<(i1 (SetCC Ty:$s1, Ty:$s2, SETO)),
  2258. (EXTRACT_SUBREG (FCmp $s1, $s2), sub_un)>;
  2259. }
  2260. let Predicates = [IsISA3_1] in {
  2261. def : Pat<(i32 (zext i1:$in)),
  2262. (SETBC $in)>;
  2263. def : Pat<(i64 (zext i1:$in)),
  2264. (SETBC8 $in)>;
  2265. def : Pat<(i32 (sext i1:$in)),
  2266. (SETNBC $in)>;
  2267. def : Pat<(i64 (sext i1:$in)),
  2268. (SETNBC8 $in)>;
  2269. def : Pat<(i32 (anyext i1:$in)),
  2270. (SETBC $in)>;
  2271. def : Pat<(i64 (anyext i1:$in)),
  2272. (SETBC8 $in)>;
  2273. // Instantiation of the set boolean reverse patterns for 32-bit integers.
  2274. defm : IntSetP10RevSetBool<setcc, i32, immZExt16, imm32SExt16,
  2275. CMPWI, CMPLWI, CMPW, CMPLW>;
  2276. defm : P10ReverseSetBool<(i1 (setcc i32:$s1, imm:$imm, SETNE)),
  2277. (EXTRACT_SUBREG (CMPLWI (XORIS $s1, (HI16 imm:$imm)),
  2278. (LO16 imm:$imm)), sub_eq)>;
  2279. // Instantiation of the set boolean reverse patterns for 64-bit integers.
  2280. defm : IntSetP10RevSetBool<setcc, i64, immZExt16, imm64SExt16,
  2281. CMPDI, CMPLDI, CMPD, CMPLD>;
  2282. defm : P10ReverseSetBool<(i1 (setcc i64:$s1, imm64ZExt32:$imm, SETNE)),
  2283. (EXTRACT_SUBREG (CMPLDI (XORIS8 $s1, (HI16 imm:$imm)),
  2284. (LO16 imm:$imm)), sub_eq)>;
  2285. }
  2286. // Instantiation of the set boolean reverse patterns for f32, f64, f128.
  2287. let Predicates = [IsISA3_1, HasFPU] in {
  2288. defm : FSetP10RevSetBool<setcc, f32, FCMPUS>;
  2289. defm : FSetP10RevSetBool<setcc, f64, FCMPUD>;
  2290. defm : FSetP10RevSetBool<setcc, f128, XSCMPUQP>;
  2291. }
  2292. //---------------------------- Anonymous Patterns ----------------------------//
  2293. let Predicates = [IsISA3_1] in {
  2294. // Exploit the vector multiply high instructions using intrinsics.
  2295. def : Pat<(v4i32 (int_ppc_altivec_vmulhsw v4i32:$vA, v4i32:$vB)),
  2296. (v4i32 (VMULHSW $vA, $vB))>;
  2297. def : Pat<(v4i32 (int_ppc_altivec_vmulhuw v4i32:$vA, v4i32:$vB)),
  2298. (v4i32 (VMULHUW $vA, $vB))>;
  2299. def : Pat<(v2i64 (int_ppc_altivec_vmulhsd v2i64:$vA, v2i64:$vB)),
  2300. (v2i64 (VMULHSD $vA, $vB))>;
  2301. def : Pat<(v2i64 (int_ppc_altivec_vmulhud v2i64:$vA, v2i64:$vB)),
  2302. (v2i64 (VMULHUD $vA, $vB))>;
  2303. def : Pat<(v16i8 (int_ppc_vsx_xxgenpcvbm v16i8:$VRB, imm:$IMM)),
  2304. (v16i8 (COPY_TO_REGCLASS (XXGENPCVBM $VRB, imm:$IMM), VRRC))>;
  2305. def : Pat<(v8i16 (int_ppc_vsx_xxgenpcvhm v8i16:$VRB, imm:$IMM)),
  2306. (v8i16 (COPY_TO_REGCLASS (XXGENPCVHM $VRB, imm:$IMM), VRRC))>;
  2307. def : Pat<(v4i32 (int_ppc_vsx_xxgenpcvwm v4i32:$VRB, imm:$IMM)),
  2308. (v4i32 (COPY_TO_REGCLASS (XXGENPCVWM $VRB, imm:$IMM), VRRC))>;
  2309. def : Pat<(v2i64 (int_ppc_vsx_xxgenpcvdm v2i64:$VRB, imm:$IMM)),
  2310. (v2i64 (COPY_TO_REGCLASS (XXGENPCVDM $VRB, imm:$IMM), VRRC))>;
  2311. def : Pat<(i32 (int_ppc_vsx_xvtlsbb v16i8:$XB, 1)),
  2312. (EXTRACT_SUBREG (XVTLSBB (COPY_TO_REGCLASS $XB, VSRC)), sub_lt)>;
  2313. def : Pat<(i32 (int_ppc_vsx_xvtlsbb v16i8:$XB, 0)),
  2314. (EXTRACT_SUBREG (XVTLSBB (COPY_TO_REGCLASS $XB, VSRC)), sub_eq)>;
  2315. def : Pat <(v1i128 (PPClxvrzx ForceXForm:$src, 8)),
  2316. (v1i128 (COPY_TO_REGCLASS (LXVRBX ForceXForm:$src), VRRC))>;
  2317. def : Pat <(v1i128 (PPClxvrzx ForceXForm:$src, 16)),
  2318. (v1i128 (COPY_TO_REGCLASS (LXVRHX ForceXForm:$src), VRRC))>;
  2319. def : Pat <(v1i128 (PPClxvrzx ForceXForm:$src, 32)),
  2320. (v1i128 (COPY_TO_REGCLASS (LXVRWX ForceXForm:$src), VRRC))>;
  2321. def : Pat <(v1i128 (PPClxvrzx ForceXForm:$src, 64)),
  2322. (v1i128 (COPY_TO_REGCLASS (LXVRDX ForceXForm:$src), VRRC))>;
  2323. def : Pat<(v1i128 (rotl v1i128:$vA, v1i128:$vB)),
  2324. (v1i128 (VRLQ v1i128:$vA, v1i128:$vB))>;
  2325. def : Pat <(v2i64 (PPCxxsplti32dx v2i64:$XT, i32:$XI, i32:$IMM32)),
  2326. (v2i64 (XXSPLTI32DX v2i64:$XT, i32:$XI, i32:$IMM32))>;
  2327. }
  2328. let Predicates = [IsISA3_1, HasVSX] in {
  2329. def : Pat<(v16i8 (int_ppc_vsx_xvcvspbf16 v16i8:$XA)),
  2330. (COPY_TO_REGCLASS (XVCVSPBF16 RCCp.AToVSRC), VRRC)>;
  2331. def : Pat<(v16i8 (int_ppc_vsx_xvcvbf16spn v16i8:$XA)),
  2332. (COPY_TO_REGCLASS (XVCVBF16SPN RCCp.AToVSRC), VRRC)>;
  2333. }
  2334. let AddedComplexity = 400, Predicates = [IsISA3_1, IsLittleEndian] in {
  2335. // Store element 0 of a VSX register to memory
  2336. def : Pat<(truncstorei8 (i32 (vector_extract v16i8:$src, 0)), ForceXForm:$dst),
  2337. (STXVRBX (COPY_TO_REGCLASS v16i8:$src, VSRC), ForceXForm:$dst)>;
  2338. def : Pat<(truncstorei16 (i32 (vector_extract v8i16:$src, 0)), ForceXForm:$dst),
  2339. (STXVRHX (COPY_TO_REGCLASS v8i16:$src, VSRC), ForceXForm:$dst)>;
  2340. def : Pat<(store (i32 (extractelt v4i32:$src, 0)), ForceXForm:$dst),
  2341. (STXVRWX $src, ForceXForm:$dst)>;
  2342. def : Pat<(store (f32 (extractelt v4f32:$src, 0)), ForceXForm:$dst),
  2343. (STXVRWX $src, ForceXForm:$dst)>;
  2344. def : Pat<(store (i64 (extractelt v2i64:$src, 0)), ForceXForm:$dst),
  2345. (STXVRDX $src, ForceXForm:$dst)>;
  2346. def : Pat<(store (f64 (extractelt v2f64:$src, 0)), ForceXForm:$dst),
  2347. (STXVRDX $src, ForceXForm:$dst)>;
  2348. // Load element 0 of a VSX register to memory
  2349. def : Pat<(v8i16 (scalar_to_vector (i32 (extloadi16 ForceXForm:$src)))),
  2350. (v8i16 (COPY_TO_REGCLASS (LXVRHX ForceXForm:$src), VSRC))>;
  2351. def : Pat<(v16i8 (scalar_to_vector (i32 (extloadi8 ForceXForm:$src)))),
  2352. (v16i8 (COPY_TO_REGCLASS (LXVRBX ForceXForm:$src), VSRC))>;
  2353. }
  2354. // FIXME: The swap is overkill when the shift amount is a constant.
  2355. // We should just fix the constant in the DAG.
  2356. let AddedComplexity = 400, Predicates = [IsISA3_1, HasVSX] in {
  2357. def : Pat<(v1i128 (shl v1i128:$VRA, v1i128:$VRB)),
  2358. (v1i128 (VSLQ v1i128:$VRA,
  2359. (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
  2360. (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
  2361. def : Pat<(v1i128 (PPCshl v1i128:$VRA, v1i128:$VRB)),
  2362. (v1i128 (VSLQ v1i128:$VRA,
  2363. (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
  2364. (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
  2365. def : Pat<(v1i128 (srl v1i128:$VRA, v1i128:$VRB)),
  2366. (v1i128 (VSRQ v1i128:$VRA,
  2367. (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
  2368. (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
  2369. def : Pat<(v1i128 (PPCsrl v1i128:$VRA, v1i128:$VRB)),
  2370. (v1i128 (VSRQ v1i128:$VRA,
  2371. (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
  2372. (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
  2373. def : Pat<(v1i128 (sra v1i128:$VRA, v1i128:$VRB)),
  2374. (v1i128 (VSRAQ v1i128:$VRA,
  2375. (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
  2376. (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
  2377. def : Pat<(v1i128 (PPCsra v1i128:$VRA, v1i128:$VRB)),
  2378. (v1i128 (VSRAQ v1i128:$VRA,
  2379. (XXPERMDI (COPY_TO_REGCLASS $VRB, VSRC),
  2380. (COPY_TO_REGCLASS $VRB, VSRC), 2)))>;
  2381. }
  2382. class xxevalPattern <dag pattern, bits<8> imm> :
  2383. Pat<(v4i32 pattern), (XXEVAL $vA, $vB, $vC, imm)> {}
  2384. let AddedComplexity = 400, Predicates = [PrefixInstrs] in {
  2385. def : Pat<(v4i32 (build_vector i32immNonAllOneNonZero:$A,
  2386. i32immNonAllOneNonZero:$A,
  2387. i32immNonAllOneNonZero:$A,
  2388. i32immNonAllOneNonZero:$A)),
  2389. (v4i32 (XXSPLTIW imm:$A))>;
  2390. def : Pat<(f32 nzFPImmAsi32:$A),
  2391. (COPY_TO_REGCLASS (XXSPLTIDP (getFPAs32BitInt fpimm:$A)),
  2392. VSFRC)>;
  2393. def : Pat<(f64 nzFPImmAsi32:$A),
  2394. (COPY_TO_REGCLASS (XXSPLTIDP (getFPAs32BitInt fpimm:$A)),
  2395. VSFRC)>;
  2396. // To replace constant pool with XXSPLTI32DX for scalars.
  2397. def : Pat<(f32 nzFPImmAsi64:$A),
  2398. (COPY_TO_REGCLASS (XXSPLTI32DX (XXSPLTI32DX(IMPLICIT_DEF), 0,
  2399. (getFPAs64BitIntHi $A)),
  2400. 1, (getFPAs64BitIntLo $A)),
  2401. VSSRC)>;
  2402. def : Pat<(f64 nzFPImmAsi64:$A),
  2403. (COPY_TO_REGCLASS (XXSPLTI32DX (XXSPLTI32DX (IMPLICIT_DEF), 0,
  2404. (getFPAs64BitIntHi $A)),
  2405. 1, (getFPAs64BitIntLo $A)),
  2406. VSFRC)>;
  2407. // Anonymous patterns for XXEVAL
  2408. // AND
  2409. // and(A, B, C)
  2410. def : xxevalPattern<(and v4i32:$vA, (and v4i32:$vB, v4i32:$vC)), 1>;
  2411. // and(A, xor(B, C))
  2412. def : xxevalPattern<(and v4i32:$vA, (xor v4i32:$vB, v4i32:$vC)), 6>;
  2413. // and(A, or(B, C))
  2414. def : xxevalPattern<(and v4i32:$vA, (or v4i32:$vB, v4i32:$vC)), 7>;
  2415. // and(A, nor(B, C))
  2416. def : xxevalPattern<(and v4i32:$vA, (vnot (or v4i32:$vB, v4i32:$vC))), 8>;
  2417. // and(A, eqv(B, C))
  2418. def : xxevalPattern<(and v4i32:$vA, (vnot (xor v4i32:$vB, v4i32:$vC))), 9>;
  2419. // and(A, nand(B, C))
  2420. def : xxevalPattern<(and v4i32:$vA, (vnot (and v4i32:$vB, v4i32:$vC))), 14>;
  2421. // NAND
  2422. // nand(A, B, C)
  2423. def : xxevalPattern<(vnot (and v4i32:$vA, (and v4i32:$vB, v4i32:$vC))),
  2424. !sub(255, 1)>;
  2425. // nand(A, xor(B, C))
  2426. def : xxevalPattern<(vnot (and v4i32:$vA, (xor v4i32:$vB, v4i32:$vC))),
  2427. !sub(255, 6)>;
  2428. // nand(A, or(B, C))
  2429. def : xxevalPattern<(vnot (and v4i32:$vA, (or v4i32:$vB, v4i32:$vC))),
  2430. !sub(255, 7)>;
  2431. // nand(A, nor(B, C))
  2432. def : xxevalPattern<(or (vnot v4i32:$vA), (or v4i32:$vB, v4i32:$vC)),
  2433. !sub(255, 8)>;
  2434. // nand(A, eqv(B, C))
  2435. def : xxevalPattern<(or (vnot v4i32:$vA), (xor v4i32:$vB, v4i32:$vC)),
  2436. !sub(255, 9)>;
  2437. // nand(A, nand(B, C))
  2438. def : xxevalPattern<(or (vnot v4i32:$vA), (and v4i32:$vB, v4i32:$vC)),
  2439. !sub(255, 14)>;
  2440. // Anonymous patterns to select prefixed VSX loads and stores.
  2441. // Load / Store f128
  2442. def : Pat<(f128 (load PDForm:$src)),
  2443. (COPY_TO_REGCLASS (PLXV memri34:$src), VRRC)>;
  2444. def : Pat<(store f128:$XS, PDForm:$dst),
  2445. (PSTXV (COPY_TO_REGCLASS $XS, VSRC), memri34:$dst)>;
  2446. // Load / Store v4i32
  2447. def : Pat<(v4i32 (load PDForm:$src)), (PLXV memri34:$src)>;
  2448. def : Pat<(store v4i32:$XS, PDForm:$dst), (PSTXV $XS, memri34:$dst)>;
  2449. // Load / Store v2i64
  2450. def : Pat<(v2i64 (load PDForm:$src)), (PLXV memri34:$src)>;
  2451. def : Pat<(store v2i64:$XS, PDForm:$dst), (PSTXV $XS, memri34:$dst)>;
  2452. // Load / Store v4f32
  2453. def : Pat<(v4f32 (load PDForm:$src)), (PLXV memri34:$src)>;
  2454. def : Pat<(store v4f32:$XS, PDForm:$dst), (PSTXV $XS, memri34:$dst)>;
  2455. // Load / Store v2f64
  2456. def : Pat<(v2f64 (load PDForm:$src)), (PLXV memri34:$src)>;
  2457. def : Pat<(store v2f64:$XS, PDForm:$dst), (PSTXV $XS, memri34:$dst)>;
  2458. // Cases For PPCstore_scal_int_from_vsr
  2459. def : Pat<(PPCstore_scal_int_from_vsr
  2460. (f64 (PPCcv_fp_to_uint_in_vsr f64:$src)), PDForm:$dst, 8),
  2461. (PSTXSD (XSCVDPUXDS f64:$src), PDForm:$dst)>;
  2462. def : Pat<(PPCstore_scal_int_from_vsr
  2463. (f64 (PPCcv_fp_to_sint_in_vsr f64:$src)), PDForm:$dst, 8),
  2464. (PSTXSD (XSCVDPSXDS f64:$src), PDForm:$dst)>;
  2465. def : Pat<(PPCstore_scal_int_from_vsr
  2466. (f64 (PPCcv_fp_to_uint_in_vsr f128:$src)), PDForm:$dst, 8),
  2467. (PSTXSD (COPY_TO_REGCLASS (XSCVQPUDZ f128:$src), VFRC),
  2468. PDForm:$dst)>;
  2469. def : Pat<(PPCstore_scal_int_from_vsr
  2470. (f64 (PPCcv_fp_to_sint_in_vsr f128:$src)), PDForm:$dst, 8),
  2471. (PSTXSD (COPY_TO_REGCLASS (XSCVQPSDZ f128:$src), VFRC),
  2472. PDForm:$dst)>;
  2473. }
  2474. let Predicates = [PrefixInstrs] in {
  2475. def : Pat<(i32 imm34:$imm), (PLI (getImmAs64BitInt imm:$imm))>;
  2476. def : Pat<(i64 imm34:$imm), (PLI8 (getImmAs64BitInt imm:$imm))>;
  2477. def : Pat<(v16i8 (int_ppc_vsx_xxpermx v16i8:$A, v16i8:$B, v16i8:$C, timm:$D)),
  2478. (COPY_TO_REGCLASS (XXPERMX (COPY_TO_REGCLASS $A, VSRC),
  2479. (COPY_TO_REGCLASS $B, VSRC),
  2480. (COPY_TO_REGCLASS $C, VSRC), $D), VSRC)>;
  2481. def : Pat<(v16i8 (int_ppc_vsx_xxblendvb v16i8:$A, v16i8:$B, v16i8:$C)),
  2482. (COPY_TO_REGCLASS
  2483. (XXBLENDVB (COPY_TO_REGCLASS $A, VSRC),
  2484. (COPY_TO_REGCLASS $B, VSRC),
  2485. (COPY_TO_REGCLASS $C, VSRC)), VSRC)>;
  2486. def : Pat<(v8i16 (int_ppc_vsx_xxblendvh v8i16:$A, v8i16:$B, v8i16:$C)),
  2487. (COPY_TO_REGCLASS
  2488. (XXBLENDVH (COPY_TO_REGCLASS $A, VSRC),
  2489. (COPY_TO_REGCLASS $B, VSRC),
  2490. (COPY_TO_REGCLASS $C, VSRC)), VSRC)>;
  2491. def : Pat<(int_ppc_vsx_xxblendvw v4i32:$A, v4i32:$B, v4i32:$C),
  2492. (XXBLENDVW $A, $B, $C)>;
  2493. def : Pat<(int_ppc_vsx_xxblendvd v2i64:$A, v2i64:$B, v2i64:$C),
  2494. (XXBLENDVD $A, $B, $C)>;
  2495. // Anonymous patterns to select prefixed loads and stores.
  2496. // Load i32
  2497. def : Pat<(i32 (extloadi1 PDForm:$src)), (PLBZ memri34:$src)>;
  2498. def : Pat<(i32 (zextloadi1 PDForm:$src)), (PLBZ memri34:$src)>;
  2499. def : Pat<(i32 (extloadi8 PDForm:$src)), (PLBZ memri34:$src)>;
  2500. def : Pat<(i32 (zextloadi8 PDForm:$src)), (PLBZ memri34:$src)>;
  2501. def : Pat<(i32 (extloadi16 PDForm:$src)), (PLHZ memri34:$src)>;
  2502. def : Pat<(i32 (zextloadi16 PDForm:$src)), (PLHZ memri34:$src)>;
  2503. def : Pat<(i32 (sextloadi16 PDForm:$src)), (PLHA memri34:$src)>;
  2504. def : Pat<(i32 (load PDForm:$src)), (PLWZ memri34:$src)>;
  2505. // Store i32
  2506. def : Pat<(truncstorei8 i32:$rS, PDForm:$dst), (PSTB gprc:$rS, memri34:$dst)>;
  2507. def : Pat<(truncstorei16 i32:$rS, PDForm:$dst), (PSTH gprc:$rS, memri34:$dst)>;
  2508. def : Pat<(store i32:$rS, PDForm:$dst), (PSTW gprc:$rS, memri34:$dst)>;
  2509. // Load i64
  2510. def : Pat<(i64 (extloadi1 PDForm:$src)), (PLBZ8 memri34:$src)>;
  2511. def : Pat<(i64 (zextloadi1 PDForm:$src)), (PLBZ8 memri34:$src)>;
  2512. def : Pat<(i64 (extloadi8 PDForm:$src)), (PLBZ8 memri34:$src)>;
  2513. def : Pat<(i64 (zextloadi8 PDForm:$src)), (PLBZ8 memri34:$src)>;
  2514. def : Pat<(i64 (extloadi16 PDForm:$src)), (PLHZ8 memri34:$src)>;
  2515. def : Pat<(i64 (zextloadi16 PDForm:$src)), (PLHZ8 memri34:$src)>;
  2516. def : Pat<(i64 (sextloadi16 PDForm:$src)), (PLHA8 memri34:$src)>;
  2517. def : Pat<(i64 (extloadi32 PDForm:$src)), (PLWZ8 memri34:$src)>;
  2518. def : Pat<(i64 (zextloadi32 PDForm:$src)), (PLWZ8 memri34:$src)>;
  2519. def : Pat<(i64 (sextloadi32 PDForm:$src)), (PLWA8 memri34:$src)>;
  2520. def : Pat<(i64 (load PDForm:$src)), (PLD memri34:$src)>;
  2521. // Store i64
  2522. def : Pat<(truncstorei8 i64:$rS, PDForm:$dst), (PSTB8 g8rc:$rS, memri34:$dst)>;
  2523. def : Pat<(truncstorei16 i64:$rS, PDForm:$dst), (PSTH8 g8rc:$rS, memri34:$dst)>;
  2524. def : Pat<(truncstorei32 i64:$rS, PDForm:$dst), (PSTW8 g8rc:$rS, memri34:$dst)>;
  2525. def : Pat<(store i64:$rS, PDForm:$dst), (PSTD g8rc:$rS, memri34:$dst)>;
  2526. // Load / Store f32
  2527. def : Pat<(f32 (load PDForm:$src)), (PLFS memri34:$src)>;
  2528. def : Pat<(store f32:$FRS, PDForm:$dst), (PSTFS $FRS, memri34:$dst)>;
  2529. // Load / Store f64
  2530. def : Pat<(f64 (extloadf32 PDForm:$src)),
  2531. (COPY_TO_REGCLASS (PLFS memri34:$src), VSFRC)>;
  2532. def : Pat<(f64 (load PDForm:$src)), (PLFD memri34:$src)>;
  2533. def : Pat<(store f64:$FRS, PDForm:$dst), (PSTFD $FRS, memri34:$dst)>;
  2534. // Atomic Load
  2535. def : Pat<(atomic_load_8 PDForm:$src), (PLBZ memri34:$src)>;
  2536. def : Pat<(atomic_load_16 PDForm:$src), (PLHZ memri34:$src)>;
  2537. def : Pat<(atomic_load_32 PDForm:$src), (PLWZ memri34:$src)>;
  2538. def : Pat<(atomic_load_64 PDForm:$src), (PLD memri34:$src)>;
  2539. // Atomic Store
  2540. def : Pat<(atomic_store_8 PDForm:$dst, i32:$RS), (PSTB $RS, memri34:$dst)>;
  2541. def : Pat<(atomic_store_16 PDForm:$dst, i32:$RS), (PSTH $RS, memri34:$dst)>;
  2542. def : Pat<(atomic_store_32 PDForm:$dst, i32:$RS), (PSTW $RS, memri34:$dst)>;
  2543. def : Pat<(atomic_store_64 PDForm:$dst, i64:$RS), (PSTD $RS, memri34:$dst)>;
  2544. // Prefixed fpext to v2f64
  2545. def : Pat<(v4f32 (PPCldvsxlh PDForm:$src)),
  2546. (SUBREG_TO_REG (i64 1), (PLFD PDForm:$src), sub_64)>;
  2547. }
  2548. def InsertEltShift {
  2549. dag Sub32 = (i32 (EXTRACT_SUBREG $rB, sub_32));
  2550. dag Sub32Left1 = (RLWINM (EXTRACT_SUBREG $rB, sub_32), 1, 0, 30);
  2551. dag Sub32Left2 = (RLWINM (EXTRACT_SUBREG $rB, sub_32), 2, 0, 29);
  2552. dag Left1 = (RLWINM $rB, 1, 0, 30);
  2553. dag Left2 = (RLWINM $rB, 2, 0, 29);
  2554. dag Left3 = (RLWINM8 $rB, 3, 0, 28);
  2555. }
  2556. let Predicates = [IsISA3_1, HasVSX, IsLittleEndian] in {
  2557. // Indexed vector insert element
  2558. def : Pat<(v16i8 (vector_insert v16i8:$vDi, i32:$rA, i64:$rB)),
  2559. (VINSBRX $vDi, InsertEltShift.Sub32, $rA)>;
  2560. def : Pat<(v8i16 (vector_insert v8i16:$vDi, i32:$rA, i64:$rB)),
  2561. (VINSHRX $vDi, InsertEltShift.Sub32Left1, $rA)>;
  2562. def : Pat<(v4i32 (insertelt v4i32:$vDi, i32:$rA, i64:$rB)),
  2563. (VINSWRX $vDi, InsertEltShift.Sub32Left2, $rA)>;
  2564. def : Pat<(v2i64 (insertelt v2i64:$vDi, i64:$rA, i64:$rB)),
  2565. (VINSDRX $vDi, InsertEltShift.Left3, $rA)>;
  2566. def : Pat<(v4f32 (insertelt v4f32:$vDi, f32:$rA, i64:$rB)),
  2567. (VINSWVRX $vDi, InsertEltShift.Sub32Left2, (XSCVDPSPN $rA))>;
  2568. def : Pat<(v2f64 (insertelt v2f64:$vDi, f64:$A, i64:$rB)),
  2569. (VINSDRX $vDi, InsertEltShift.Left3, Bitcast.DblToLong)>;
  2570. def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load DSForm:$rA)), i64:$rB)),
  2571. (VINSDRX $vDi, InsertEltShift.Left3, (LD memrix:$rA))>;
  2572. def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load PDForm:$rA)), i64:$rB)),
  2573. (VINSDRX $vDi, InsertEltShift.Left3, (PLD memri34:$rA))>;
  2574. def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load XForm:$rA)), i64:$rB)),
  2575. (VINSDRX $vDi, InsertEltShift.Left3, (LDX memrr:$rA))>;
  2576. let AddedComplexity = 400 in {
  2577. // Immediate vector insert element
  2578. foreach Idx = [0, 1, 2, 3] in {
  2579. def : Pat<(v4i32 (insertelt v4i32:$vDi, i32:$rA, Idx)),
  2580. (VINSW $vDi, !mul(!sub(3, Idx), 4), $rA)>;
  2581. }
  2582. foreach i = [0, 1] in
  2583. def : Pat<(v2i64 (insertelt v2i64:$vDi, i64:$rA, (i64 i))),
  2584. (VINSD $vDi, !mul(!sub(1, i), 8), $rA)>;
  2585. }
  2586. }
  2587. let Predicates = [IsISA3_1, HasVSX, IsBigEndian, IsPPC32] in {
  2588. // Indexed vector insert element
  2589. def : Pat<(v16i8 (vector_insert v16i8:$vDi, i32:$rA, i32:$rB)),
  2590. (VINSBLX $vDi, $rB, $rA)>;
  2591. def : Pat<(v8i16 (vector_insert v8i16:$vDi, i32:$rA, i32:$rB)),
  2592. (VINSHLX $vDi, InsertEltShift.Left1, $rA)>;
  2593. def : Pat<(v4i32 (insertelt v4i32:$vDi, i32:$rA, i32:$rB)),
  2594. (VINSWLX $vDi, InsertEltShift.Left2, $rA)>;
  2595. def : Pat<(v4f32 (insertelt v4f32:$vDi, f32:$rA, i32:$rB)),
  2596. (VINSWVLX $vDi, InsertEltShift.Left2, (XSCVDPSPN $rA))>;
  2597. }
  2598. let Predicates = [IsISA3_1, HasVSX, IsBigEndian, IsPPC64] in {
  2599. // Indexed vector insert element
  2600. def : Pat<(v16i8 (vector_insert v16i8:$vDi, i32:$rA, i64:$rB)),
  2601. (VINSBLX $vDi, InsertEltShift.Sub32, $rA)>;
  2602. def : Pat<(v8i16 (vector_insert v8i16:$vDi, i32:$rA, i64:$rB)),
  2603. (VINSHLX $vDi, InsertEltShift.Sub32Left1, $rA)>;
  2604. def : Pat<(v4i32 (insertelt v4i32:$vDi, i32:$rA, i64:$rB)),
  2605. (VINSWLX $vDi, InsertEltShift.Sub32Left2, $rA)>;
  2606. def : Pat<(v2i64 (insertelt v2i64:$vDi, i64:$rA, i64:$rB)),
  2607. (VINSDLX $vDi, InsertEltShift.Left3, $rA)>;
  2608. def : Pat<(v4f32 (insertelt v4f32:$vDi, f32:$rA, i64:$rB)),
  2609. (VINSWVLX $vDi, InsertEltShift.Sub32Left2, (XSCVDPSPN $rA))>;
  2610. def : Pat<(v2f64 (insertelt v2f64:$vDi, f64:$A, i64:$rB)),
  2611. (VINSDLX $vDi, InsertEltShift.Left3, Bitcast.DblToLong)>;
  2612. def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load DSForm:$rA)), i64:$rB)),
  2613. (VINSDLX $vDi, InsertEltShift.Left3, (LD memrix:$rA))>;
  2614. def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load PDForm:$rA)), i64:$rB)),
  2615. (VINSDLX $vDi, InsertEltShift.Left3, (PLD memri34:$rA))>;
  2616. def : Pat<(v2f64 (insertelt v2f64:$vDi, (f64 (load XForm:$rA)), i64:$rB)),
  2617. (VINSDLX $vDi, InsertEltShift.Left3, (LDX memrr:$rA))>;
  2618. }
  2619. let AddedComplexity = 400, Predicates = [IsISA3_1, HasVSX, IsBigEndian] in {
  2620. // Immediate vector insert element
  2621. foreach Ty = [i32, i64] in {
  2622. foreach Idx = [0, 1, 2, 3] in {
  2623. def : Pat<(v4i32 (insertelt v4i32:$vDi, i32:$rA, (Ty Idx))),
  2624. (VINSW $vDi, !mul(Idx, 4), $rA)>;
  2625. }
  2626. }
  2627. foreach Idx = [0, 1] in
  2628. def : Pat<(v2i64 (insertelt v2i64:$vDi, i64:$rA, Idx)),
  2629. (VINSD $vDi, !mul(Idx, 8), $rA)>;
  2630. }