PPCInstrPrefix.td 118 KB

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