CpuTestSimd.cs 135 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561
  1. #define Simd
  2. using ARMeilleure.State;
  3. using NUnit.Framework;
  4. using System;
  5. using System.Collections.Generic;
  6. namespace Ryujinx.Tests.Cpu
  7. {
  8. [Category("Simd")]
  9. public sealed class CpuTestSimd : CpuTest
  10. {
  11. #if Simd
  12. #region "Helper methods"
  13. private static byte GenLeadingSignsMinus8(int cnt) // 0 <= cnt <= 7
  14. {
  15. return (byte)(~(uint)GenLeadingZeros8(cnt + 1));
  16. }
  17. private static ushort GenLeadingSignsMinus16(int cnt) // 0 <= cnt <= 15
  18. {
  19. return (ushort)(~(uint)GenLeadingZeros16(cnt + 1));
  20. }
  21. private static uint GenLeadingSignsMinus32(int cnt) // 0 <= cnt <= 31
  22. {
  23. return ~GenLeadingZeros32(cnt + 1);
  24. }
  25. private static byte GenLeadingSignsPlus8(int cnt) // 0 <= cnt <= 7
  26. {
  27. return GenLeadingZeros8(cnt + 1);
  28. }
  29. private static ushort GenLeadingSignsPlus16(int cnt) // 0 <= cnt <= 15
  30. {
  31. return GenLeadingZeros16(cnt + 1);
  32. }
  33. private static uint GenLeadingSignsPlus32(int cnt) // 0 <= cnt <= 31
  34. {
  35. return GenLeadingZeros32(cnt + 1);
  36. }
  37. private static byte GenLeadingZeros8(int cnt) // 0 <= cnt <= 8
  38. {
  39. if (cnt == 8) return 0;
  40. if (cnt == 7) return 1;
  41. byte rnd = TestContext.CurrentContext.Random.NextByte();
  42. sbyte mask = sbyte.MinValue;
  43. return (byte)(((uint)rnd >> (cnt + 1)) | ((uint)((byte)mask) >> cnt));
  44. }
  45. private static ushort GenLeadingZeros16(int cnt) // 0 <= cnt <= 16
  46. {
  47. if (cnt == 16) return 0;
  48. if (cnt == 15) return 1;
  49. ushort rnd = TestContext.CurrentContext.Random.NextUShort();
  50. short mask = short.MinValue;
  51. return (ushort)(((uint)rnd >> (cnt + 1)) | ((uint)((ushort)mask) >> cnt));
  52. }
  53. private static uint GenLeadingZeros32(int cnt) // 0 <= cnt <= 32
  54. {
  55. if (cnt == 32) return 0u;
  56. if (cnt == 31) return 1u;
  57. uint rnd = TestContext.CurrentContext.Random.NextUInt();
  58. int mask = int.MinValue;
  59. return (rnd >> (cnt + 1)) | ((uint)mask >> cnt);
  60. }
  61. #endregion
  62. #region "ValueSource (Types)"
  63. private static ulong[] _1B1H1S1D_()
  64. {
  65. return new[] { 0x0000000000000000ul, 0x000000000000007Ful,
  66. 0x0000000000000080ul, 0x00000000000000FFul,
  67. 0x0000000000007FFFul, 0x0000000000008000ul,
  68. 0x000000000000FFFFul, 0x000000007FFFFFFFul,
  69. 0x0000000080000000ul, 0x00000000FFFFFFFFul,
  70. 0x7FFFFFFFFFFFFFFFul, 0x8000000000000000ul,
  71. 0xFFFFFFFFFFFFFFFFul };
  72. }
  73. private static ulong[] _1D_()
  74. {
  75. return new[] { 0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
  76. 0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul };
  77. }
  78. private static ulong[] _1H1S1D_()
  79. {
  80. return new[] { 0x0000000000000000ul, 0x0000000000007FFFul,
  81. 0x0000000000008000ul, 0x000000000000FFFFul,
  82. 0x000000007FFFFFFFul, 0x0000000080000000ul,
  83. 0x00000000FFFFFFFFul, 0x7FFFFFFFFFFFFFFFul,
  84. 0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul };
  85. }
  86. private static ulong[] _1S_()
  87. {
  88. return new[] { 0x0000000000000000ul, 0x000000007FFFFFFFul,
  89. 0x0000000080000000ul, 0x00000000FFFFFFFFul };
  90. }
  91. private static ulong[] _2S_()
  92. {
  93. return new[] { 0x0000000000000000ul, 0x7FFFFFFF7FFFFFFFul,
  94. 0x8000000080000000ul, 0xFFFFFFFFFFFFFFFFul };
  95. }
  96. private static ulong[] _4H_()
  97. {
  98. return new[] { 0x0000000000000000ul, 0x7FFF7FFF7FFF7FFFul,
  99. 0x8000800080008000ul, 0xFFFFFFFFFFFFFFFFul };
  100. }
  101. private static ulong[] _4H2S1D_()
  102. {
  103. return new[] { 0x0000000000000000ul, 0x7FFF7FFF7FFF7FFFul,
  104. 0x8000800080008000ul, 0x7FFFFFFF7FFFFFFFul,
  105. 0x8000000080000000ul, 0x7FFFFFFFFFFFFFFFul,
  106. 0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul };
  107. }
  108. private static ulong[] _8B_()
  109. {
  110. return new[] { 0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
  111. 0x8080808080808080ul, 0xFFFFFFFFFFFFFFFFul };
  112. }
  113. private static ulong[] _8B4H_()
  114. {
  115. return new[] { 0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
  116. 0x8080808080808080ul, 0x7FFF7FFF7FFF7FFFul,
  117. 0x8000800080008000ul, 0xFFFFFFFFFFFFFFFFul };
  118. }
  119. private static ulong[] _8B4H2S_()
  120. {
  121. return new[] { 0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
  122. 0x8080808080808080ul, 0x7FFF7FFF7FFF7FFFul,
  123. 0x8000800080008000ul, 0x7FFFFFFF7FFFFFFFul,
  124. 0x8000000080000000ul, 0xFFFFFFFFFFFFFFFFul };
  125. }
  126. private static ulong[] _8B4H2S1D_()
  127. {
  128. return new[] { 0x0000000000000000ul, 0x7F7F7F7F7F7F7F7Ful,
  129. 0x8080808080808080ul, 0x7FFF7FFF7FFF7FFFul,
  130. 0x8000800080008000ul, 0x7FFFFFFF7FFFFFFFul,
  131. 0x8000000080000000ul, 0x7FFFFFFFFFFFFFFFul,
  132. 0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul };
  133. }
  134. private static uint[] _W_()
  135. {
  136. return new[] { 0x00000000u, 0x7FFFFFFFu,
  137. 0x80000000u, 0xFFFFFFFFu };
  138. }
  139. private static ulong[] _X_()
  140. {
  141. return new[] { 0x0000000000000000ul, 0x7FFFFFFFFFFFFFFFul,
  142. 0x8000000000000000ul, 0xFFFFFFFFFFFFFFFFul };
  143. }
  144. private static IEnumerable<ulong> _1H_F_()
  145. {
  146. yield return 0x000000000000FBFFul; // -Max Normal
  147. yield return 0x0000000000008400ul; // -Min Normal
  148. yield return 0x00000000000083FFul; // -Max Subnormal
  149. yield return 0x0000000000008001ul; // -Min Subnormal
  150. yield return 0x0000000000007BFFul; // +Max Normal
  151. yield return 0x0000000000000400ul; // +Min Normal
  152. yield return 0x00000000000003FFul; // +Max Subnormal
  153. yield return 0x0000000000000001ul; // +Min Subnormal
  154. if (!NoZeros)
  155. {
  156. yield return 0x0000000000008000ul; // -Zero
  157. yield return 0x0000000000000000ul; // +Zero
  158. }
  159. if (!NoInfs)
  160. {
  161. yield return 0x000000000000FC00ul; // -Infinity
  162. yield return 0x0000000000007C00ul; // +Infinity
  163. }
  164. if (!NoNaNs)
  165. {
  166. yield return 0x000000000000FE00ul; // -QNaN (all zeros payload)
  167. yield return 0x000000000000FDFFul; // -SNaN (all ones payload)
  168. yield return 0x0000000000007E00ul; // +QNaN (all zeros payload) (DefaultNaN)
  169. yield return 0x0000000000007DFFul; // +SNaN (all ones payload)
  170. }
  171. for (int cnt = 1; cnt <= RndCnt; cnt++)
  172. {
  173. ulong grbg = TestContext.CurrentContext.Random.NextUShort();
  174. ulong rnd1 = GenNormalH();
  175. ulong rnd2 = GenSubnormalH();
  176. yield return (grbg << 48) | (grbg << 32) | (grbg << 16) | rnd1;
  177. yield return (grbg << 48) | (grbg << 32) | (grbg << 16) | rnd2;
  178. }
  179. }
  180. private static IEnumerable<ulong> _4H_F_()
  181. {
  182. yield return 0xFBFFFBFFFBFFFBFFul; // -Max Normal
  183. yield return 0x8400840084008400ul; // -Min Normal
  184. yield return 0x83FF83FF83FF83FFul; // -Max Subnormal
  185. yield return 0x8001800180018001ul; // -Min Subnormal
  186. yield return 0x7BFF7BFF7BFF7BFFul; // +Max Normal
  187. yield return 0x0400040004000400ul; // +Min Normal
  188. yield return 0x03FF03FF03FF03FFul; // +Max Subnormal
  189. yield return 0x0001000100010001ul; // +Min Subnormal
  190. if (!NoZeros)
  191. {
  192. yield return 0x8000800080008000ul; // -Zero
  193. yield return 0x0000000000000000ul; // +Zero
  194. }
  195. if (!NoInfs)
  196. {
  197. yield return 0xFC00FC00FC00FC00ul; // -Infinity
  198. yield return 0x7C007C007C007C00ul; // +Infinity
  199. }
  200. if (!NoNaNs)
  201. {
  202. yield return 0xFE00FE00FE00FE00ul; // -QNaN (all zeros payload)
  203. yield return 0xFDFFFDFFFDFFFDFFul; // -SNaN (all ones payload)
  204. yield return 0x7E007E007E007E00ul; // +QNaN (all zeros payload) (DefaultNaN)
  205. yield return 0x7DFF7DFF7DFF7DFFul; // +SNaN (all ones payload)
  206. }
  207. for (int cnt = 1; cnt <= RndCnt; cnt++)
  208. {
  209. ulong rnd1 = GenNormalH();
  210. ulong rnd2 = GenSubnormalH();
  211. yield return (rnd1 << 48) | (rnd1 << 32) | (rnd1 << 16) | rnd1;
  212. yield return (rnd2 << 48) | (rnd2 << 32) | (rnd2 << 16) | rnd2;
  213. }
  214. }
  215. private static IEnumerable<ulong> _1S_F_()
  216. {
  217. yield return 0x00000000FF7FFFFFul; // -Max Normal (float.MinValue)
  218. yield return 0x0000000080800000ul; // -Min Normal
  219. yield return 0x00000000807FFFFFul; // -Max Subnormal
  220. yield return 0x0000000080000001ul; // -Min Subnormal (-float.Epsilon)
  221. yield return 0x000000007F7FFFFFul; // +Max Normal (float.MaxValue)
  222. yield return 0x0000000000800000ul; // +Min Normal
  223. yield return 0x00000000007FFFFFul; // +Max Subnormal
  224. yield return 0x0000000000000001ul; // +Min Subnormal (float.Epsilon)
  225. if (!NoZeros)
  226. {
  227. yield return 0x0000000080000000ul; // -Zero
  228. yield return 0x0000000000000000ul; // +Zero
  229. }
  230. if (!NoInfs)
  231. {
  232. yield return 0x00000000FF800000ul; // -Infinity
  233. yield return 0x000000007F800000ul; // +Infinity
  234. }
  235. if (!NoNaNs)
  236. {
  237. yield return 0x00000000FFC00000ul; // -QNaN (all zeros payload) (float.NaN)
  238. yield return 0x00000000FFBFFFFFul; // -SNaN (all ones payload)
  239. yield return 0x000000007FC00000ul; // +QNaN (all zeros payload) (-float.NaN) (DefaultNaN)
  240. yield return 0x000000007FBFFFFFul; // +SNaN (all ones payload)
  241. }
  242. for (int cnt = 1; cnt <= RndCnt; cnt++)
  243. {
  244. ulong grbg = TestContext.CurrentContext.Random.NextUInt();
  245. ulong rnd1 = GenNormalS();
  246. ulong rnd2 = GenSubnormalS();
  247. yield return (grbg << 32) | rnd1;
  248. yield return (grbg << 32) | rnd2;
  249. }
  250. }
  251. private static IEnumerable<ulong> _1S_F_W_()
  252. {
  253. // int
  254. yield return 0x00000000CF000001ul; // -2.1474839E9f (-2147483904)
  255. yield return 0x00000000CF000000ul; // -2.14748365E9f (-2147483648)
  256. yield return 0x00000000CEFFFFFFul; // -2.14748352E9f (-2147483520)
  257. yield return 0x000000004F000001ul; // 2.1474839E9f (2147483904)
  258. yield return 0x000000004F000000ul; // 2.14748365E9f (2147483648)
  259. yield return 0x000000004EFFFFFFul; // 2.14748352E9f (2147483520)
  260. // uint
  261. yield return 0x000000004F800001ul; // 4.2949678E9f (4294967808)
  262. yield return 0x000000004F800000ul; // 4.2949673E9f (4294967296)
  263. yield return 0x000000004F7FFFFFul; // 4.29496704E9f (4294967040)
  264. yield return 0x00000000FF7FFFFFul; // -Max Normal (float.MinValue)
  265. yield return 0x0000000080800000ul; // -Min Normal
  266. yield return 0x00000000807FFFFFul; // -Max Subnormal
  267. yield return 0x0000000080000001ul; // -Min Subnormal (-float.Epsilon)
  268. yield return 0x000000007F7FFFFFul; // +Max Normal (float.MaxValue)
  269. yield return 0x0000000000800000ul; // +Min Normal
  270. yield return 0x00000000007FFFFFul; // +Max Subnormal
  271. yield return 0x0000000000000001ul; // +Min Subnormal (float.Epsilon)
  272. if (!NoZeros)
  273. {
  274. yield return 0x0000000080000000ul; // -Zero
  275. yield return 0x0000000000000000ul; // +Zero
  276. }
  277. if (!NoInfs)
  278. {
  279. yield return 0x00000000FF800000ul; // -Infinity
  280. yield return 0x000000007F800000ul; // +Infinity
  281. }
  282. if (!NoNaNs)
  283. {
  284. yield return 0x00000000FFC00000ul; // -QNaN (all zeros payload) (float.NaN)
  285. yield return 0x00000000FFBFFFFFul; // -SNaN (all ones payload)
  286. yield return 0x000000007FC00000ul; // +QNaN (all zeros payload) (-float.NaN) (DefaultNaN)
  287. yield return 0x000000007FBFFFFFul; // +SNaN (all ones payload)
  288. }
  289. for (int cnt = 1; cnt <= RndCnt; cnt++)
  290. {
  291. ulong grbg = TestContext.CurrentContext.Random.NextUInt();
  292. ulong rnd1 = (uint)BitConverter.SingleToInt32Bits((int)TestContext.CurrentContext.Random.NextUInt());
  293. ulong rnd2 = (uint)BitConverter.SingleToInt32Bits(TestContext.CurrentContext.Random.NextUInt());
  294. ulong rnd3 = GenNormalS();
  295. ulong rnd4 = GenSubnormalS();
  296. yield return (grbg << 32) | rnd1;
  297. yield return (grbg << 32) | rnd2;
  298. yield return (grbg << 32) | rnd3;
  299. yield return (grbg << 32) | rnd4;
  300. }
  301. }
  302. private static IEnumerable<ulong> _2S_F_()
  303. {
  304. yield return 0xFF7FFFFFFF7FFFFFul; // -Max Normal (float.MinValue)
  305. yield return 0x8080000080800000ul; // -Min Normal
  306. yield return 0x807FFFFF807FFFFFul; // -Max Subnormal
  307. yield return 0x8000000180000001ul; // -Min Subnormal (-float.Epsilon)
  308. yield return 0x7F7FFFFF7F7FFFFFul; // +Max Normal (float.MaxValue)
  309. yield return 0x0080000000800000ul; // +Min Normal
  310. yield return 0x007FFFFF007FFFFFul; // +Max Subnormal
  311. yield return 0x0000000100000001ul; // +Min Subnormal (float.Epsilon)
  312. if (!NoZeros)
  313. {
  314. yield return 0x8000000080000000ul; // -Zero
  315. yield return 0x0000000000000000ul; // +Zero
  316. }
  317. if (!NoInfs)
  318. {
  319. yield return 0xFF800000FF800000ul; // -Infinity
  320. yield return 0x7F8000007F800000ul; // +Infinity
  321. }
  322. if (!NoNaNs)
  323. {
  324. yield return 0xFFC00000FFC00000ul; // -QNaN (all zeros payload) (float.NaN)
  325. yield return 0xFFBFFFFFFFBFFFFFul; // -SNaN (all ones payload)
  326. yield return 0x7FC000007FC00000ul; // +QNaN (all zeros payload) (-float.NaN) (DefaultNaN)
  327. yield return 0x7FBFFFFF7FBFFFFFul; // +SNaN (all ones payload)
  328. }
  329. for (int cnt = 1; cnt <= RndCnt; cnt++)
  330. {
  331. ulong rnd1 = GenNormalS();
  332. ulong rnd2 = GenSubnormalS();
  333. yield return (rnd1 << 32) | rnd1;
  334. yield return (rnd2 << 32) | rnd2;
  335. }
  336. }
  337. private static IEnumerable<ulong> _2S_F_W_()
  338. {
  339. // int
  340. yield return 0xCF000001CF000001ul; // -2.1474839E9f (-2147483904)
  341. yield return 0xCF000000CF000000ul; // -2.14748365E9f (-2147483648)
  342. yield return 0xCEFFFFFFCEFFFFFFul; // -2.14748352E9f (-2147483520)
  343. yield return 0x4F0000014F000001ul; // 2.1474839E9f (2147483904)
  344. yield return 0x4F0000004F000000ul; // 2.14748365E9f (2147483648)
  345. yield return 0x4EFFFFFF4EFFFFFFul; // 2.14748352E9f (2147483520)
  346. // uint
  347. yield return 0x4F8000014F800001ul; // 4.2949678E9f (4294967808)
  348. yield return 0x4F8000004F800000ul; // 4.2949673E9f (4294967296)
  349. yield return 0x4F7FFFFF4F7FFFFFul; // 4.29496704E9f (4294967040)
  350. yield return 0xFF7FFFFFFF7FFFFFul; // -Max Normal (float.MinValue)
  351. yield return 0x8080000080800000ul; // -Min Normal
  352. yield return 0x807FFFFF807FFFFFul; // -Max Subnormal
  353. yield return 0x8000000180000001ul; // -Min Subnormal (-float.Epsilon)
  354. yield return 0x7F7FFFFF7F7FFFFFul; // +Max Normal (float.MaxValue)
  355. yield return 0x0080000000800000ul; // +Min Normal
  356. yield return 0x007FFFFF007FFFFFul; // +Max Subnormal
  357. yield return 0x0000000100000001ul; // +Min Subnormal (float.Epsilon)
  358. if (!NoZeros)
  359. {
  360. yield return 0x8000000080000000ul; // -Zero
  361. yield return 0x0000000000000000ul; // +Zero
  362. }
  363. if (!NoInfs)
  364. {
  365. yield return 0xFF800000FF800000ul; // -Infinity
  366. yield return 0x7F8000007F800000ul; // +Infinity
  367. }
  368. if (!NoNaNs)
  369. {
  370. yield return 0xFFC00000FFC00000ul; // -QNaN (all zeros payload) (float.NaN)
  371. yield return 0xFFBFFFFFFFBFFFFFul; // -SNaN (all ones payload)
  372. yield return 0x7FC000007FC00000ul; // +QNaN (all zeros payload) (-float.NaN) (DefaultNaN)
  373. yield return 0x7FBFFFFF7FBFFFFFul; // +SNaN (all ones payload)
  374. }
  375. for (int cnt = 1; cnt <= RndCnt; cnt++)
  376. {
  377. ulong rnd1 = (uint)BitConverter.SingleToInt32Bits(
  378. (int)TestContext.CurrentContext.Random.NextUInt());
  379. ulong rnd2 = (uint)BitConverter.SingleToInt32Bits(
  380. TestContext.CurrentContext.Random.NextUInt());
  381. ulong rnd3 = GenNormalS();
  382. ulong rnd4 = GenSubnormalS();
  383. yield return (rnd1 << 32) | rnd1;
  384. yield return (rnd2 << 32) | rnd2;
  385. yield return (rnd3 << 32) | rnd3;
  386. yield return (rnd4 << 32) | rnd4;
  387. }
  388. }
  389. private static IEnumerable<ulong> _1D_F_()
  390. {
  391. yield return 0xFFEFFFFFFFFFFFFFul; // -Max Normal (double.MinValue)
  392. yield return 0x8010000000000000ul; // -Min Normal
  393. yield return 0x800FFFFFFFFFFFFFul; // -Max Subnormal
  394. yield return 0x8000000000000001ul; // -Min Subnormal (-double.Epsilon)
  395. yield return 0x7FEFFFFFFFFFFFFFul; // +Max Normal (double.MaxValue)
  396. yield return 0x0010000000000000ul; // +Min Normal
  397. yield return 0x000FFFFFFFFFFFFFul; // +Max Subnormal
  398. yield return 0x0000000000000001ul; // +Min Subnormal (double.Epsilon)
  399. if (!NoZeros)
  400. {
  401. yield return 0x8000000000000000ul; // -Zero
  402. yield return 0x0000000000000000ul; // +Zero
  403. }
  404. if (!NoInfs)
  405. {
  406. yield return 0xFFF0000000000000ul; // -Infinity
  407. yield return 0x7FF0000000000000ul; // +Infinity
  408. }
  409. if (!NoNaNs)
  410. {
  411. yield return 0xFFF8000000000000ul; // -QNaN (all zeros payload) (double.NaN)
  412. yield return 0xFFF7FFFFFFFFFFFFul; // -SNaN (all ones payload)
  413. yield return 0x7FF8000000000000ul; // +QNaN (all zeros payload) (-double.NaN) (DefaultNaN)
  414. yield return 0x7FF7FFFFFFFFFFFFul; // +SNaN (all ones payload)
  415. }
  416. for (int cnt = 1; cnt <= RndCnt; cnt++)
  417. {
  418. ulong rnd1 = GenNormalD();
  419. ulong rnd2 = GenSubnormalD();
  420. yield return rnd1;
  421. yield return rnd2;
  422. }
  423. }
  424. private static IEnumerable<ulong> _1D_F_X_()
  425. {
  426. // long
  427. yield return 0xC3E0000000000001ul; // -9.2233720368547780E18d (-9223372036854778000)
  428. yield return 0xC3E0000000000000ul; // -9.2233720368547760E18d (-9223372036854776000)
  429. yield return 0xC3DFFFFFFFFFFFFFul; // -9.2233720368547750E18d (-9223372036854775000)
  430. yield return 0x43E0000000000001ul; // 9.2233720368547780E18d (9223372036854778000)
  431. yield return 0x43E0000000000000ul; // 9.2233720368547760E18d (9223372036854776000)
  432. yield return 0x43DFFFFFFFFFFFFFul; // 9.2233720368547750E18d (9223372036854775000)
  433. // ulong
  434. yield return 0x43F0000000000001ul; // 1.8446744073709556e19d (18446744073709556000)
  435. yield return 0x43F0000000000000ul; // 1.8446744073709552E19d (18446744073709552000)
  436. yield return 0x43EFFFFFFFFFFFFFul; // 1.8446744073709550e19d (18446744073709550000)
  437. yield return 0xFFEFFFFFFFFFFFFFul; // -Max Normal (double.MinValue)
  438. yield return 0x8010000000000000ul; // -Min Normal
  439. yield return 0x800FFFFFFFFFFFFFul; // -Max Subnormal
  440. yield return 0x8000000000000001ul; // -Min Subnormal (-double.Epsilon)
  441. yield return 0x7FEFFFFFFFFFFFFFul; // +Max Normal (double.MaxValue)
  442. yield return 0x0010000000000000ul; // +Min Normal
  443. yield return 0x000FFFFFFFFFFFFFul; // +Max Subnormal
  444. yield return 0x0000000000000001ul; // +Min Subnormal (double.Epsilon)
  445. if (!NoZeros)
  446. {
  447. yield return 0x8000000000000000ul; // -Zero
  448. yield return 0x0000000000000000ul; // +Zero
  449. }
  450. if (!NoInfs)
  451. {
  452. yield return 0xFFF0000000000000ul; // -Infinity
  453. yield return 0x7FF0000000000000ul; // +Infinity
  454. }
  455. if (!NoNaNs)
  456. {
  457. yield return 0xFFF8000000000000ul; // -QNaN (all zeros payload) (double.NaN)
  458. yield return 0xFFF7FFFFFFFFFFFFul; // -SNaN (all ones payload)
  459. yield return 0x7FF8000000000000ul; // +QNaN (all zeros payload) (-double.NaN) (DefaultNaN)
  460. yield return 0x7FF7FFFFFFFFFFFFul; // +SNaN (all ones payload)
  461. }
  462. for (int cnt = 1; cnt <= RndCnt; cnt++)
  463. {
  464. ulong rnd1 = (ulong)BitConverter.DoubleToInt64Bits(
  465. (long)TestContext.CurrentContext.Random.NextULong());
  466. ulong rnd2 = (ulong)BitConverter.DoubleToInt64Bits(
  467. TestContext.CurrentContext.Random.NextULong());
  468. ulong rnd3 = GenNormalD();
  469. ulong rnd4 = GenSubnormalD();
  470. yield return rnd1;
  471. yield return rnd2;
  472. yield return rnd3;
  473. yield return rnd4;
  474. }
  475. }
  476. private static IEnumerable<ulong> _GenLeadingSigns8B_()
  477. {
  478. for (int cnt = 0; cnt <= 7; cnt++)
  479. {
  480. ulong rnd1 = GenLeadingSignsMinus8(cnt);
  481. ulong rnd2 = GenLeadingSignsPlus8(cnt);
  482. yield return (rnd1 << 56) | (rnd1 << 48) | (rnd1 << 40) | (rnd1 << 32) |
  483. (rnd1 << 24) | (rnd1 << 16) | (rnd1 << 08) | rnd1;
  484. yield return (rnd2 << 56) | (rnd2 << 48) | (rnd2 << 40) | (rnd2 << 32) |
  485. (rnd2 << 24) | (rnd2 << 16) | (rnd2 << 08) | rnd2;
  486. }
  487. }
  488. private static IEnumerable<ulong> _GenLeadingSigns4H_()
  489. {
  490. for (int cnt = 0; cnt <= 15; cnt++)
  491. {
  492. ulong rnd1 = GenLeadingSignsMinus16(cnt);
  493. ulong rnd2 = GenLeadingSignsPlus16(cnt);
  494. yield return (rnd1 << 48) | (rnd1 << 32) | (rnd1 << 16) | rnd1;
  495. yield return (rnd2 << 48) | (rnd2 << 32) | (rnd2 << 16) | rnd2;
  496. }
  497. }
  498. private static IEnumerable<ulong> _GenLeadingSigns2S_()
  499. {
  500. for (int cnt = 0; cnt <= 31; cnt++)
  501. {
  502. ulong rnd1 = GenLeadingSignsMinus32(cnt);
  503. ulong rnd2 = GenLeadingSignsPlus32(cnt);
  504. yield return (rnd1 << 32) | rnd1;
  505. yield return (rnd2 << 32) | rnd2;
  506. }
  507. }
  508. private static IEnumerable<ulong> _GenLeadingZeros8B_()
  509. {
  510. for (int cnt = 0; cnt <= 8; cnt++)
  511. {
  512. ulong rnd = GenLeadingZeros8(cnt);
  513. yield return (rnd << 56) | (rnd << 48) | (rnd << 40) | (rnd << 32) |
  514. (rnd << 24) | (rnd << 16) | (rnd << 08) | rnd;
  515. }
  516. }
  517. private static IEnumerable<ulong> _GenLeadingZeros4H_()
  518. {
  519. for (int cnt = 0; cnt <= 16; cnt++)
  520. {
  521. ulong rnd = GenLeadingZeros16(cnt);
  522. yield return (rnd << 48) | (rnd << 32) | (rnd << 16) | rnd;
  523. }
  524. }
  525. private static IEnumerable<ulong> _GenLeadingZeros2S_()
  526. {
  527. for (int cnt = 0; cnt <= 32; cnt++)
  528. {
  529. ulong rnd = GenLeadingZeros32(cnt);
  530. yield return (rnd << 32) | rnd;
  531. }
  532. }
  533. private static IEnumerable<ulong> _GenPopCnt8B_()
  534. {
  535. for (ulong cnt = 0ul; cnt <= 255ul; cnt++)
  536. {
  537. yield return (cnt << 56) | (cnt << 48) | (cnt << 40) | (cnt << 32) |
  538. (cnt << 24) | (cnt << 16) | (cnt << 08) | cnt;
  539. }
  540. }
  541. #endregion
  542. #region "ValueSource (Opcodes)"
  543. private static uint[] _SU_Add_Max_Min_V_V_8BB_4HH_()
  544. {
  545. return new[]
  546. {
  547. 0x0E31B800u, // ADDV B0, V0.8B
  548. 0x0E30A800u, // SMAXV B0, V0.8B
  549. 0x0E31A800u, // SMINV B0, V0.8B
  550. 0x2E30A800u, // UMAXV B0, V0.8B
  551. 0x2E31A800u // UMINV B0, V0.8B
  552. };
  553. }
  554. private static uint[] _SU_Add_Max_Min_V_V_16BB_8HH_4SS_()
  555. {
  556. return new[]
  557. {
  558. 0x4E31B800u, // ADDV B0, V0.16B
  559. 0x4E30A800u, // SMAXV B0, V0.16B
  560. 0x4E31A800u, // SMINV B0, V0.16B
  561. 0x6E30A800u, // UMAXV B0, V0.16B
  562. 0x6E31A800u // UMINV B0, V0.16B
  563. };
  564. }
  565. private static uint[] _F_Abs_Neg_Recpx_Sqrt_S_S_()
  566. {
  567. return new[]
  568. {
  569. 0x1E20C020u, // FABS S0, S1
  570. 0x1E214020u, // FNEG S0, S1
  571. 0x5EA1F820u, // FRECPX S0, S1
  572. 0x1E21C020u // FSQRT S0, S1
  573. };
  574. }
  575. private static uint[] _F_Abs_Neg_Recpx_Sqrt_S_D_()
  576. {
  577. return new[]
  578. {
  579. 0x1E60C020u, // FABS D0, D1
  580. 0x1E614020u, // FNEG D0, D1
  581. 0x5EE1F820u, // FRECPX D0, D1
  582. 0x1E61C020u // FSQRT D0, D1
  583. };
  584. }
  585. private static uint[] _F_Abs_Neg_Sqrt_V_2S_4S_()
  586. {
  587. return new[]
  588. {
  589. 0x0EA0F800u, // FABS V0.2S, V0.2S
  590. 0x2EA0F800u, // FNEG V0.2S, V0.2S
  591. 0x2EA1F800u // FSQRT V0.2S, V0.2S
  592. };
  593. }
  594. private static uint[] _F_Abs_Neg_Sqrt_V_2D_()
  595. {
  596. return new[]
  597. {
  598. 0x4EE0F800u, // FABS V0.2D, V0.2D
  599. 0x6EE0F800u, // FNEG V0.2D, V0.2D
  600. 0x6EE1F800u // FSQRT V0.2D, V0.2D
  601. };
  602. }
  603. private static uint[] _F_Add_Max_Min_Nm_P_S_2SS_()
  604. {
  605. return new[]
  606. {
  607. 0x7E30D820u, // FADDP S0, V1.2S
  608. 0x7E30C820u, // FMAXNMP S0, V1.2S
  609. 0x7EB0C820u // FMINNMP S0, V1.2S
  610. };
  611. }
  612. private static uint[] _F_Add_Max_Min_Nm_P_S_2DD_()
  613. {
  614. return new[]
  615. {
  616. 0x7E70D820u, // FADDP D0, V1.2D
  617. 0x7E70C820u, // FMAXNMP D0, V1.2D
  618. 0x7EF0C820u // FMINNMP D0, V1.2D
  619. };
  620. }
  621. private static uint[] _F_Cm_EqGeGtLeLt_S_S_()
  622. {
  623. return new[]
  624. {
  625. 0x5EA0D820u, // FCMEQ S0, S1, #0.0
  626. 0x7EA0C820u, // FCMGE S0, S1, #0.0
  627. 0x5EA0C820u, // FCMGT S0, S1, #0.0
  628. 0x7EA0D820u, // FCMLE S0, S1, #0.0
  629. 0x5EA0E820u // FCMLT S0, S1, #0.0
  630. };
  631. }
  632. private static uint[] _F_Cm_EqGeGtLeLt_S_D_()
  633. {
  634. return new[]
  635. {
  636. 0x5EE0D820u, // FCMEQ D0, D1, #0.0
  637. 0x7EE0C820u, // FCMGE D0, D1, #0.0
  638. 0x5EE0C820u, // FCMGT D0, D1, #0.0
  639. 0x7EE0D820u, // FCMLE D0, D1, #0.0
  640. 0x5EE0E820u // FCMLT D0, D1, #0.0
  641. };
  642. }
  643. private static uint[] _F_Cm_EqGeGtLeLt_V_2S_4S_()
  644. {
  645. return new[]
  646. {
  647. 0x0EA0D800u, // FCMEQ V0.2S, V0.2S, #0.0
  648. 0x2EA0C800u, // FCMGE V0.2S, V0.2S, #0.0
  649. 0x0EA0C800u, // FCMGT V0.2S, V0.2S, #0.0
  650. 0x2EA0D800u, // FCMLE V0.2S, V0.2S, #0.0
  651. 0x0EA0E800u // FCMLT V0.2S, V0.2S, #0.0
  652. };
  653. }
  654. private static uint[] _F_Cm_EqGeGtLeLt_V_2D_()
  655. {
  656. return new[]
  657. {
  658. 0x4EE0D800u, // FCMEQ V0.2D, V0.2D, #0.0
  659. 0x6EE0C800u, // FCMGE V0.2D, V0.2D, #0.0
  660. 0x4EE0C800u, // FCMGT V0.2D, V0.2D, #0.0
  661. 0x6EE0D800u, // FCMLE V0.2D, V0.2D, #0.0
  662. 0x4EE0E800u // FCMLT V0.2D, V0.2D, #0.0
  663. };
  664. }
  665. private static uint[] _F_Cmp_Cmpe_S_S_()
  666. {
  667. return new[]
  668. {
  669. 0x1E202028u, // FCMP S1, #0.0
  670. 0x1E202038u // FCMPE S1, #0.0
  671. };
  672. }
  673. private static uint[] _F_Cmp_Cmpe_S_D_()
  674. {
  675. return new[]
  676. {
  677. 0x1E602028u, // FCMP D1, #0.0
  678. 0x1E602038u // FCMPE D1, #0.0
  679. };
  680. }
  681. private static uint[] _F_Cvt_S_SD_()
  682. {
  683. return new[]
  684. {
  685. 0x1E22C020u // FCVT D0, S1
  686. };
  687. }
  688. private static uint[] _F_Cvt_S_DS_()
  689. {
  690. return new[]
  691. {
  692. 0x1E624020u // FCVT S0, D1
  693. };
  694. }
  695. private static uint[] _F_Cvt_S_SH_()
  696. {
  697. return new[]
  698. {
  699. 0x1E23C020u // FCVT H0, S1
  700. };
  701. }
  702. private static uint[] _F_Cvt_S_DH_()
  703. {
  704. return new[]
  705. {
  706. 0x1E63C020u // FCVT H0, D1
  707. };
  708. }
  709. private static uint[] _F_Cvt_S_HS_()
  710. {
  711. return new[]
  712. {
  713. 0x1EE24020u // FCVT S0, H1
  714. };
  715. }
  716. private static uint[] _F_Cvt_S_HD_()
  717. {
  718. return new[]
  719. {
  720. 0x1EE2C020u // FCVT D0, H1
  721. };
  722. }
  723. private static uint[] _F_Cvt_ANZ_SU_S_S_()
  724. {
  725. return new[]
  726. {
  727. 0x5E21C820u, // FCVTAS S0, S1
  728. 0x7E21C820u, // FCVTAU S0, S1
  729. 0x5E21A820u, // FCVTNS S0, S1
  730. 0x7E21A820u, // FCVTNU S0, S1
  731. 0x5EA1B820u, // FCVTZS S0, S1
  732. 0x7EA1B820u // FCVTZU S0, S1
  733. };
  734. }
  735. private static uint[] _F_Cvt_ANZ_SU_S_D_()
  736. {
  737. return new[]
  738. {
  739. 0x5E61C820u, // FCVTAS D0, D1
  740. 0x7E61C820u, // FCVTAU D0, D1
  741. 0x5E61A820u, // FCVTNS D0, D1
  742. 0x7E61A820u, // FCVTNU D0, D1
  743. 0x5EE1B820u, // FCVTZS D0, D1
  744. 0x7EE1B820u // FCVTZU D0, D1
  745. };
  746. }
  747. private static uint[] _F_Cvt_ANZ_SU_V_2S_4S_()
  748. {
  749. return new[]
  750. {
  751. 0x0E21C800u, // FCVTAS V0.2S, V0.2S
  752. 0x2E21C800u, // FCVTAU V0.2S, V0.2S
  753. 0x0E21B800u, // FCVTMS V0.2S, V0.2S
  754. 0x0E21A800u, // FCVTNS V0.2S, V0.2S
  755. 0x2E21A800u, // FCVTNU V0.2S, V0.2S
  756. 0x0EA1B800u, // FCVTZS V0.2S, V0.2S
  757. 0x2EA1B800u // FCVTZU V0.2S, V0.2S
  758. };
  759. }
  760. private static uint[] _F_Cvt_ANZ_SU_V_2D_()
  761. {
  762. return new[]
  763. {
  764. 0x4E61C800u, // FCVTAS V0.2D, V0.2D
  765. 0x6E61C800u, // FCVTAU V0.2D, V0.2D
  766. 0x4E61B800u, // FCVTMS V0.2D, V0.2D
  767. 0x4E61A800u, // FCVTNS V0.2D, V0.2D
  768. 0x6E61A800u, // FCVTNU V0.2D, V0.2D
  769. 0x4EE1B800u, // FCVTZS V0.2D, V0.2D
  770. 0x6EE1B800u // FCVTZU V0.2D, V0.2D
  771. };
  772. }
  773. private static uint[] _F_Cvtl_V_4H4S_8H4S_()
  774. {
  775. return new[]
  776. {
  777. 0x0E217800u // FCVTL V0.4S, V0.4H
  778. };
  779. }
  780. private static uint[] _F_Cvtl_V_2S2D_4S2D_()
  781. {
  782. return new[]
  783. {
  784. 0x0E617800u // FCVTL V0.2D, V0.2S
  785. };
  786. }
  787. private static uint[] _F_Cvtn_V_4S4H_4S8H_()
  788. {
  789. return new[]
  790. {
  791. 0x0E216800u // FCVTN V0.4H, V0.4S
  792. };
  793. }
  794. private static uint[] _F_Cvtn_V_2D2S_2D4S_()
  795. {
  796. return new[]
  797. {
  798. 0x0E616800u // FCVTN V0.2S, V0.2D
  799. };
  800. }
  801. private static uint[] _F_Max_Min_Nm_V_V_4SS_()
  802. {
  803. return new[]
  804. {
  805. 0x6E30C800u, // FMAXNMV S0, V0.4S
  806. 0x6E30F800u, // FMAXV S0, V0.4S
  807. 0x6EB0C800u, // FMINNMV S0, V0.4S
  808. 0x6EB0F800u // FMINV S0, V0.4S
  809. };
  810. }
  811. private static uint[] _F_Mov_Ftoi_SW_()
  812. {
  813. return new[]
  814. {
  815. 0x1E260000u // FMOV W0, S0
  816. };
  817. }
  818. private static uint[] _F_Mov_Ftoi_DX_()
  819. {
  820. return new[]
  821. {
  822. 0x9E660000u // FMOV X0, D0
  823. };
  824. }
  825. private static uint[] _F_Mov_Ftoi1_DX_()
  826. {
  827. return new[]
  828. {
  829. 0x9EAE0000u // FMOV X0, V0.D[1]
  830. };
  831. }
  832. private static uint[] _F_Mov_Itof_WS_()
  833. {
  834. return new[]
  835. {
  836. 0x1E270000u // FMOV S0, W0
  837. };
  838. }
  839. private static uint[] _F_Mov_Itof_XD_()
  840. {
  841. return new[]
  842. {
  843. 0x9E670000u // FMOV D0, X0
  844. };
  845. }
  846. private static uint[] _F_Mov_Itof1_XD_()
  847. {
  848. return new[]
  849. {
  850. 0x9EAF0000u // FMOV V0.D[1], X0
  851. };
  852. }
  853. private static uint[] _F_Mov_S_S_()
  854. {
  855. return new[]
  856. {
  857. 0x1E204020u // FMOV S0, S1
  858. };
  859. }
  860. private static uint[] _F_Mov_S_D_()
  861. {
  862. return new[]
  863. {
  864. 0x1E604020u // FMOV D0, D1
  865. };
  866. }
  867. private static uint[] _F_Recpe_Rsqrte_S_S_()
  868. {
  869. return new[]
  870. {
  871. 0x5EA1D820u, // FRECPE S0, S1
  872. 0x7EA1D820u // FRSQRTE S0, S1
  873. };
  874. }
  875. private static uint[] _F_Recpe_Rsqrte_S_D_()
  876. {
  877. return new[]
  878. {
  879. 0x5EE1D820u, // FRECPE D0, D1
  880. 0x7EE1D820u // FRSQRTE D0, D1
  881. };
  882. }
  883. private static uint[] _F_Recpe_Rsqrte_V_2S_4S_()
  884. {
  885. return new[]
  886. {
  887. 0x0EA1D800u, // FRECPE V0.2S, V0.2S
  888. 0x2EA1D800u // FRSQRTE V0.2S, V0.2S
  889. };
  890. }
  891. private static uint[] _F_Recpe_Rsqrte_V_2D_()
  892. {
  893. return new[]
  894. {
  895. 0x4EE1D800u, // FRECPE V0.2D, V0.2D
  896. 0x6EE1D800u // FRSQRTE V0.2D, V0.2D
  897. };
  898. }
  899. private static uint[] _F_Rint_AMNPZ_S_S_()
  900. {
  901. return new[]
  902. {
  903. 0x1E264020u, // FRINTA S0, S1
  904. 0x1E254020u, // FRINTM S0, S1
  905. 0x1E244020u, // FRINTN S0, S1
  906. 0x1E24C020u, // FRINTP S0, S1
  907. 0x1E25C020u // FRINTZ S0, S1
  908. };
  909. }
  910. private static uint[] _F_Rint_AMNPZ_S_D_()
  911. {
  912. return new[]
  913. {
  914. 0x1E664020u, // FRINTA D0, D1
  915. 0x1E654020u, // FRINTM D0, D1
  916. 0x1E644020u, // FRINTN D0, D1
  917. 0x1E64C020u, // FRINTP D0, D1
  918. 0x1E65C020u // FRINTZ D0, D1
  919. };
  920. }
  921. private static uint[] _F_Rint_AMNPZ_V_2S_4S_()
  922. {
  923. return new[]
  924. {
  925. 0x2E218800u, // FRINTA V0.2S, V0.2S
  926. 0x0E219800u, // FRINTM V0.2S, V0.2S
  927. 0x0E218800u, // FRINTN V0.2S, V0.2S
  928. 0x0EA18800u, // FRINTP V0.2S, V0.2S
  929. 0x0EA19800u // FRINTZ V0.2S, V0.2S
  930. };
  931. }
  932. private static uint[] _F_Rint_AMNPZ_V_2D_()
  933. {
  934. return new[]
  935. {
  936. 0x6E618800u, // FRINTA V0.2D, V0.2D
  937. 0x4E619800u, // FRINTM V0.2D, V0.2D
  938. 0x4E618800u, // FRINTN V0.2D, V0.2D
  939. 0x4EE18800u, // FRINTP V0.2D, V0.2D
  940. 0x4EE19800u // FRINTZ V0.2D, V0.2D
  941. };
  942. }
  943. private static uint[] _F_Rint_IX_S_S_()
  944. {
  945. return new[]
  946. {
  947. 0x1E27C020u, // FRINTI S0, S1
  948. 0x1E274020u // FRINTX S0, S1
  949. };
  950. }
  951. private static uint[] _F_Rint_IX_S_D_()
  952. {
  953. return new[]
  954. {
  955. 0x1E67C020u, // FRINTI D0, D1
  956. 0x1E674020u // FRINTX D0, D1
  957. };
  958. }
  959. private static uint[] _F_Rint_IX_V_2S_4S_()
  960. {
  961. return new[]
  962. {
  963. 0x2EA19800u, // FRINTI V0.2S, V0.2S
  964. 0x2E219800u // FRINTX V0.2S, V0.2S
  965. };
  966. }
  967. private static uint[] _F_Rint_IX_V_2D_()
  968. {
  969. return new[]
  970. {
  971. 0x6EE19800u, // FRINTI V0.2D, V0.2D
  972. 0x6E619800u // FRINTX V0.2D, V0.2D
  973. };
  974. }
  975. private static uint[] _SU_Addl_V_V_8BH_4HS_()
  976. {
  977. return new[]
  978. {
  979. 0x0E303800u, // SADDLV H0, V0.8B
  980. 0x2E303800u // UADDLV H0, V0.8B
  981. };
  982. }
  983. private static uint[] _SU_Addl_V_V_16BH_8HS_4SD_()
  984. {
  985. return new[]
  986. {
  987. 0x4E303800u, // SADDLV H0, V0.16B
  988. 0x6E303800u // UADDLV H0, V0.16B
  989. };
  990. }
  991. private static uint[] _SU_Cvt_F_S_S_()
  992. {
  993. return new[]
  994. {
  995. 0x5E21D820u, // SCVTF S0, S1
  996. 0x7E21D820u // UCVTF S0, S1
  997. };
  998. }
  999. private static uint[] _SU_Cvt_F_S_D_()
  1000. {
  1001. return new[]
  1002. {
  1003. 0x5E61D820u, // SCVTF D0, D1
  1004. 0x7E61D820u // UCVTF D0, D1
  1005. };
  1006. }
  1007. private static uint[] _SU_Cvt_F_V_2S_4S_()
  1008. {
  1009. return new[]
  1010. {
  1011. 0x0E21D800u, // SCVTF V0.2S, V0.2S
  1012. 0x2E21D800u // UCVTF V0.2S, V0.2S
  1013. };
  1014. }
  1015. private static uint[] _SU_Cvt_F_V_2D_()
  1016. {
  1017. return new[]
  1018. {
  1019. 0x4E61D800u, // SCVTF V0.2D, V0.2D
  1020. 0x6E61D800u // UCVTF V0.2D, V0.2D
  1021. };
  1022. }
  1023. private static uint[] _Sha1h_Sha1su1_V_()
  1024. {
  1025. return new[]
  1026. {
  1027. 0x5E280800u, // SHA1H S0, S0
  1028. 0x5E281800u // SHA1SU1 V0.4S, V0.4S
  1029. };
  1030. }
  1031. private static uint[] _Sha256su0_V_()
  1032. {
  1033. return new[]
  1034. {
  1035. 0x5E282800u // SHA256SU0 V0.4S, V0.4S
  1036. };
  1037. }
  1038. #endregion
  1039. private const int RndCnt = 2;
  1040. private static readonly bool NoZeros = false;
  1041. private static readonly bool NoInfs = false;
  1042. private static readonly bool NoNaNs = false;
  1043. [Test, Pairwise, Description("ABS <V><d>, <V><n>")]
  1044. public void Abs_S_D([Values(0u)] uint rd,
  1045. [Values(1u, 0u)] uint rn,
  1046. [ValueSource(nameof(_1D_))] ulong z,
  1047. [ValueSource(nameof(_1D_))] ulong a)
  1048. {
  1049. uint opcode = 0x5EE0B800; // ABS D0, D0
  1050. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1051. V128 v0 = MakeVectorE0E1(z, z);
  1052. V128 v1 = MakeVectorE0(a);
  1053. SingleOpcode(opcode, v0: v0, v1: v1);
  1054. CompareAgainstUnicorn();
  1055. }
  1056. [Test, Pairwise, Description("ABS <Vd>.<T>, <Vn>.<T>")]
  1057. public void Abs_V_8B_4H_2S([Values(0u)] uint rd,
  1058. [Values(1u, 0u)] uint rn,
  1059. [ValueSource(nameof(_8B4H2S_))] ulong z,
  1060. [ValueSource(nameof(_8B4H2S_))] ulong a,
  1061. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  1062. {
  1063. uint opcode = 0x0E20B800; // ABS V0.8B, V0.8B
  1064. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1065. opcode |= ((size & 3) << 22);
  1066. V128 v0 = MakeVectorE0E1(z, z);
  1067. V128 v1 = MakeVectorE0(a);
  1068. SingleOpcode(opcode, v0: v0, v1: v1);
  1069. CompareAgainstUnicorn();
  1070. }
  1071. [Test, Pairwise, Description("ABS <Vd>.<T>, <Vn>.<T>")]
  1072. public void Abs_V_16B_8H_4S_2D([Values(0u)] uint rd,
  1073. [Values(1u, 0u)] uint rn,
  1074. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  1075. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  1076. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  1077. {
  1078. uint opcode = 0x4E20B800; // ABS V0.16B, V0.16B
  1079. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1080. opcode |= ((size & 3) << 22);
  1081. V128 v0 = MakeVectorE0E1(z, z);
  1082. V128 v1 = MakeVectorE0E1(a, a);
  1083. SingleOpcode(opcode, v0: v0, v1: v1);
  1084. CompareAgainstUnicorn();
  1085. }
  1086. [Test, Pairwise, Description("ADDP <V><d>, <Vn>.<T>")]
  1087. public void Addp_S_2DD([Values(0u)] uint rd,
  1088. [Values(1u, 0u)] uint rn,
  1089. [ValueSource(nameof(_1D_))] ulong z,
  1090. [ValueSource(nameof(_1D_))] ulong a)
  1091. {
  1092. uint opcode = 0x5EF1B800; // ADDP D0, V0.2D
  1093. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1094. V128 v0 = MakeVectorE0E1(z, z);
  1095. V128 v1 = MakeVectorE0E1(a, a);
  1096. SingleOpcode(opcode, v0: v0, v1: v1);
  1097. CompareAgainstUnicorn();
  1098. }
  1099. [Test, Pairwise]
  1100. public void SU_Add_Max_Min_V_V_8BB_4HH([ValueSource(nameof(_SU_Add_Max_Min_V_V_8BB_4HH_))] uint opcodes,
  1101. [Values(0u)] uint rd,
  1102. [Values(1u, 0u)] uint rn,
  1103. [ValueSource(nameof(_8B4H_))] ulong z,
  1104. [ValueSource(nameof(_8B4H_))] ulong a,
  1105. [Values(0b00u, 0b01u)] uint size) // <8BB, 4HH>
  1106. {
  1107. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1108. opcodes |= ((size & 3) << 22);
  1109. V128 v0 = MakeVectorE0E1(z, z);
  1110. V128 v1 = MakeVectorE0(a);
  1111. SingleOpcode(opcodes, v0: v0, v1: v1);
  1112. CompareAgainstUnicorn();
  1113. }
  1114. [Test, Pairwise]
  1115. public void SU_Add_Max_Min_V_V_16BB_8HH_4SS([ValueSource(nameof(_SU_Add_Max_Min_V_V_16BB_8HH_4SS_))] uint opcodes,
  1116. [Values(0u)] uint rd,
  1117. [Values(1u, 0u)] uint rn,
  1118. [ValueSource(nameof(_8B4H2S_))] ulong z,
  1119. [ValueSource(nameof(_8B4H2S_))] ulong a,
  1120. [Values(0b00u, 0b01u, 0b10u)] uint size) // <16BB, 8HH, 4SS>
  1121. {
  1122. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1123. opcodes |= ((size & 3) << 22);
  1124. V128 v0 = MakeVectorE0E1(z, z);
  1125. V128 v1 = MakeVectorE0E1(a, a);
  1126. SingleOpcode(opcodes, v0: v0, v1: v1);
  1127. CompareAgainstUnicorn();
  1128. }
  1129. [Test, Pairwise, Description("CLS <Vd>.<T>, <Vn>.<T>")]
  1130. public void Cls_V_8B_16B([Values(0u)] uint rd,
  1131. [Values(1u, 0u)] uint rn,
  1132. [ValueSource(nameof(_8B_))] [Random(RndCnt)] ulong z,
  1133. [ValueSource(nameof(_GenLeadingSigns8B_))] ulong a,
  1134. [Values(0b0u, 0b1u)] uint q) // <8B, 16B>
  1135. {
  1136. uint opcode = 0x0E204800; // CLS V0.8B, V0.8B
  1137. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1138. opcode |= ((q & 1) << 30);
  1139. V128 v0 = MakeVectorE0E1(z, z);
  1140. V128 v1 = MakeVectorE0E1(a, a * q);
  1141. SingleOpcode(opcode, v0: v0, v1: v1);
  1142. CompareAgainstUnicorn();
  1143. }
  1144. [Test, Pairwise, Description("CLS <Vd>.<T>, <Vn>.<T>")]
  1145. public void Cls_V_4H_8H([Values(0u)] uint rd,
  1146. [Values(1u, 0u)] uint rn,
  1147. [ValueSource(nameof(_4H_))] [Random(RndCnt)] ulong z,
  1148. [ValueSource(nameof(_GenLeadingSigns4H_))] ulong a,
  1149. [Values(0b0u, 0b1u)] uint q) // <4H, 8H>
  1150. {
  1151. uint opcode = 0x0E604800; // CLS V0.4H, V0.4H
  1152. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1153. opcode |= ((q & 1) << 30);
  1154. V128 v0 = MakeVectorE0E1(z, z);
  1155. V128 v1 = MakeVectorE0E1(a, a * q);
  1156. SingleOpcode(opcode, v0: v0, v1: v1);
  1157. CompareAgainstUnicorn();
  1158. }
  1159. [Test, Pairwise, Description("CLS <Vd>.<T>, <Vn>.<T>")]
  1160. public void Cls_V_2S_4S([Values(0u)] uint rd,
  1161. [Values(1u, 0u)] uint rn,
  1162. [ValueSource(nameof(_2S_))] [Random(RndCnt)] ulong z,
  1163. [ValueSource(nameof(_GenLeadingSigns2S_))] ulong a,
  1164. [Values(0b0u, 0b1u)] uint q) // <2S, 4S>
  1165. {
  1166. uint opcode = 0x0EA04800; // CLS V0.2S, V0.2S
  1167. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1168. opcode |= ((q & 1) << 30);
  1169. V128 v0 = MakeVectorE0E1(z, z);
  1170. V128 v1 = MakeVectorE0E1(a, a * q);
  1171. SingleOpcode(opcode, v0: v0, v1: v1);
  1172. CompareAgainstUnicorn();
  1173. }
  1174. [Test, Pairwise, Description("CLZ <Vd>.<T>, <Vn>.<T>")]
  1175. public void Clz_V_8B_16B([Values(0u)] uint rd,
  1176. [Values(1u, 0u)] uint rn,
  1177. [ValueSource(nameof(_8B_))] [Random(RndCnt)] ulong z,
  1178. [ValueSource(nameof(_GenLeadingZeros8B_))] ulong a,
  1179. [Values(0b0u, 0b1u)] uint q) // <8B, 16B>
  1180. {
  1181. uint opcode = 0x2E204800; // CLZ V0.8B, V0.8B
  1182. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1183. opcode |= ((q & 1) << 30);
  1184. V128 v0 = MakeVectorE0E1(z, z);
  1185. V128 v1 = MakeVectorE0E1(a, a * q);
  1186. SingleOpcode(opcode, v0: v0, v1: v1);
  1187. CompareAgainstUnicorn();
  1188. }
  1189. [Test, Pairwise, Description("CLZ <Vd>.<T>, <Vn>.<T>")]
  1190. public void Clz_V_4H_8H([Values(0u)] uint rd,
  1191. [Values(1u, 0u)] uint rn,
  1192. [ValueSource(nameof(_4H_))] [Random(RndCnt)] ulong z,
  1193. [ValueSource(nameof(_GenLeadingZeros4H_))] ulong a,
  1194. [Values(0b0u, 0b1u)] uint q) // <4H, 8H>
  1195. {
  1196. uint opcode = 0x2E604800; // CLZ V0.4H, V0.4H
  1197. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1198. opcode |= ((q & 1) << 30);
  1199. V128 v0 = MakeVectorE0E1(z, z);
  1200. V128 v1 = MakeVectorE0E1(a, a * q);
  1201. SingleOpcode(opcode, v0: v0, v1: v1);
  1202. CompareAgainstUnicorn();
  1203. }
  1204. [Test, Pairwise, Description("CLZ <Vd>.<T>, <Vn>.<T>")]
  1205. public void Clz_V_2S_4S([Values(0u)] uint rd,
  1206. [Values(1u, 0u)] uint rn,
  1207. [ValueSource(nameof(_2S_))] [Random(RndCnt)] ulong z,
  1208. [ValueSource(nameof(_GenLeadingZeros2S_))] ulong a,
  1209. [Values(0b0u, 0b1u)] uint q) // <2S, 4S>
  1210. {
  1211. uint opcode = 0x2EA04800; // CLZ V0.2S, V0.2S
  1212. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1213. opcode |= ((q & 1) << 30);
  1214. V128 v0 = MakeVectorE0E1(z, z);
  1215. V128 v1 = MakeVectorE0E1(a, a * q);
  1216. SingleOpcode(opcode, v0: v0, v1: v1);
  1217. CompareAgainstUnicorn();
  1218. }
  1219. [Test, Pairwise, Description("CMEQ <V><d>, <V><n>, #0")]
  1220. public void Cmeq_S_D([Values(0u)] uint rd,
  1221. [Values(1u, 0u)] uint rn,
  1222. [ValueSource(nameof(_1D_))] ulong z,
  1223. [ValueSource(nameof(_1D_))] ulong a)
  1224. {
  1225. uint opcode = 0x5EE09800; // CMEQ D0, D0, #0
  1226. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1227. V128 v0 = MakeVectorE0E1(z, z);
  1228. V128 v1 = MakeVectorE0(a);
  1229. SingleOpcode(opcode, v0: v0, v1: v1);
  1230. CompareAgainstUnicorn();
  1231. }
  1232. [Test, Pairwise, Description("CMEQ <Vd>.<T>, <Vn>.<T>, #0")]
  1233. public void Cmeq_V_8B_4H_2S([Values(0u)] uint rd,
  1234. [Values(1u, 0u)] uint rn,
  1235. [ValueSource(nameof(_8B4H2S_))] ulong z,
  1236. [ValueSource(nameof(_8B4H2S_))] ulong a,
  1237. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  1238. {
  1239. uint opcode = 0x0E209800; // CMEQ V0.8B, V0.8B, #0
  1240. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1241. opcode |= ((size & 3) << 22);
  1242. V128 v0 = MakeVectorE0E1(z, z);
  1243. V128 v1 = MakeVectorE0(a);
  1244. SingleOpcode(opcode, v0: v0, v1: v1);
  1245. CompareAgainstUnicorn();
  1246. }
  1247. [Test, Pairwise, Description("CMEQ <Vd>.<T>, <Vn>.<T>, #0")]
  1248. public void Cmeq_V_16B_8H_4S_2D([Values(0u)] uint rd,
  1249. [Values(1u, 0u)] uint rn,
  1250. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  1251. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  1252. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  1253. {
  1254. uint opcode = 0x4E209800; // CMEQ V0.16B, V0.16B, #0
  1255. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1256. opcode |= ((size & 3) << 22);
  1257. V128 v0 = MakeVectorE0E1(z, z);
  1258. V128 v1 = MakeVectorE0E1(a, a);
  1259. SingleOpcode(opcode, v0: v0, v1: v1);
  1260. CompareAgainstUnicorn();
  1261. }
  1262. [Test, Pairwise, Description("CMGE <V><d>, <V><n>, #0")]
  1263. public void Cmge_S_D([Values(0u)] uint rd,
  1264. [Values(1u, 0u)] uint rn,
  1265. [ValueSource(nameof(_1D_))] ulong z,
  1266. [ValueSource(nameof(_1D_))] ulong a)
  1267. {
  1268. uint opcode = 0x7EE08800; // CMGE D0, D0, #0
  1269. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1270. V128 v0 = MakeVectorE0E1(z, z);
  1271. V128 v1 = MakeVectorE0(a);
  1272. SingleOpcode(opcode, v0: v0, v1: v1);
  1273. CompareAgainstUnicorn();
  1274. }
  1275. [Test, Pairwise, Description("CMGE <Vd>.<T>, <Vn>.<T>, #0")]
  1276. public void Cmge_V_8B_4H_2S([Values(0u)] uint rd,
  1277. [Values(1u, 0u)] uint rn,
  1278. [ValueSource(nameof(_8B4H2S_))] ulong z,
  1279. [ValueSource(nameof(_8B4H2S_))] ulong a,
  1280. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  1281. {
  1282. uint opcode = 0x2E208800; // CMGE V0.8B, V0.8B, #0
  1283. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1284. opcode |= ((size & 3) << 22);
  1285. V128 v0 = MakeVectorE0E1(z, z);
  1286. V128 v1 = MakeVectorE0(a);
  1287. SingleOpcode(opcode, v0: v0, v1: v1);
  1288. CompareAgainstUnicorn();
  1289. }
  1290. [Test, Pairwise, Description("CMGE <Vd>.<T>, <Vn>.<T>, #0")]
  1291. public void Cmge_V_16B_8H_4S_2D([Values(0u)] uint rd,
  1292. [Values(1u, 0u)] uint rn,
  1293. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  1294. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  1295. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  1296. {
  1297. uint opcode = 0x6E208800; // CMGE V0.16B, V0.16B, #0
  1298. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1299. opcode |= ((size & 3) << 22);
  1300. V128 v0 = MakeVectorE0E1(z, z);
  1301. V128 v1 = MakeVectorE0E1(a, a);
  1302. SingleOpcode(opcode, v0: v0, v1: v1);
  1303. CompareAgainstUnicorn();
  1304. }
  1305. [Test, Pairwise, Description("CMGT <V><d>, <V><n>, #0")]
  1306. public void Cmgt_S_D([Values(0u)] uint rd,
  1307. [Values(1u, 0u)] uint rn,
  1308. [ValueSource(nameof(_1D_))] ulong z,
  1309. [ValueSource(nameof(_1D_))] ulong a)
  1310. {
  1311. uint opcode = 0x5EE08800; // CMGT D0, D0, #0
  1312. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1313. V128 v0 = MakeVectorE0E1(z, z);
  1314. V128 v1 = MakeVectorE0(a);
  1315. SingleOpcode(opcode, v0: v0, v1: v1);
  1316. CompareAgainstUnicorn();
  1317. }
  1318. [Test, Pairwise, Description("CMGT <Vd>.<T>, <Vn>.<T>, #0")]
  1319. public void Cmgt_V_8B_4H_2S([Values(0u)] uint rd,
  1320. [Values(1u, 0u)] uint rn,
  1321. [ValueSource(nameof(_8B4H2S_))] ulong z,
  1322. [ValueSource(nameof(_8B4H2S_))] ulong a,
  1323. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  1324. {
  1325. uint opcode = 0x0E208800; // CMGT V0.8B, V0.8B, #0
  1326. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1327. opcode |= ((size & 3) << 22);
  1328. V128 v0 = MakeVectorE0E1(z, z);
  1329. V128 v1 = MakeVectorE0(a);
  1330. SingleOpcode(opcode, v0: v0, v1: v1);
  1331. CompareAgainstUnicorn();
  1332. }
  1333. [Test, Pairwise, Description("CMGT <Vd>.<T>, <Vn>.<T>, #0")]
  1334. public void Cmgt_V_16B_8H_4S_2D([Values(0u)] uint rd,
  1335. [Values(1u, 0u)] uint rn,
  1336. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  1337. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  1338. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  1339. {
  1340. uint opcode = 0x4E208800; // CMGT V0.16B, V0.16B, #0
  1341. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1342. opcode |= ((size & 3) << 22);
  1343. V128 v0 = MakeVectorE0E1(z, z);
  1344. V128 v1 = MakeVectorE0E1(a, a);
  1345. SingleOpcode(opcode, v0: v0, v1: v1);
  1346. CompareAgainstUnicorn();
  1347. }
  1348. [Test, Pairwise, Description("CMLE <V><d>, <V><n>, #0")]
  1349. public void Cmle_S_D([Values(0u)] uint rd,
  1350. [Values(1u, 0u)] uint rn,
  1351. [ValueSource(nameof(_1D_))] ulong z,
  1352. [ValueSource(nameof(_1D_))] ulong a)
  1353. {
  1354. uint opcode = 0x7EE09800; // CMLE D0, D0, #0
  1355. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1356. V128 v0 = MakeVectorE0E1(z, z);
  1357. V128 v1 = MakeVectorE0(a);
  1358. SingleOpcode(opcode, v0: v0, v1: v1);
  1359. CompareAgainstUnicorn();
  1360. }
  1361. [Test, Pairwise, Description("CMLE <Vd>.<T>, <Vn>.<T>, #0")]
  1362. public void Cmle_V_8B_4H_2S([Values(0u)] uint rd,
  1363. [Values(1u, 0u)] uint rn,
  1364. [ValueSource(nameof(_8B4H2S_))] ulong z,
  1365. [ValueSource(nameof(_8B4H2S_))] ulong a,
  1366. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  1367. {
  1368. uint opcode = 0x2E209800; // CMLE V0.8B, V0.8B, #0
  1369. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1370. opcode |= ((size & 3) << 22);
  1371. V128 v0 = MakeVectorE0E1(z, z);
  1372. V128 v1 = MakeVectorE0(a);
  1373. SingleOpcode(opcode, v0: v0, v1: v1);
  1374. CompareAgainstUnicorn();
  1375. }
  1376. [Test, Pairwise, Description("CMLE <Vd>.<T>, <Vn>.<T>, #0")]
  1377. public void Cmle_V_16B_8H_4S_2D([Values(0u)] uint rd,
  1378. [Values(1u, 0u)] uint rn,
  1379. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  1380. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  1381. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  1382. {
  1383. uint opcode = 0x6E209800; // CMLE V0.16B, V0.16B, #0
  1384. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1385. opcode |= ((size & 3) << 22);
  1386. V128 v0 = MakeVectorE0E1(z, z);
  1387. V128 v1 = MakeVectorE0E1(a, a);
  1388. SingleOpcode(opcode, v0: v0, v1: v1);
  1389. CompareAgainstUnicorn();
  1390. }
  1391. [Test, Pairwise, Description("CMLT <V><d>, <V><n>, #0")]
  1392. public void Cmlt_S_D([Values(0u)] uint rd,
  1393. [Values(1u, 0u)] uint rn,
  1394. [ValueSource(nameof(_1D_))] ulong z,
  1395. [ValueSource(nameof(_1D_))] ulong a)
  1396. {
  1397. uint opcode = 0x5EE0A800; // CMLT D0, D0, #0
  1398. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1399. V128 v0 = MakeVectorE0E1(z, z);
  1400. V128 v1 = MakeVectorE0(a);
  1401. SingleOpcode(opcode, v0: v0, v1: v1);
  1402. CompareAgainstUnicorn();
  1403. }
  1404. [Test, Pairwise, Description("CMLT <Vd>.<T>, <Vn>.<T>, #0")]
  1405. public void Cmlt_V_8B_4H_2S([Values(0u)] uint rd,
  1406. [Values(1u, 0u)] uint rn,
  1407. [ValueSource(nameof(_8B4H2S_))] ulong z,
  1408. [ValueSource(nameof(_8B4H2S_))] ulong a,
  1409. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  1410. {
  1411. uint opcode = 0x0E20A800; // CMLT V0.8B, V0.8B, #0
  1412. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1413. opcode |= ((size & 3) << 22);
  1414. V128 v0 = MakeVectorE0E1(z, z);
  1415. V128 v1 = MakeVectorE0(a);
  1416. SingleOpcode(opcode, v0: v0, v1: v1);
  1417. CompareAgainstUnicorn();
  1418. }
  1419. [Test, Pairwise, Description("CMLT <Vd>.<T>, <Vn>.<T>, #0")]
  1420. public void Cmlt_V_16B_8H_4S_2D([Values(0u)] uint rd,
  1421. [Values(1u, 0u)] uint rn,
  1422. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  1423. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  1424. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  1425. {
  1426. uint opcode = 0x4E20A800; // CMLT V0.16B, V0.16B, #0
  1427. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1428. opcode |= ((size & 3) << 22);
  1429. V128 v0 = MakeVectorE0E1(z, z);
  1430. V128 v1 = MakeVectorE0E1(a, a);
  1431. SingleOpcode(opcode, v0: v0, v1: v1);
  1432. CompareAgainstUnicorn();
  1433. }
  1434. [Test, Pairwise, Description("CNT <Vd>.<T>, <Vn>.<T>")]
  1435. public void Cnt_V_8B([Values(0u)] uint rd,
  1436. [Values(1u, 0u)] uint rn,
  1437. [ValueSource(nameof(_8B_))] [Random(RndCnt)] ulong z,
  1438. [ValueSource(nameof(_GenPopCnt8B_))] ulong a)
  1439. {
  1440. uint opcode = 0x0E205800; // CNT V0.8B, V0.8B
  1441. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1442. V128 v0 = MakeVectorE0E1(z, z);
  1443. V128 v1 = MakeVectorE0(a);
  1444. SingleOpcode(opcode, v0: v0, v1: v1);
  1445. CompareAgainstUnicorn();
  1446. }
  1447. [Test, Pairwise, Description("CNT <Vd>.<T>, <Vn>.<T>")]
  1448. public void Cnt_V_16B([Values(0u)] uint rd,
  1449. [Values(1u, 0u)] uint rn,
  1450. [ValueSource(nameof(_8B_))] [Random(RndCnt)] ulong z,
  1451. [ValueSource(nameof(_GenPopCnt8B_))] ulong a)
  1452. {
  1453. uint opcode = 0x4E205800; // CNT V0.16B, V0.16B
  1454. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1455. V128 v0 = MakeVectorE0E1(z, z);
  1456. V128 v1 = MakeVectorE0E1(a, a);
  1457. SingleOpcode(opcode, v0: v0, v1: v1);
  1458. CompareAgainstUnicorn();
  1459. }
  1460. [Test, Pairwise] [Explicit]
  1461. public void F_Abs_Neg_Recpx_Sqrt_S_S([ValueSource(nameof(_F_Abs_Neg_Recpx_Sqrt_S_S_))] uint opcodes,
  1462. [ValueSource(nameof(_1S_F_))] ulong a)
  1463. {
  1464. ulong z = TestContext.CurrentContext.Random.NextULong();
  1465. V128 v0 = MakeVectorE0E1(z, z);
  1466. V128 v1 = MakeVectorE0(a);
  1467. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1468. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1469. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1470. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1471. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1472. }
  1473. [Test, Pairwise] [Explicit]
  1474. public void F_Abs_Neg_Recpx_Sqrt_S_D([ValueSource(nameof(_F_Abs_Neg_Recpx_Sqrt_S_D_))] uint opcodes,
  1475. [ValueSource(nameof(_1D_F_))] ulong a)
  1476. {
  1477. ulong z = TestContext.CurrentContext.Random.NextULong();
  1478. V128 v0 = MakeVectorE1(z);
  1479. V128 v1 = MakeVectorE0(a);
  1480. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1481. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1482. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1483. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1484. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1485. }
  1486. [Test, Pairwise] [Explicit]
  1487. public void F_Abs_Neg_Sqrt_V_2S_4S([ValueSource(nameof(_F_Abs_Neg_Sqrt_V_2S_4S_))] uint opcodes,
  1488. [Values(0u)] uint rd,
  1489. [Values(1u, 0u)] uint rn,
  1490. [ValueSource(nameof(_2S_F_))] ulong z,
  1491. [ValueSource(nameof(_2S_F_))] ulong a,
  1492. [Values(0b0u, 0b1u)] uint q) // <2S, 4S>
  1493. {
  1494. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1495. opcodes |= ((q & 1) << 30);
  1496. V128 v0 = MakeVectorE0E1(z, z);
  1497. V128 v1 = MakeVectorE0E1(a, a * q);
  1498. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1499. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1500. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1501. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1502. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1503. }
  1504. [Test, Pairwise] [Explicit]
  1505. public void F_Abs_Neg_Sqrt_V_2D([ValueSource(nameof(_F_Abs_Neg_Sqrt_V_2D_))] uint opcodes,
  1506. [Values(0u)] uint rd,
  1507. [Values(1u, 0u)] uint rn,
  1508. [ValueSource(nameof(_1D_F_))] ulong z,
  1509. [ValueSource(nameof(_1D_F_))] ulong a)
  1510. {
  1511. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1512. V128 v0 = MakeVectorE0E1(z, z);
  1513. V128 v1 = MakeVectorE0E1(a, a);
  1514. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1515. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1516. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1517. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1518. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1519. }
  1520. [Test, Pairwise] [Explicit]
  1521. public void F_Add_Max_Min_Nm_P_S_2SS([ValueSource(nameof(_F_Add_Max_Min_Nm_P_S_2SS_))] uint opcodes,
  1522. [ValueSource(nameof(_2S_F_))] ulong a)
  1523. {
  1524. ulong z = TestContext.CurrentContext.Random.NextULong();
  1525. V128 v0 = MakeVectorE0E1(z, z);
  1526. V128 v1 = MakeVectorE0E1(a, z);
  1527. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1528. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1529. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1530. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1531. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1532. }
  1533. [Test, Pairwise] [Explicit]
  1534. public void F_Add_Max_Min_Nm_P_S_2DD([ValueSource(nameof(_F_Add_Max_Min_Nm_P_S_2DD_))] uint opcodes,
  1535. [ValueSource(nameof(_1D_F_))] ulong a0,
  1536. [ValueSource(nameof(_1D_F_))] ulong a1)
  1537. {
  1538. ulong z = TestContext.CurrentContext.Random.NextULong();
  1539. V128 v0 = MakeVectorE0E1(z, z);
  1540. V128 v1 = MakeVectorE0E1(a0, a1);
  1541. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1542. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1543. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1544. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1545. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1546. }
  1547. [Test, Pairwise] [Explicit]
  1548. public void F_Cm_EqGeGtLeLt_S_S([ValueSource(nameof(_F_Cm_EqGeGtLeLt_S_S_))] uint opcodes,
  1549. [ValueSource(nameof(_1S_F_))] ulong a)
  1550. {
  1551. ulong z = TestContext.CurrentContext.Random.NextULong();
  1552. V128 v0 = MakeVectorE0E1(z, z);
  1553. V128 v1 = MakeVectorE0(a);
  1554. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1555. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1556. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1557. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1558. }
  1559. [Test, Pairwise] [Explicit]
  1560. public void F_Cm_EqGeGtLeLt_S_D([ValueSource(nameof(_F_Cm_EqGeGtLeLt_S_D_))] uint opcodes,
  1561. [ValueSource(nameof(_1D_F_))] ulong a)
  1562. {
  1563. ulong z = TestContext.CurrentContext.Random.NextULong();
  1564. V128 v0 = MakeVectorE1(z);
  1565. V128 v1 = MakeVectorE0(a);
  1566. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1567. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1568. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1569. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1570. }
  1571. [Test, Pairwise] [Explicit]
  1572. public void F_Cm_EqGeGtLeLt_V_2S_4S([ValueSource(nameof(_F_Cm_EqGeGtLeLt_V_2S_4S_))] uint opcodes,
  1573. [Values(0u)] uint rd,
  1574. [Values(1u, 0u)] uint rn,
  1575. [ValueSource(nameof(_2S_F_))] ulong z,
  1576. [ValueSource(nameof(_2S_F_))] ulong a,
  1577. [Values(0b0u, 0b1u)] uint q) // <2S, 4S>
  1578. {
  1579. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1580. opcodes |= ((q & 1) << 30);
  1581. V128 v0 = MakeVectorE0E1(z, z);
  1582. V128 v1 = MakeVectorE0E1(a, a * q);
  1583. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1584. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1585. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1586. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1587. }
  1588. [Test, Pairwise] [Explicit]
  1589. public void F_Cm_EqGeGtLeLt_V_2D([ValueSource(nameof(_F_Cm_EqGeGtLeLt_V_2D_))] uint opcodes,
  1590. [Values(0u)] uint rd,
  1591. [Values(1u, 0u)] uint rn,
  1592. [ValueSource(nameof(_1D_F_))] ulong z,
  1593. [ValueSource(nameof(_1D_F_))] ulong a)
  1594. {
  1595. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1596. V128 v0 = MakeVectorE0E1(z, z);
  1597. V128 v1 = MakeVectorE0E1(a, a);
  1598. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1599. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1600. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1601. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1602. }
  1603. [Test, Pairwise] [Explicit]
  1604. public void F_Cmp_Cmpe_S_S([ValueSource(nameof(_F_Cmp_Cmpe_S_S_))] uint opcodes,
  1605. [ValueSource(nameof(_1S_F_))] ulong a)
  1606. {
  1607. V128 v1 = MakeVectorE0(a);
  1608. bool v = TestContext.CurrentContext.Random.NextBool();
  1609. bool c = TestContext.CurrentContext.Random.NextBool();
  1610. bool z = TestContext.CurrentContext.Random.NextBool();
  1611. bool n = TestContext.CurrentContext.Random.NextBool();
  1612. SingleOpcode(opcodes, v1: v1, overflow: v, carry: c, zero: z, negative: n);
  1613. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc);
  1614. }
  1615. [Test, Pairwise] [Explicit]
  1616. public void F_Cmp_Cmpe_S_D([ValueSource(nameof(_F_Cmp_Cmpe_S_D_))] uint opcodes,
  1617. [ValueSource(nameof(_1D_F_))] ulong a)
  1618. {
  1619. V128 v1 = MakeVectorE0(a);
  1620. bool v = TestContext.CurrentContext.Random.NextBool();
  1621. bool c = TestContext.CurrentContext.Random.NextBool();
  1622. bool z = TestContext.CurrentContext.Random.NextBool();
  1623. bool n = TestContext.CurrentContext.Random.NextBool();
  1624. SingleOpcode(opcodes, v1: v1, overflow: v, carry: c, zero: z, negative: n);
  1625. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc);
  1626. }
  1627. [Test, Pairwise] [Explicit]
  1628. public void F_Cvt_S_SD([ValueSource(nameof(_F_Cvt_S_SD_))] uint opcodes,
  1629. [ValueSource(nameof(_1S_F_))] ulong a)
  1630. {
  1631. ulong z = TestContext.CurrentContext.Random.NextULong();
  1632. V128 v0 = MakeVectorE1(z);
  1633. V128 v1 = MakeVectorE0(a);
  1634. SingleOpcode(opcodes, v0: v0, v1: v1);
  1635. CompareAgainstUnicorn();
  1636. }
  1637. [Test, Pairwise] [Explicit]
  1638. public void F_Cvt_S_DS([ValueSource(nameof(_F_Cvt_S_DS_))] uint opcodes,
  1639. [ValueSource(nameof(_1D_F_))] ulong a)
  1640. {
  1641. ulong z = TestContext.CurrentContext.Random.NextULong();
  1642. V128 v0 = MakeVectorE0E1(z, z);
  1643. V128 v1 = MakeVectorE0(a);
  1644. SingleOpcode(opcodes, v0: v0, v1: v1);
  1645. CompareAgainstUnicorn();
  1646. }
  1647. [Test, Pairwise] [Explicit] // Unicorn seems to default all rounding modes to RMode.Rn.
  1648. public void F_Cvt_S_SH([ValueSource(nameof(_F_Cvt_S_SH_))] uint opcodes,
  1649. [ValueSource(nameof(_1S_F_))] ulong a,
  1650. [Values(RMode.Rn)] RMode rMode)
  1651. {
  1652. ulong z = TestContext.CurrentContext.Random.NextULong();
  1653. V128 v0 = MakeVectorE0E1(z, z);
  1654. V128 v1 = MakeVectorE0(a);
  1655. int fpcr = (int)rMode << (int)Fpcr.RMode;
  1656. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1657. CompareAgainstUnicorn();
  1658. }
  1659. [Test, Pairwise] [Explicit]
  1660. public void F_Cvt_S_DH([ValueSource(nameof(_F_Cvt_S_DH_))] uint opcodes,
  1661. [ValueSource(nameof(_1D_F_))] ulong a,
  1662. [Values(RMode.Rn)] RMode rMode)
  1663. {
  1664. ulong z = TestContext.CurrentContext.Random.NextULong();
  1665. V128 v0 = MakeVectorE0E1(z, z);
  1666. V128 v1 = MakeVectorE0(a);
  1667. int fpcr = (int)rMode << (int)Fpcr.RMode;
  1668. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1669. CompareAgainstUnicorn();
  1670. }
  1671. [Test, Pairwise] [Explicit]
  1672. public void F_Cvt_S_HS([ValueSource(nameof(_F_Cvt_S_HS_))] uint opcodes,
  1673. [ValueSource(nameof(_1H_F_))] ulong a)
  1674. {
  1675. ulong z = TestContext.CurrentContext.Random.NextULong();
  1676. V128 v0 = MakeVectorE0E1(z, z);
  1677. V128 v1 = MakeVectorE0(a);
  1678. SingleOpcode(opcodes, v0: v0, v1: v1);
  1679. CompareAgainstUnicorn();
  1680. }
  1681. [Test, Pairwise] [Explicit]
  1682. public void F_Cvt_S_HD([ValueSource(nameof(_F_Cvt_S_HD_))] uint opcodes,
  1683. [ValueSource(nameof(_1H_F_))] ulong a)
  1684. {
  1685. ulong z = TestContext.CurrentContext.Random.NextULong();
  1686. V128 v0 = MakeVectorE0E1(z, z);
  1687. V128 v1 = MakeVectorE0(a);
  1688. SingleOpcode(opcodes, v0: v0, v1: v1);
  1689. CompareAgainstUnicorn();
  1690. }
  1691. [Test, Pairwise] [Explicit]
  1692. public void F_Cvt_ANZ_SU_S_S([ValueSource(nameof(_F_Cvt_ANZ_SU_S_S_))] uint opcodes,
  1693. [ValueSource(nameof(_1S_F_W_))] ulong a)
  1694. {
  1695. ulong z = TestContext.CurrentContext.Random.NextULong();
  1696. V128 v0 = MakeVectorE0E1(z, z);
  1697. V128 v1 = MakeVectorE0(a);
  1698. SingleOpcode(opcodes, v0: v0, v1: v1);
  1699. CompareAgainstUnicorn();
  1700. }
  1701. [Test, Pairwise] [Explicit]
  1702. public void F_Cvt_ANZ_SU_S_D([ValueSource(nameof(_F_Cvt_ANZ_SU_S_D_))] uint opcodes,
  1703. [ValueSource(nameof(_1D_F_X_))] ulong a)
  1704. {
  1705. ulong z = TestContext.CurrentContext.Random.NextULong();
  1706. V128 v0 = MakeVectorE1(z);
  1707. V128 v1 = MakeVectorE0(a);
  1708. SingleOpcode(opcodes, v0: v0, v1: v1);
  1709. CompareAgainstUnicorn();
  1710. }
  1711. [Test, Pairwise] [Explicit]
  1712. public void F_Cvt_ANZ_SU_V_2S_4S([ValueSource(nameof(_F_Cvt_ANZ_SU_V_2S_4S_))] uint opcodes,
  1713. [Values(0u)] uint rd,
  1714. [Values(1u, 0u)] uint rn,
  1715. [ValueSource(nameof(_2S_F_W_))] ulong z,
  1716. [ValueSource(nameof(_2S_F_W_))] ulong a,
  1717. [Values(0b0u, 0b1u)] uint q) // <2S, 4S>
  1718. {
  1719. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1720. opcodes |= ((q & 1) << 30);
  1721. V128 v0 = MakeVectorE0E1(z, z);
  1722. V128 v1 = MakeVectorE0E1(a, a * q);
  1723. SingleOpcode(opcodes, v0: v0, v1: v1);
  1724. CompareAgainstUnicorn();
  1725. }
  1726. [Test, Pairwise] [Explicit]
  1727. public void F_Cvt_ANZ_SU_V_2D([ValueSource(nameof(_F_Cvt_ANZ_SU_V_2D_))] uint opcodes,
  1728. [Values(0u)] uint rd,
  1729. [Values(1u, 0u)] uint rn,
  1730. [ValueSource(nameof(_1D_F_X_))] ulong z,
  1731. [ValueSource(nameof(_1D_F_X_))] ulong a)
  1732. {
  1733. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1734. V128 v0 = MakeVectorE0E1(z, z);
  1735. V128 v1 = MakeVectorE0E1(a, a);
  1736. SingleOpcode(opcodes, v0: v0, v1: v1);
  1737. CompareAgainstUnicorn();
  1738. }
  1739. [Test, Pairwise] [Explicit]
  1740. public void F_Cvtl_V_4H4S_8H4S([ValueSource(nameof(_F_Cvtl_V_4H4S_8H4S_))] uint opcodes,
  1741. [Values(0u)] uint rd,
  1742. [Values(1u, 0u)] uint rn,
  1743. [ValueSource(nameof(_4H_F_))] ulong z,
  1744. [ValueSource(nameof(_4H_F_))] ulong a,
  1745. [Values(0b0u, 0b1u)] uint q, // <4H4S, 8H4S>
  1746. [Values(RMode.Rn)] RMode rMode)
  1747. {
  1748. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1749. opcodes |= ((q & 1) << 30);
  1750. V128 v0 = MakeVectorE0E1(z, z);
  1751. V128 v1 = MakeVectorE0E1(q == 0u ? a : 0ul, q == 1u ? a : 0ul);
  1752. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1753. int fpcr = (int)rMode << (int)Fpcr.RMode;
  1754. fpcr |= rnd & (1 << (int)Fpcr.Fz);
  1755. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1756. fpcr |= rnd & (1 << (int)Fpcr.Ahp);
  1757. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1758. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Ofc | Fpsr.Ufc | Fpsr.Ixc);
  1759. }
  1760. [Test, Pairwise] [Explicit]
  1761. public void F_Cvtl_V_2S2D_4S2D([ValueSource(nameof(_F_Cvtl_V_2S2D_4S2D_))] uint opcodes,
  1762. [Values(0u)] uint rd,
  1763. [Values(1u, 0u)] uint rn,
  1764. [ValueSource(nameof(_2S_F_))] ulong z,
  1765. [ValueSource(nameof(_2S_F_))] ulong a,
  1766. [Values(0b0u, 0b1u)] uint q) // <2S2D, 4S2D>
  1767. {
  1768. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1769. opcodes |= ((q & 1) << 30);
  1770. V128 v0 = MakeVectorE0E1(z, z);
  1771. V128 v1 = MakeVectorE0E1(q == 0u ? a : 0ul, q == 1u ? a : 0ul);
  1772. SingleOpcode(opcodes, v0: v0, v1: v1);
  1773. CompareAgainstUnicorn();
  1774. }
  1775. [Test, Pairwise] [Explicit] // Unicorn seems to default all rounding modes to RMode.Rn.
  1776. public void F_Cvtn_V_4S4H_4S8H([ValueSource(nameof(_F_Cvtn_V_4S4H_4S8H_))] uint opcodes,
  1777. [Values(0u)] uint rd,
  1778. [Values(1u, 0u)] uint rn,
  1779. [ValueSource(nameof(_2S_F_))] ulong z,
  1780. [ValueSource(nameof(_2S_F_))] ulong a,
  1781. [Values(0b0u, 0b1u)] uint q, // <4S4H, 4S8H>
  1782. [Values(RMode.Rn)] RMode rMode)
  1783. {
  1784. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1785. opcodes |= ((q & 1) << 30);
  1786. V128 v0 = MakeVectorE0E1(z, a);
  1787. V128 v1 = MakeVectorE0E1(a, z);
  1788. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1789. int fpcr = (int)rMode << (int)Fpcr.RMode;
  1790. fpcr |= rnd & (1 << (int)Fpcr.Fz);
  1791. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1792. fpcr |= rnd & (1 << (int)Fpcr.Ahp);
  1793. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1794. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Ofc | Fpsr.Ufc | Fpsr.Ixc | Fpsr.Idc);
  1795. }
  1796. [Test, Pairwise] [Explicit]
  1797. public void F_Cvtn_V_2D2S_2D4S([ValueSource(nameof(_F_Cvtn_V_2D2S_2D4S_))] uint opcodes,
  1798. [Values(0u)] uint rd,
  1799. [Values(1u, 0u)] uint rn,
  1800. [ValueSource(nameof(_1D_F_))] ulong z,
  1801. [ValueSource(nameof(_1D_F_))] ulong a,
  1802. [Values(0b0u, 0b1u)] uint q) // <2D2S, 2D4S>
  1803. {
  1804. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1805. opcodes |= ((q & 1) << 30);
  1806. V128 v0 = MakeVectorE0E1(z, a);
  1807. V128 v1 = MakeVectorE0E1(a, z);
  1808. SingleOpcode(opcodes, v0: v0, v1: v1);
  1809. CompareAgainstUnicorn();
  1810. }
  1811. [Test, Pairwise] [Explicit]
  1812. public void F_Max_Min_Nm_V_V_4SS([ValueSource(nameof(_F_Max_Min_Nm_V_V_4SS_))] uint opcodes,
  1813. [Values(0u)] uint rd,
  1814. [Values(1u, 0u)] uint rn,
  1815. [ValueSource(nameof(_2S_F_))] ulong z,
  1816. [ValueSource(nameof(_2S_F_))] ulong a)
  1817. {
  1818. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1819. V128 v0 = MakeVectorE0E1(z, z);
  1820. V128 v1 = MakeVectorE0E1(a, a);
  1821. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1822. int fpcr = rnd & (1 << (int)Fpcr.Fz);
  1823. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1824. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1825. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Idc);
  1826. }
  1827. [Test, Pairwise] [Explicit]
  1828. public void F_Mov_Ftoi_SW([ValueSource(nameof(_F_Mov_Ftoi_SW_))] uint opcodes,
  1829. [Values(0u, 31u)] uint rd,
  1830. [Values(1u)] uint rn,
  1831. [ValueSource(nameof(_1S_F_))] ulong a)
  1832. {
  1833. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1834. ulong x0 = (ulong)TestContext.CurrentContext.Random.NextUInt() << 32;
  1835. uint w31 = TestContext.CurrentContext.Random.NextUInt();
  1836. V128 v1 = MakeVectorE0(a);
  1837. SingleOpcode(opcodes, x0: x0, x31: w31, v1: v1);
  1838. CompareAgainstUnicorn();
  1839. }
  1840. [Test, Pairwise] [Explicit]
  1841. public void F_Mov_Ftoi_DX([ValueSource(nameof(_F_Mov_Ftoi_DX_))] uint opcodes,
  1842. [Values(0u, 31u)] uint rd,
  1843. [Values(1u)] uint rn,
  1844. [ValueSource(nameof(_1D_F_))] ulong a)
  1845. {
  1846. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1847. ulong x31 = TestContext.CurrentContext.Random.NextULong();
  1848. V128 v1 = MakeVectorE0(a);
  1849. SingleOpcode(opcodes, x31: x31, v1: v1);
  1850. CompareAgainstUnicorn();
  1851. }
  1852. [Test, Pairwise] [Explicit]
  1853. public void F_Mov_Ftoi1_DX([ValueSource(nameof(_F_Mov_Ftoi1_DX_))] uint opcodes,
  1854. [Values(0u, 31u)] uint rd,
  1855. [Values(1u)] uint rn,
  1856. [ValueSource(nameof(_1D_F_))] ulong a)
  1857. {
  1858. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1859. ulong x31 = TestContext.CurrentContext.Random.NextULong();
  1860. V128 v1 = MakeVectorE1(a);
  1861. SingleOpcode(opcodes, x31: x31, v1: v1);
  1862. CompareAgainstUnicorn();
  1863. }
  1864. [Test, Pairwise] [Explicit]
  1865. public void F_Mov_Itof_WS([ValueSource(nameof(_F_Mov_Itof_WS_))] uint opcodes,
  1866. [Values(0u)] uint rd,
  1867. [Values(1u, 31u)] uint rn,
  1868. [ValueSource(nameof(_W_))] uint wn)
  1869. {
  1870. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1871. uint w31 = TestContext.CurrentContext.Random.NextUInt();
  1872. ulong z = TestContext.CurrentContext.Random.NextULong();
  1873. V128 v0 = MakeVectorE0E1(z, z);
  1874. SingleOpcode(opcodes, x1: wn, x31: w31, v0: v0);
  1875. CompareAgainstUnicorn();
  1876. }
  1877. [Test, Pairwise] [Explicit]
  1878. public void F_Mov_Itof_XD([ValueSource(nameof(_F_Mov_Itof_XD_))] uint opcodes,
  1879. [Values(0u)] uint rd,
  1880. [Values(1u, 31u)] uint rn,
  1881. [ValueSource(nameof(_X_))] ulong xn)
  1882. {
  1883. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1884. ulong x31 = TestContext.CurrentContext.Random.NextULong();
  1885. ulong z = TestContext.CurrentContext.Random.NextULong();
  1886. V128 v0 = MakeVectorE1(z);
  1887. SingleOpcode(opcodes, x1: xn, x31: x31, v0: v0);
  1888. CompareAgainstUnicorn();
  1889. }
  1890. [Test, Pairwise] [Explicit]
  1891. public void F_Mov_Itof1_XD([ValueSource(nameof(_F_Mov_Itof1_XD_))] uint opcodes,
  1892. [Values(0u)] uint rd,
  1893. [Values(1u, 31u)] uint rn,
  1894. [ValueSource(nameof(_X_))] ulong xn)
  1895. {
  1896. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1897. ulong x31 = TestContext.CurrentContext.Random.NextULong();
  1898. ulong z = TestContext.CurrentContext.Random.NextULong();
  1899. V128 v0 = MakeVectorE0(z);
  1900. SingleOpcode(opcodes, x1: xn, x31: x31, v0: v0);
  1901. CompareAgainstUnicorn();
  1902. }
  1903. [Test, Pairwise] [Explicit]
  1904. public void F_Mov_S_S([ValueSource(nameof(_F_Mov_S_S_))] uint opcodes,
  1905. [ValueSource(nameof(_1S_F_))] ulong a)
  1906. {
  1907. ulong z = TestContext.CurrentContext.Random.NextULong();
  1908. V128 v0 = MakeVectorE0E1(z, z);
  1909. V128 v1 = MakeVectorE0(a);
  1910. SingleOpcode(opcodes, v0: v0, v1: v1);
  1911. CompareAgainstUnicorn();
  1912. }
  1913. [Test, Pairwise] [Explicit]
  1914. public void F_Mov_S_D([ValueSource(nameof(_F_Mov_S_D_))] uint opcodes,
  1915. [ValueSource(nameof(_1D_F_))] ulong a)
  1916. {
  1917. ulong z = TestContext.CurrentContext.Random.NextULong();
  1918. V128 v0 = MakeVectorE1(z);
  1919. V128 v1 = MakeVectorE0(a);
  1920. SingleOpcode(opcodes, v0: v0, v1: v1);
  1921. CompareAgainstUnicorn();
  1922. }
  1923. [Test, Pairwise] [Explicit]
  1924. public void F_Recpe_Rsqrte_S_S([ValueSource(nameof(_F_Recpe_Rsqrte_S_S_))] uint opcodes,
  1925. [ValueSource(nameof(_1S_F_))] ulong a,
  1926. [Values(RMode.Rn)] RMode rMode)
  1927. {
  1928. ulong z = TestContext.CurrentContext.Random.NextULong();
  1929. V128 v0 = MakeVectorE0E1(z, z);
  1930. V128 v1 = MakeVectorE0(a);
  1931. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1932. int fpcr = (int)rMode << (int)Fpcr.RMode;
  1933. fpcr |= rnd & (1 << (int)Fpcr.Fz);
  1934. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1935. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1936. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Dzc | Fpsr.Ofc | Fpsr.Ufc | Fpsr.Ixc | Fpsr.Idc);
  1937. }
  1938. [Test, Pairwise] [Explicit]
  1939. public void F_Recpe_Rsqrte_S_D([ValueSource(nameof(_F_Recpe_Rsqrte_S_D_))] uint opcodes,
  1940. [ValueSource(nameof(_1D_F_))] ulong a,
  1941. [Values(RMode.Rn)] RMode rMode)
  1942. {
  1943. ulong z = TestContext.CurrentContext.Random.NextULong();
  1944. V128 v0 = MakeVectorE1(z);
  1945. V128 v1 = MakeVectorE0(a);
  1946. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1947. int fpcr = (int)rMode << (int)Fpcr.RMode;
  1948. fpcr |= rnd & (1 << (int)Fpcr.Fz);
  1949. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1950. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1951. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Dzc | Fpsr.Ofc | Fpsr.Ufc | Fpsr.Ixc | Fpsr.Idc);
  1952. }
  1953. [Test, Pairwise] [Explicit]
  1954. public void F_Recpe_Rsqrte_V_2S_4S([ValueSource(nameof(_F_Recpe_Rsqrte_V_2S_4S_))] uint opcodes,
  1955. [Values(0u)] uint rd,
  1956. [Values(1u, 0u)] uint rn,
  1957. [ValueSource(nameof(_2S_F_))] ulong z,
  1958. [ValueSource(nameof(_2S_F_))] ulong a,
  1959. [Values(0b0u, 0b1u)] uint q, // <2S, 4S>
  1960. [Values(RMode.Rn)] RMode rMode)
  1961. {
  1962. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1963. opcodes |= ((q & 1) << 30);
  1964. V128 v0 = MakeVectorE0E1(z, z);
  1965. V128 v1 = MakeVectorE0E1(a, a * q);
  1966. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1967. int fpcr = (int)rMode << (int)Fpcr.RMode;
  1968. fpcr |= rnd & (1 << (int)Fpcr.Fz);
  1969. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1970. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1971. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Dzc | Fpsr.Ofc | Fpsr.Ufc | Fpsr.Ixc | Fpsr.Idc);
  1972. }
  1973. [Test, Pairwise] [Explicit]
  1974. public void F_Recpe_Rsqrte_V_2D([ValueSource(nameof(_F_Recpe_Rsqrte_V_2D_))] uint opcodes,
  1975. [Values(0u)] uint rd,
  1976. [Values(1u, 0u)] uint rn,
  1977. [ValueSource(nameof(_1D_F_))] ulong z,
  1978. [ValueSource(nameof(_1D_F_))] ulong a,
  1979. [Values(RMode.Rn)] RMode rMode)
  1980. {
  1981. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  1982. V128 v0 = MakeVectorE0E1(z, z);
  1983. V128 v1 = MakeVectorE0E1(a, a);
  1984. int rnd = (int)TestContext.CurrentContext.Random.NextUInt();
  1985. int fpcr = (int)rMode << (int)Fpcr.RMode;
  1986. fpcr |= rnd & (1 << (int)Fpcr.Fz);
  1987. fpcr |= rnd & (1 << (int)Fpcr.Dn);
  1988. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  1989. CompareAgainstUnicorn(fpsrMask: Fpsr.Ioc | Fpsr.Dzc | Fpsr.Ofc | Fpsr.Ufc | Fpsr.Ixc | Fpsr.Idc);
  1990. }
  1991. [Test, Pairwise] [Explicit]
  1992. public void F_Rint_AMNPZ_S_S([ValueSource(nameof(_F_Rint_AMNPZ_S_S_))] uint opcodes,
  1993. [ValueSource(nameof(_1S_F_))] ulong a)
  1994. {
  1995. ulong z = TestContext.CurrentContext.Random.NextULong();
  1996. V128 v0 = MakeVectorE0E1(z, z);
  1997. V128 v1 = MakeVectorE0(a);
  1998. SingleOpcode(opcodes, v0: v0, v1: v1);
  1999. CompareAgainstUnicorn();
  2000. }
  2001. [Test, Pairwise] [Explicit]
  2002. public void F_Rint_AMNPZ_S_D([ValueSource(nameof(_F_Rint_AMNPZ_S_D_))] uint opcodes,
  2003. [ValueSource(nameof(_1D_F_))] ulong a)
  2004. {
  2005. ulong z = TestContext.CurrentContext.Random.NextULong();
  2006. V128 v0 = MakeVectorE1(z);
  2007. V128 v1 = MakeVectorE0(a);
  2008. SingleOpcode(opcodes, v0: v0, v1: v1);
  2009. CompareAgainstUnicorn();
  2010. }
  2011. [Test, Pairwise] [Explicit]
  2012. public void F_Rint_AMNPZ_V_2S_4S([ValueSource(nameof(_F_Rint_AMNPZ_V_2S_4S_))] uint opcodes,
  2013. [Values(0u)] uint rd,
  2014. [Values(1u, 0u)] uint rn,
  2015. [ValueSource(nameof(_2S_F_))] ulong z,
  2016. [ValueSource(nameof(_2S_F_))] ulong a,
  2017. [Values(0b0u, 0b1u)] uint q) // <2S, 4S>
  2018. {
  2019. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2020. opcodes |= ((q & 1) << 30);
  2021. V128 v0 = MakeVectorE0E1(z, z);
  2022. V128 v1 = MakeVectorE0E1(a, a * q);
  2023. SingleOpcode(opcodes, v0: v0, v1: v1);
  2024. CompareAgainstUnicorn();
  2025. }
  2026. [Test, Pairwise] [Explicit]
  2027. public void F_Rint_AMNPZ_V_2D([ValueSource(nameof(_F_Rint_AMNPZ_V_2D_))] uint opcodes,
  2028. [Values(0u)] uint rd,
  2029. [Values(1u, 0u)] uint rn,
  2030. [ValueSource(nameof(_1D_F_))] ulong z,
  2031. [ValueSource(nameof(_1D_F_))] ulong a)
  2032. {
  2033. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2034. V128 v0 = MakeVectorE0E1(z, z);
  2035. V128 v1 = MakeVectorE0E1(a, a);
  2036. SingleOpcode(opcodes, v0: v0, v1: v1);
  2037. CompareAgainstUnicorn();
  2038. }
  2039. [Test, Pairwise] [Explicit]
  2040. public void F_Rint_IX_S_S([ValueSource(nameof(_F_Rint_IX_S_S_))] uint opcodes,
  2041. [ValueSource(nameof(_1S_F_))] ulong a,
  2042. [Values] RMode rMode)
  2043. {
  2044. ulong z = TestContext.CurrentContext.Random.NextULong();
  2045. V128 v0 = MakeVectorE0E1(z, z);
  2046. V128 v1 = MakeVectorE0(a);
  2047. int fpcr = (int)rMode << (int)Fpcr.RMode;
  2048. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  2049. CompareAgainstUnicorn();
  2050. }
  2051. [Test, Pairwise] [Explicit]
  2052. public void F_Rint_IX_S_D([ValueSource(nameof(_F_Rint_IX_S_D_))] uint opcodes,
  2053. [ValueSource(nameof(_1D_F_))] ulong a,
  2054. [Values] RMode rMode)
  2055. {
  2056. ulong z = TestContext.CurrentContext.Random.NextULong();
  2057. V128 v0 = MakeVectorE1(z);
  2058. V128 v1 = MakeVectorE0(a);
  2059. int fpcr = (int)rMode << (int)Fpcr.RMode;
  2060. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  2061. CompareAgainstUnicorn();
  2062. }
  2063. [Test, Pairwise] [Explicit]
  2064. public void F_Rint_IX_V_2S_4S([ValueSource(nameof(_F_Rint_IX_V_2S_4S_))] uint opcodes,
  2065. [Values(0u)] uint rd,
  2066. [Values(1u, 0u)] uint rn,
  2067. [ValueSource(nameof(_2S_F_))] ulong z,
  2068. [ValueSource(nameof(_2S_F_))] ulong a,
  2069. [Values(0b0u, 0b1u)] uint q, // <2S, 4S>
  2070. [Values] RMode rMode)
  2071. {
  2072. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2073. opcodes |= ((q & 1) << 30);
  2074. V128 v0 = MakeVectorE0E1(z, z);
  2075. V128 v1 = MakeVectorE0E1(a, a * q);
  2076. int fpcr = (int)rMode << (int)Fpcr.RMode;
  2077. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  2078. CompareAgainstUnicorn();
  2079. }
  2080. [Test, Pairwise] [Explicit]
  2081. public void F_Rint_IX_V_2D([ValueSource(nameof(_F_Rint_IX_V_2D_))] uint opcodes,
  2082. [Values(0u)] uint rd,
  2083. [Values(1u, 0u)] uint rn,
  2084. [ValueSource(nameof(_1D_F_))] ulong z,
  2085. [ValueSource(nameof(_1D_F_))] ulong a,
  2086. [Values] RMode rMode)
  2087. {
  2088. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2089. V128 v0 = MakeVectorE0E1(z, z);
  2090. V128 v1 = MakeVectorE0E1(a, a);
  2091. int fpcr = (int)rMode << (int)Fpcr.RMode;
  2092. SingleOpcode(opcodes, v0: v0, v1: v1, fpcr: fpcr);
  2093. CompareAgainstUnicorn();
  2094. }
  2095. [Test, Pairwise, Description("NEG <V><d>, <V><n>")]
  2096. public void Neg_S_D([Values(0u)] uint rd,
  2097. [Values(1u, 0u)] uint rn,
  2098. [ValueSource(nameof(_1D_))] ulong z,
  2099. [ValueSource(nameof(_1D_))] ulong a)
  2100. {
  2101. uint opcode = 0x7EE0B800; // NEG D0, D0
  2102. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2103. V128 v0 = MakeVectorE0E1(z, z);
  2104. V128 v1 = MakeVectorE0(a);
  2105. SingleOpcode(opcode, v0: v0, v1: v1);
  2106. CompareAgainstUnicorn();
  2107. }
  2108. [Test, Pairwise, Description("NEG <Vd>.<T>, <Vn>.<T>")]
  2109. public void Neg_V_8B_4H_2S([Values(0u)] uint rd,
  2110. [Values(1u, 0u)] uint rn,
  2111. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2112. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2113. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  2114. {
  2115. uint opcode = 0x2E20B800; // NEG V0.8B, V0.8B
  2116. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2117. opcode |= ((size & 3) << 22);
  2118. V128 v0 = MakeVectorE0E1(z, z);
  2119. V128 v1 = MakeVectorE0(a);
  2120. SingleOpcode(opcode, v0: v0, v1: v1);
  2121. CompareAgainstUnicorn();
  2122. }
  2123. [Test, Pairwise, Description("NEG <Vd>.<T>, <Vn>.<T>")]
  2124. public void Neg_V_16B_8H_4S_2D([Values(0u)] uint rd,
  2125. [Values(1u, 0u)] uint rn,
  2126. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  2127. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  2128. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  2129. {
  2130. uint opcode = 0x6E20B800; // NEG V0.16B, V0.16B
  2131. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2132. opcode |= ((size & 3) << 22);
  2133. V128 v0 = MakeVectorE0E1(z, z);
  2134. V128 v1 = MakeVectorE0E1(a, a);
  2135. SingleOpcode(opcode, v0: v0, v1: v1);
  2136. CompareAgainstUnicorn();
  2137. }
  2138. [Test, Pairwise, Description("NOT <Vd>.<T>, <Vn>.<T>")]
  2139. public void Not_V_8B([Values(0u)] uint rd,
  2140. [Values(1u, 0u)] uint rn,
  2141. [ValueSource(nameof(_8B_))] ulong z,
  2142. [ValueSource(nameof(_8B_))] ulong a)
  2143. {
  2144. uint opcode = 0x2E205800; // NOT V0.8B, V0.8B
  2145. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2146. V128 v0 = MakeVectorE0E1(z, z);
  2147. V128 v1 = MakeVectorE0(a);
  2148. SingleOpcode(opcode, v0: v0, v1: v1);
  2149. CompareAgainstUnicorn();
  2150. }
  2151. [Test, Pairwise, Description("NOT <Vd>.<T>, <Vn>.<T>")]
  2152. public void Not_V_16B([Values(0u)] uint rd,
  2153. [Values(1u, 0u)] uint rn,
  2154. [ValueSource(nameof(_8B_))] ulong z,
  2155. [ValueSource(nameof(_8B_))] ulong a)
  2156. {
  2157. uint opcode = 0x6E205800; // NOT V0.16B, V0.16B
  2158. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2159. V128 v0 = MakeVectorE0E1(z, z);
  2160. V128 v1 = MakeVectorE0E1(a, a);
  2161. SingleOpcode(opcode, v0: v0, v1: v1);
  2162. CompareAgainstUnicorn();
  2163. }
  2164. [Test, Pairwise, Description("RBIT <Vd>.<T>, <Vn>.<T>")]
  2165. public void Rbit_V_8B([Values(0u)] uint rd,
  2166. [Values(1u, 0u)] uint rn,
  2167. [ValueSource(nameof(_8B_))] ulong z,
  2168. [ValueSource(nameof(_8B_))] ulong a)
  2169. {
  2170. uint opcode = 0x2E605800; // RBIT V0.8B, V0.8B
  2171. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2172. V128 v0 = MakeVectorE0E1(z, z);
  2173. V128 v1 = MakeVectorE0(a);
  2174. SingleOpcode(opcode, v0: v0, v1: v1);
  2175. CompareAgainstUnicorn();
  2176. }
  2177. [Test, Pairwise, Description("RBIT <Vd>.<T>, <Vn>.<T>")]
  2178. public void Rbit_V_16B([Values(0u)] uint rd,
  2179. [Values(1u, 0u)] uint rn,
  2180. [ValueSource(nameof(_8B_))] ulong z,
  2181. [ValueSource(nameof(_8B_))] ulong a)
  2182. {
  2183. uint opcode = 0x6E605800; // RBIT V0.16B, V0.16B
  2184. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2185. V128 v0 = MakeVectorE0E1(z, z);
  2186. V128 v1 = MakeVectorE0E1(a, a);
  2187. SingleOpcode(opcode, v0: v0, v1: v1);
  2188. CompareAgainstUnicorn();
  2189. }
  2190. [Test, Pairwise, Description("REV16 <Vd>.<T>, <Vn>.<T>")]
  2191. public void Rev16_V_8B([Values(0u)] uint rd,
  2192. [Values(1u, 0u)] uint rn,
  2193. [ValueSource(nameof(_8B_))] ulong z,
  2194. [ValueSource(nameof(_8B_))] ulong a)
  2195. {
  2196. uint opcode = 0x0E201800; // REV16 V0.8B, V0.8B
  2197. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2198. V128 v0 = MakeVectorE0E1(z, z);
  2199. V128 v1 = MakeVectorE0(a);
  2200. SingleOpcode(opcode, v0: v0, v1: v1);
  2201. CompareAgainstUnicorn();
  2202. }
  2203. [Test, Pairwise, Description("REV16 <Vd>.<T>, <Vn>.<T>")]
  2204. public void Rev16_V_16B([Values(0u)] uint rd,
  2205. [Values(1u, 0u)] uint rn,
  2206. [ValueSource(nameof(_8B_))] ulong z,
  2207. [ValueSource(nameof(_8B_))] ulong a)
  2208. {
  2209. uint opcode = 0x4E201800; // REV16 V0.16B, V0.16B
  2210. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2211. V128 v0 = MakeVectorE0E1(z, z);
  2212. V128 v1 = MakeVectorE0E1(a, a);
  2213. SingleOpcode(opcode, v0: v0, v1: v1);
  2214. CompareAgainstUnicorn();
  2215. }
  2216. [Test, Pairwise, Description("REV32 <Vd>.<T>, <Vn>.<T>")]
  2217. public void Rev32_V_8B_4H([Values(0u)] uint rd,
  2218. [Values(1u, 0u)] uint rn,
  2219. [ValueSource(nameof(_8B4H_))] ulong z,
  2220. [ValueSource(nameof(_8B4H_))] ulong a,
  2221. [Values(0b00u, 0b01u)] uint size) // <8B, 4H>
  2222. {
  2223. uint opcode = 0x2E200800; // REV32 V0.8B, V0.8B
  2224. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2225. opcode |= ((size & 3) << 22);
  2226. V128 v0 = MakeVectorE0E1(z, z);
  2227. V128 v1 = MakeVectorE0(a);
  2228. SingleOpcode(opcode, v0: v0, v1: v1);
  2229. CompareAgainstUnicorn();
  2230. }
  2231. [Test, Pairwise, Description("REV32 <Vd>.<T>, <Vn>.<T>")]
  2232. public void Rev32_V_16B_8H([Values(0u)] uint rd,
  2233. [Values(1u, 0u)] uint rn,
  2234. [ValueSource(nameof(_8B4H_))] ulong z,
  2235. [ValueSource(nameof(_8B4H_))] ulong a,
  2236. [Values(0b00u, 0b01u)] uint size) // <16B, 8H>
  2237. {
  2238. uint opcode = 0x6E200800; // REV32 V0.16B, V0.16B
  2239. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2240. opcode |= ((size & 3) << 22);
  2241. V128 v0 = MakeVectorE0E1(z, z);
  2242. V128 v1 = MakeVectorE0E1(a, a);
  2243. SingleOpcode(opcode, v0: v0, v1: v1);
  2244. CompareAgainstUnicorn();
  2245. }
  2246. [Test, Pairwise, Description("REV64 <Vd>.<T>, <Vn>.<T>")]
  2247. public void Rev64_V_8B_4H_2S([Values(0u)] uint rd,
  2248. [Values(1u, 0u)] uint rn,
  2249. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2250. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2251. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  2252. {
  2253. uint opcode = 0x0E200800; // REV64 V0.8B, V0.8B
  2254. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2255. opcode |= ((size & 3) << 22);
  2256. V128 v0 = MakeVectorE0E1(z, z);
  2257. V128 v1 = MakeVectorE0(a);
  2258. SingleOpcode(opcode, v0: v0, v1: v1);
  2259. CompareAgainstUnicorn();
  2260. }
  2261. [Test, Pairwise, Description("REV64 <Vd>.<T>, <Vn>.<T>")]
  2262. public void Rev64_V_16B_8H_4S([Values(0u)] uint rd,
  2263. [Values(1u, 0u)] uint rn,
  2264. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2265. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2266. [Values(0b00u, 0b01u, 0b10u)] uint size) // <16B, 8H, 4S>
  2267. {
  2268. uint opcode = 0x4E200800; // REV64 V0.16B, V0.16B
  2269. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2270. opcode |= ((size & 3) << 22);
  2271. V128 v0 = MakeVectorE0E1(z, z);
  2272. V128 v1 = MakeVectorE0E1(a, a);
  2273. SingleOpcode(opcode, v0: v0, v1: v1);
  2274. CompareAgainstUnicorn();
  2275. }
  2276. [Test, Pairwise, Description("SADALP <Vd>.<Ta>, <Vn>.<Tb>")]
  2277. public void Sadalp_V_8B4H_4H2S_2S1D([Values(0u)] uint rd,
  2278. [Values(1u, 0u)] uint rn,
  2279. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2280. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2281. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B4H, 4H2S, 2S1D>
  2282. {
  2283. uint opcode = 0x0E206800; // SADALP V0.4H, V0.8B
  2284. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2285. opcode |= ((size & 3) << 22);
  2286. V128 v0 = MakeVectorE0E1(z, z);
  2287. V128 v1 = MakeVectorE0(a);
  2288. SingleOpcode(opcode, v0: v0, v1: v1);
  2289. CompareAgainstUnicorn();
  2290. }
  2291. [Test, Pairwise, Description("SADALP <Vd>.<Ta>, <Vn>.<Tb>")]
  2292. public void Sadalp_V_16B8H_8H4S_4S2D([Values(0u)] uint rd,
  2293. [Values(1u, 0u)] uint rn,
  2294. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2295. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2296. [Values(0b00u, 0b01u, 0b10u)] uint size) // <16B8H, 8H4S, 4S2D>
  2297. {
  2298. uint opcode = 0x4E206800; // SADALP V0.8H, V0.16B
  2299. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2300. opcode |= ((size & 3) << 22);
  2301. V128 v0 = MakeVectorE0E1(z, z);
  2302. V128 v1 = MakeVectorE0E1(a, a);
  2303. SingleOpcode(opcode, v0: v0, v1: v1);
  2304. CompareAgainstUnicorn();
  2305. }
  2306. [Test, Pairwise, Description("SADDLP <Vd>.<Ta>, <Vn>.<Tb>")]
  2307. public void Saddlp_V_8B4H_4H2S_2S1D([Values(0u)] uint rd,
  2308. [Values(1u, 0u)] uint rn,
  2309. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2310. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2311. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B4H, 4H2S, 2S1D>
  2312. {
  2313. uint opcode = 0x0E202800; // SADDLP V0.4H, V0.8B
  2314. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2315. opcode |= ((size & 3) << 22);
  2316. V128 v0 = MakeVectorE0E1(z, z);
  2317. V128 v1 = MakeVectorE0(a);
  2318. SingleOpcode(opcode, v0: v0, v1: v1);
  2319. CompareAgainstUnicorn();
  2320. }
  2321. [Test, Pairwise, Description("SADDLP <Vd>.<Ta>, <Vn>.<Tb>")]
  2322. public void Saddlp_V_16B8H_8H4S_4S2D([Values(0u)] uint rd,
  2323. [Values(1u, 0u)] uint rn,
  2324. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2325. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2326. [Values(0b00u, 0b01u, 0b10u)] uint size) // <16B8H, 8H4S, 4S2D>
  2327. {
  2328. uint opcode = 0x4E202800; // SADDLP V0.8H, V0.16B
  2329. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2330. opcode |= ((size & 3) << 22);
  2331. V128 v0 = MakeVectorE0E1(z, z);
  2332. V128 v1 = MakeVectorE0E1(a, a);
  2333. SingleOpcode(opcode, v0: v0, v1: v1);
  2334. CompareAgainstUnicorn();
  2335. }
  2336. [Test, Pairwise]
  2337. public void SU_Addl_V_V_8BH_4HS([ValueSource(nameof(_SU_Addl_V_V_8BH_4HS_))] uint opcodes,
  2338. [Values(0u)] uint rd,
  2339. [Values(1u, 0u)] uint rn,
  2340. [ValueSource(nameof(_8B4H_))] ulong z,
  2341. [ValueSource(nameof(_8B4H_))] ulong a,
  2342. [Values(0b00u, 0b01u)] uint size) // <8BH, 4HS>
  2343. {
  2344. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2345. opcodes |= ((size & 3) << 22);
  2346. V128 v0 = MakeVectorE0E1(z, z);
  2347. V128 v1 = MakeVectorE0(a);
  2348. SingleOpcode(opcodes, v0: v0, v1: v1);
  2349. CompareAgainstUnicorn();
  2350. }
  2351. [Test, Pairwise]
  2352. public void SU_Addl_V_V_16BH_8HS_4SD([ValueSource(nameof(_SU_Addl_V_V_16BH_8HS_4SD_))] uint opcodes,
  2353. [Values(0u)] uint rd,
  2354. [Values(1u, 0u)] uint rn,
  2355. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2356. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2357. [Values(0b00u, 0b01u, 0b10u)] uint size) // <16BH, 8HS, 4SD>
  2358. {
  2359. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2360. opcodes |= ((size & 3) << 22);
  2361. V128 v0 = MakeVectorE0E1(z, z);
  2362. V128 v1 = MakeVectorE0E1(a, a);
  2363. SingleOpcode(opcodes, v0: v0, v1: v1);
  2364. CompareAgainstUnicorn();
  2365. }
  2366. [Test, Pairwise] [Explicit]
  2367. public void SU_Cvt_F_S_S([ValueSource(nameof(_SU_Cvt_F_S_S_))] uint opcodes,
  2368. [ValueSource(nameof(_1S_))] ulong a)
  2369. {
  2370. ulong z = TestContext.CurrentContext.Random.NextULong();
  2371. V128 v0 = MakeVectorE0E1(z, z);
  2372. V128 v1 = MakeVectorE0(a);
  2373. SingleOpcode(opcodes, v0: v0, v1: v1);
  2374. CompareAgainstUnicorn();
  2375. }
  2376. [Test, Pairwise] [Explicit]
  2377. public void SU_Cvt_F_S_D([ValueSource(nameof(_SU_Cvt_F_S_D_))] uint opcodes,
  2378. [ValueSource(nameof(_1D_))] ulong a)
  2379. {
  2380. ulong z = TestContext.CurrentContext.Random.NextULong();
  2381. V128 v0 = MakeVectorE1(z);
  2382. V128 v1 = MakeVectorE0(a);
  2383. SingleOpcode(opcodes, v0: v0, v1: v1);
  2384. CompareAgainstUnicorn();
  2385. }
  2386. [Test, Pairwise] [Explicit]
  2387. public void SU_Cvt_F_V_2S_4S([ValueSource(nameof(_SU_Cvt_F_V_2S_4S_))] uint opcodes,
  2388. [Values(0u)] uint rd,
  2389. [Values(1u, 0u)] uint rn,
  2390. [ValueSource(nameof(_2S_))] ulong z,
  2391. [ValueSource(nameof(_2S_))] ulong a,
  2392. [Values(0b0u, 0b1u)] uint q) // <2S, 4S>
  2393. {
  2394. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2395. opcodes |= ((q & 1) << 30);
  2396. V128 v0 = MakeVectorE0E1(z, z);
  2397. V128 v1 = MakeVectorE0E1(a, a * q);
  2398. SingleOpcode(opcodes, v0: v0, v1: v1);
  2399. CompareAgainstUnicorn();
  2400. }
  2401. [Test, Pairwise] [Explicit]
  2402. public void SU_Cvt_F_V_2D([ValueSource(nameof(_SU_Cvt_F_V_2D_))] uint opcodes,
  2403. [Values(0u)] uint rd,
  2404. [Values(1u, 0u)] uint rn,
  2405. [ValueSource(nameof(_1D_))] ulong z,
  2406. [ValueSource(nameof(_1D_))] ulong a)
  2407. {
  2408. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2409. V128 v0 = MakeVectorE0E1(z, z);
  2410. V128 v1 = MakeVectorE0E1(a, a);
  2411. SingleOpcode(opcodes, v0: v0, v1: v1);
  2412. CompareAgainstUnicorn();
  2413. }
  2414. [Test, Pairwise]
  2415. public void Sha1h_Sha1su1_V([ValueSource(nameof(_Sha1h_Sha1su1_V_))] uint opcodes,
  2416. [Values(0u)] uint rd,
  2417. [Values(1u, 0u)] uint rn,
  2418. [Random(RndCnt / 2)] ulong z0, [Random(RndCnt / 2)] ulong z1,
  2419. [Random(RndCnt / 2)] ulong a0, [Random(RndCnt / 2)] ulong a1)
  2420. {
  2421. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2422. V128 v0 = MakeVectorE0E1(z0, z1);
  2423. V128 v1 = MakeVectorE0E1(a0, a1);
  2424. SingleOpcode(opcodes, v0: v0, v1: v1);
  2425. CompareAgainstUnicorn();
  2426. }
  2427. [Test, Pairwise]
  2428. public void Sha256su0_V([ValueSource(nameof(_Sha256su0_V_))] uint opcodes,
  2429. [Values(0u)] uint rd,
  2430. [Values(1u, 0u)] uint rn,
  2431. [Random(RndCnt / 2)] ulong z0, [Random(RndCnt / 2)] ulong z1,
  2432. [Random(RndCnt / 2)] ulong a0, [Random(RndCnt / 2)] ulong a1)
  2433. {
  2434. opcodes |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2435. V128 v0 = MakeVectorE0E1(z0, z1);
  2436. V128 v1 = MakeVectorE0E1(a0, a1);
  2437. SingleOpcode(opcodes, v0: v0, v1: v1);
  2438. CompareAgainstUnicorn();
  2439. }
  2440. [Test, Pairwise, Description("SHLL{2} <Vd>.<Ta>, <Vn>.<Tb>, #<shift>")]
  2441. public void Shll_V([Values(0u)] uint rd,
  2442. [Values(1u, 0u)] uint rn,
  2443. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2444. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2445. [Values(0b00u, 0b01u, 0b10u)] uint size, // <shift: 8, 16, 32>
  2446. [Values(0b0u, 0b1u)] uint q)
  2447. {
  2448. uint opcode = 0x2E213800; // SHLL V0.8H, V0.8B, #8
  2449. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2450. opcode |= ((size & 3) << 22);
  2451. opcode |= ((q & 1) << 30);
  2452. V128 v0 = MakeVectorE0E1(z, z);
  2453. V128 v1 = MakeVectorE0E1(q == 0u ? a : 0ul, q == 1u ? a : 0ul);
  2454. SingleOpcode(opcode, v0: v0, v1: v1);
  2455. CompareAgainstUnicorn();
  2456. }
  2457. [Test, Pairwise, Description("SQABS <V><d>, <V><n>")]
  2458. public void Sqabs_S_B_H_S_D([Values(0u)] uint rd,
  2459. [Values(1u, 0u)] uint rn,
  2460. [ValueSource(nameof(_1B1H1S1D_))] ulong z,
  2461. [ValueSource(nameof(_1B1H1S1D_))] ulong a,
  2462. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <B, H, S, D>
  2463. {
  2464. uint opcode = 0x5E207800; // SQABS B0, B0
  2465. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2466. opcode |= ((size & 3) << 22);
  2467. V128 v0 = MakeVectorE0E1(z, z);
  2468. V128 v1 = MakeVectorE0(a);
  2469. SingleOpcode(opcode, v0: v0, v1: v1);
  2470. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2471. }
  2472. [Test, Pairwise, Description("SQABS <Vd>.<T>, <Vn>.<T>")]
  2473. public void Sqabs_V_8B_4H_2S([Values(0u)] uint rd,
  2474. [Values(1u, 0u)] uint rn,
  2475. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2476. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2477. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  2478. {
  2479. uint opcode = 0x0E207800; // SQABS V0.8B, V0.8B
  2480. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2481. opcode |= ((size & 3) << 22);
  2482. V128 v0 = MakeVectorE0E1(z, z);
  2483. V128 v1 = MakeVectorE0(a);
  2484. SingleOpcode(opcode, v0: v0, v1: v1);
  2485. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2486. }
  2487. [Test, Pairwise, Description("SQABS <Vd>.<T>, <Vn>.<T>")]
  2488. public void Sqabs_V_16B_8H_4S_2D([Values(0u)] uint rd,
  2489. [Values(1u, 0u)] uint rn,
  2490. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  2491. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  2492. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  2493. {
  2494. uint opcode = 0x4E207800; // SQABS V0.16B, V0.16B
  2495. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2496. opcode |= ((size & 3) << 22);
  2497. V128 v0 = MakeVectorE0E1(z, z);
  2498. V128 v1 = MakeVectorE0E1(a, a);
  2499. SingleOpcode(opcode, v0: v0, v1: v1);
  2500. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2501. }
  2502. [Test, Pairwise, Description("SQNEG <V><d>, <V><n>")]
  2503. public void Sqneg_S_B_H_S_D([Values(0u)] uint rd,
  2504. [Values(1u, 0u)] uint rn,
  2505. [ValueSource(nameof(_1B1H1S1D_))] ulong z,
  2506. [ValueSource(nameof(_1B1H1S1D_))] ulong a,
  2507. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <B, H, S, D>
  2508. {
  2509. uint opcode = 0x7E207800; // SQNEG B0, B0
  2510. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2511. opcode |= ((size & 3) << 22);
  2512. V128 v0 = MakeVectorE0E1(z, z);
  2513. V128 v1 = MakeVectorE0(a);
  2514. SingleOpcode(opcode, v0: v0, v1: v1);
  2515. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2516. }
  2517. [Test, Pairwise, Description("SQNEG <Vd>.<T>, <Vn>.<T>")]
  2518. public void Sqneg_V_8B_4H_2S([Values(0u)] uint rd,
  2519. [Values(1u, 0u)] uint rn,
  2520. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2521. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2522. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  2523. {
  2524. uint opcode = 0x2E207800; // SQNEG V0.8B, V0.8B
  2525. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2526. opcode |= ((size & 3) << 22);
  2527. V128 v0 = MakeVectorE0E1(z, z);
  2528. V128 v1 = MakeVectorE0(a);
  2529. SingleOpcode(opcode, v0: v0, v1: v1);
  2530. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2531. }
  2532. [Test, Pairwise, Description("SQNEG <Vd>.<T>, <Vn>.<T>")]
  2533. public void Sqneg_V_16B_8H_4S_2D([Values(0u)] uint rd,
  2534. [Values(1u, 0u)] uint rn,
  2535. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  2536. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  2537. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  2538. {
  2539. uint opcode = 0x6E207800; // SQNEG V0.16B, V0.16B
  2540. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2541. opcode |= ((size & 3) << 22);
  2542. V128 v0 = MakeVectorE0E1(z, z);
  2543. V128 v1 = MakeVectorE0E1(a, a);
  2544. SingleOpcode(opcode, v0: v0, v1: v1);
  2545. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2546. }
  2547. [Test, Pairwise, Description("SQXTN <Vb><d>, <Va><n>")]
  2548. public void Sqxtn_S_HB_SH_DS([Values(0u)] uint rd,
  2549. [Values(1u, 0u)] uint rn,
  2550. [ValueSource(nameof(_1H1S1D_))] ulong z,
  2551. [ValueSource(nameof(_1H1S1D_))] ulong a,
  2552. [Values(0b00u, 0b01u, 0b10u)] uint size) // <HB, SH, DS>
  2553. {
  2554. uint opcode = 0x5E214800; // SQXTN B0, H0
  2555. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2556. opcode |= ((size & 3) << 22);
  2557. V128 v0 = MakeVectorE0E1(z, z);
  2558. V128 v1 = MakeVectorE0(a);
  2559. SingleOpcode(opcode, v0: v0, v1: v1);
  2560. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2561. }
  2562. [Test, Pairwise, Description("SQXTN{2} <Vd>.<Tb>, <Vn>.<Ta>")]
  2563. public void Sqxtn_V_8H8B_4S4H_2D2S([Values(0u)] uint rd,
  2564. [Values(1u, 0u)] uint rn,
  2565. [ValueSource(nameof(_4H2S1D_))] ulong z,
  2566. [ValueSource(nameof(_4H2S1D_))] ulong a,
  2567. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8H8B, 4S4H, 2D2S>
  2568. {
  2569. uint opcode = 0x0E214800; // SQXTN V0.8B, V0.8H
  2570. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2571. opcode |= ((size & 3) << 22);
  2572. V128 v0 = MakeVectorE0E1(z, z);
  2573. V128 v1 = MakeVectorE0E1(a, a);
  2574. SingleOpcode(opcode, v0: v0, v1: v1);
  2575. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2576. }
  2577. [Test, Pairwise, Description("SQXTN{2} <Vd>.<Tb>, <Vn>.<Ta>")]
  2578. public void Sqxtn_V_8H16B_4S8H_2D4S([Values(0u)] uint rd,
  2579. [Values(1u, 0u)] uint rn,
  2580. [ValueSource(nameof(_4H2S1D_))] ulong z,
  2581. [ValueSource(nameof(_4H2S1D_))] ulong a,
  2582. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8H16B, 4S8H, 2D4S>
  2583. {
  2584. uint opcode = 0x4E214800; // SQXTN2 V0.16B, V0.8H
  2585. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2586. opcode |= ((size & 3) << 22);
  2587. V128 v0 = MakeVectorE0E1(z, z);
  2588. V128 v1 = MakeVectorE0E1(a, a);
  2589. SingleOpcode(opcode, v0: v0, v1: v1);
  2590. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2591. }
  2592. [Test, Pairwise, Description("SQXTUN <Vb><d>, <Va><n>")]
  2593. public void Sqxtun_S_HB_SH_DS([Values(0u)] uint rd,
  2594. [Values(1u, 0u)] uint rn,
  2595. [ValueSource(nameof(_1H1S1D_))] ulong z,
  2596. [ValueSource(nameof(_1H1S1D_))] ulong a,
  2597. [Values(0b00u, 0b01u, 0b10u)] uint size) // <HB, SH, DS>
  2598. {
  2599. uint opcode = 0x7E212800; // SQXTUN B0, H0
  2600. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2601. opcode |= ((size & 3) << 22);
  2602. V128 v0 = MakeVectorE0E1(z, z);
  2603. V128 v1 = MakeVectorE0(a);
  2604. SingleOpcode(opcode, v0: v0, v1: v1);
  2605. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2606. }
  2607. [Test, Pairwise, Description("SQXTUN{2} <Vd>.<Tb>, <Vn>.<Ta>")]
  2608. public void Sqxtun_V_8H8B_4S4H_2D2S([Values(0u)] uint rd,
  2609. [Values(1u, 0u)] uint rn,
  2610. [ValueSource(nameof(_4H2S1D_))] ulong z,
  2611. [ValueSource(nameof(_4H2S1D_))] ulong a,
  2612. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8H8B, 4S4H, 2D2S>
  2613. {
  2614. uint opcode = 0x2E212800; // SQXTUN V0.8B, V0.8H
  2615. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2616. opcode |= ((size & 3) << 22);
  2617. V128 v0 = MakeVectorE0E1(z, z);
  2618. V128 v1 = MakeVectorE0E1(a, a);
  2619. SingleOpcode(opcode, v0: v0, v1: v1);
  2620. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2621. }
  2622. [Test, Pairwise, Description("SQXTUN{2} <Vd>.<Tb>, <Vn>.<Ta>")]
  2623. public void Sqxtun_V_8H16B_4S8H_2D4S([Values(0u)] uint rd,
  2624. [Values(1u, 0u)] uint rn,
  2625. [ValueSource(nameof(_4H2S1D_))] ulong z,
  2626. [ValueSource(nameof(_4H2S1D_))] ulong a,
  2627. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8H16B, 4S8H, 2D4S>
  2628. {
  2629. uint opcode = 0x6E212800; // SQXTUN2 V0.16B, V0.8H
  2630. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2631. opcode |= ((size & 3) << 22);
  2632. V128 v0 = MakeVectorE0E1(z, z);
  2633. V128 v1 = MakeVectorE0E1(a, a);
  2634. SingleOpcode(opcode, v0: v0, v1: v1);
  2635. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2636. }
  2637. [Test, Pairwise, Description("SUQADD <V><d>, <V><n>")]
  2638. public void Suqadd_S_B_H_S_D([Values(0u)] uint rd,
  2639. [Values(1u, 0u)] uint rn,
  2640. [ValueSource(nameof(_1B1H1S1D_))] ulong z,
  2641. [ValueSource(nameof(_1B1H1S1D_))] ulong a,
  2642. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <B, H, S, D>
  2643. {
  2644. uint opcode = 0x5E203800; // SUQADD B0, B0
  2645. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2646. opcode |= ((size & 3) << 22);
  2647. V128 v0 = MakeVectorE0E1(z, z);
  2648. V128 v1 = MakeVectorE0(a);
  2649. SingleOpcode(opcode, v0: v0, v1: v1);
  2650. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2651. }
  2652. [Test, Pairwise, Description("SUQADD <Vd>.<T>, <Vn>.<T>")]
  2653. public void Suqadd_V_8B_4H_2S([Values(0u)] uint rd,
  2654. [Values(1u, 0u)] uint rn,
  2655. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2656. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2657. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  2658. {
  2659. uint opcode = 0x0E203800; // SUQADD V0.8B, V0.8B
  2660. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2661. opcode |= ((size & 3) << 22);
  2662. V128 v0 = MakeVectorE0E1(z, z);
  2663. V128 v1 = MakeVectorE0(a);
  2664. SingleOpcode(opcode, v0: v0, v1: v1);
  2665. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2666. }
  2667. [Test, Pairwise, Description("SUQADD <Vd>.<T>, <Vn>.<T>")]
  2668. public void Suqadd_V_16B_8H_4S_2D([Values(0u)] uint rd,
  2669. [Values(1u, 0u)] uint rn,
  2670. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  2671. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  2672. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  2673. {
  2674. uint opcode = 0x4E203800; // SUQADD V0.16B, V0.16B
  2675. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2676. opcode |= ((size & 3) << 22);
  2677. V128 v0 = MakeVectorE0E1(z, z);
  2678. V128 v1 = MakeVectorE0E1(a, a);
  2679. SingleOpcode(opcode, v0: v0, v1: v1);
  2680. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2681. }
  2682. [Test, Pairwise, Description("UADALP <Vd>.<Ta>, <Vn>.<Tb>")]
  2683. public void Uadalp_V_8B4H_4H2S_2S1D([Values(0u)] uint rd,
  2684. [Values(1u, 0u)] uint rn,
  2685. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2686. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2687. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B4H, 4H2S, 2S1D>
  2688. {
  2689. uint opcode = 0x2E206800; // UADALP V0.4H, V0.8B
  2690. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2691. opcode |= ((size & 3) << 22);
  2692. V128 v0 = MakeVectorE0E1(z, z);
  2693. V128 v1 = MakeVectorE0(a);
  2694. SingleOpcode(opcode, v0: v0, v1: v1);
  2695. CompareAgainstUnicorn();
  2696. }
  2697. [Test, Pairwise, Description("UADALP <Vd>.<Ta>, <Vn>.<Tb>")]
  2698. public void Uadalp_V_16B8H_8H4S_4S2D([Values(0u)] uint rd,
  2699. [Values(1u, 0u)] uint rn,
  2700. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2701. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2702. [Values(0b00u, 0b01u, 0b10u)] uint size) // <16B8H, 8H4S, 4S2D>
  2703. {
  2704. uint opcode = 0x6E206800; // UADALP V0.8H, V0.16B
  2705. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2706. opcode |= ((size & 3) << 22);
  2707. V128 v0 = MakeVectorE0E1(z, z);
  2708. V128 v1 = MakeVectorE0E1(a, a);
  2709. SingleOpcode(opcode, v0: v0, v1: v1);
  2710. CompareAgainstUnicorn();
  2711. }
  2712. [Test, Pairwise, Description("UADDLP <Vd>.<Ta>, <Vn>.<Tb>")]
  2713. public void Uaddlp_V_8B4H_4H2S_2S1D([Values(0u)] uint rd,
  2714. [Values(1u, 0u)] uint rn,
  2715. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2716. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2717. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B4H, 4H2S, 2S1D>
  2718. {
  2719. uint opcode = 0x2E202800; // UADDLP V0.4H, V0.8B
  2720. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2721. opcode |= ((size & 3) << 22);
  2722. V128 v0 = MakeVectorE0E1(z, z);
  2723. V128 v1 = MakeVectorE0(a);
  2724. SingleOpcode(opcode, v0: v0, v1: v1);
  2725. CompareAgainstUnicorn();
  2726. }
  2727. [Test, Pairwise, Description("UADDLP <Vd>.<Ta>, <Vn>.<Tb>")]
  2728. public void Uaddlp_V_16B8H_8H4S_4S2D([Values(0u)] uint rd,
  2729. [Values(1u, 0u)] uint rn,
  2730. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2731. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2732. [Values(0b00u, 0b01u, 0b10u)] uint size) // <16B8H, 8H4S, 4S2D>
  2733. {
  2734. uint opcode = 0x6E202800; // UADDLP V0.8H, V0.16B
  2735. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2736. opcode |= ((size & 3) << 22);
  2737. V128 v0 = MakeVectorE0E1(z, z);
  2738. V128 v1 = MakeVectorE0E1(a, a);
  2739. SingleOpcode(opcode, v0: v0, v1: v1);
  2740. CompareAgainstUnicorn();
  2741. }
  2742. [Test, Pairwise, Description("UQXTN <Vb><d>, <Va><n>")]
  2743. public void Uqxtn_S_HB_SH_DS([Values(0u)] uint rd,
  2744. [Values(1u, 0u)] uint rn,
  2745. [ValueSource(nameof(_1H1S1D_))] ulong z,
  2746. [ValueSource(nameof(_1H1S1D_))] ulong a,
  2747. [Values(0b00u, 0b01u, 0b10u)] uint size) // <HB, SH, DS>
  2748. {
  2749. uint opcode = 0x7E214800; // UQXTN B0, H0
  2750. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2751. opcode |= ((size & 3) << 22);
  2752. V128 v0 = MakeVectorE0E1(z, z);
  2753. V128 v1 = MakeVectorE0(a);
  2754. SingleOpcode(opcode, v0: v0, v1: v1);
  2755. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2756. }
  2757. [Test, Pairwise, Description("UQXTN{2} <Vd>.<Tb>, <Vn>.<Ta>")]
  2758. public void Uqxtn_V_8H8B_4S4H_2D2S([Values(0u)] uint rd,
  2759. [Values(1u, 0u)] uint rn,
  2760. [ValueSource(nameof(_4H2S1D_))] ulong z,
  2761. [ValueSource(nameof(_4H2S1D_))] ulong a,
  2762. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8H8B, 4S4H, 2D2S>
  2763. {
  2764. uint opcode = 0x2E214800; // UQXTN V0.8B, V0.8H
  2765. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2766. opcode |= ((size & 3) << 22);
  2767. V128 v0 = MakeVectorE0E1(z, z);
  2768. V128 v1 = MakeVectorE0E1(a, a);
  2769. SingleOpcode(opcode, v0: v0, v1: v1);
  2770. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2771. }
  2772. [Test, Pairwise, Description("UQXTN{2} <Vd>.<Tb>, <Vn>.<Ta>")]
  2773. public void Uqxtn_V_8H16B_4S8H_2D4S([Values(0u)] uint rd,
  2774. [Values(1u, 0u)] uint rn,
  2775. [ValueSource(nameof(_4H2S1D_))] ulong z,
  2776. [ValueSource(nameof(_4H2S1D_))] ulong a,
  2777. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8H16B, 4S8H, 2D4S>
  2778. {
  2779. uint opcode = 0x6E214800; // UQXTN2 V0.16B, V0.8H
  2780. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2781. opcode |= ((size & 3) << 22);
  2782. V128 v0 = MakeVectorE0E1(z, z);
  2783. V128 v1 = MakeVectorE0E1(a, a);
  2784. SingleOpcode(opcode, v0: v0, v1: v1);
  2785. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2786. }
  2787. [Test, Pairwise, Description("USQADD <V><d>, <V><n>")]
  2788. public void Usqadd_S_B_H_S_D([Values(0u)] uint rd,
  2789. [Values(1u, 0u)] uint rn,
  2790. [ValueSource(nameof(_1B1H1S1D_))] ulong z,
  2791. [ValueSource(nameof(_1B1H1S1D_))] ulong a,
  2792. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <B, H, S, D>
  2793. {
  2794. uint opcode = 0x7E203800; // USQADD B0, B0
  2795. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2796. opcode |= ((size & 3) << 22);
  2797. V128 v0 = MakeVectorE0E1(z, z);
  2798. V128 v1 = MakeVectorE0(a);
  2799. SingleOpcode(opcode, v0: v0, v1: v1);
  2800. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2801. }
  2802. [Test, Pairwise, Description("USQADD <Vd>.<T>, <Vn>.<T>")]
  2803. public void Usqadd_V_8B_4H_2S([Values(0u)] uint rd,
  2804. [Values(1u, 0u)] uint rn,
  2805. [ValueSource(nameof(_8B4H2S_))] ulong z,
  2806. [ValueSource(nameof(_8B4H2S_))] ulong a,
  2807. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8B, 4H, 2S>
  2808. {
  2809. uint opcode = 0x2E203800; // USQADD V0.8B, V0.8B
  2810. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2811. opcode |= ((size & 3) << 22);
  2812. V128 v0 = MakeVectorE0E1(z, z);
  2813. V128 v1 = MakeVectorE0(a);
  2814. SingleOpcode(opcode, v0: v0, v1: v1);
  2815. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2816. }
  2817. [Test, Pairwise, Description("USQADD <Vd>.<T>, <Vn>.<T>")]
  2818. public void Usqadd_V_16B_8H_4S_2D([Values(0u)] uint rd,
  2819. [Values(1u, 0u)] uint rn,
  2820. [ValueSource(nameof(_8B4H2S1D_))] ulong z,
  2821. [ValueSource(nameof(_8B4H2S1D_))] ulong a,
  2822. [Values(0b00u, 0b01u, 0b10u, 0b11u)] uint size) // <16B, 8H, 4S, 2D>
  2823. {
  2824. uint opcode = 0x6E203800; // USQADD V0.16B, V0.16B
  2825. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2826. opcode |= ((size & 3) << 22);
  2827. V128 v0 = MakeVectorE0E1(z, z);
  2828. V128 v1 = MakeVectorE0E1(a, a);
  2829. SingleOpcode(opcode, v0: v0, v1: v1);
  2830. CompareAgainstUnicorn(fpsrMask: Fpsr.Qc);
  2831. }
  2832. [Test, Pairwise, Description("XTN{2} <Vd>.<Tb>, <Vn>.<Ta>")]
  2833. public void Xtn_V_8H8B_4S4H_2D2S([Values(0u)] uint rd,
  2834. [Values(1u, 0u)] uint rn,
  2835. [ValueSource(nameof(_4H2S1D_))] ulong z,
  2836. [ValueSource(nameof(_4H2S1D_))] ulong a,
  2837. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8H8B, 4S4H, 2D2S>
  2838. {
  2839. uint opcode = 0x0E212800; // XTN V0.8B, V0.8H
  2840. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2841. opcode |= ((size & 3) << 22);
  2842. V128 v0 = MakeVectorE0E1(z, z);
  2843. V128 v1 = MakeVectorE0E1(a, a);
  2844. SingleOpcode(opcode, v0: v0, v1: v1);
  2845. CompareAgainstUnicorn();
  2846. }
  2847. [Test, Pairwise, Description("XTN{2} <Vd>.<Tb>, <Vn>.<Ta>")]
  2848. public void Xtn_V_8H16B_4S8H_2D4S([Values(0u)] uint rd,
  2849. [Values(1u, 0u)] uint rn,
  2850. [ValueSource(nameof(_4H2S1D_))] ulong z,
  2851. [ValueSource(nameof(_4H2S1D_))] ulong a,
  2852. [Values(0b00u, 0b01u, 0b10u)] uint size) // <8H16B, 4S8H, 2D4S>
  2853. {
  2854. uint opcode = 0x4E212800; // XTN2 V0.16B, V0.8H
  2855. opcode |= ((rn & 31) << 5) | ((rd & 31) << 0);
  2856. opcode |= ((size & 3) << 22);
  2857. V128 v0 = MakeVectorE0E1(z, z);
  2858. V128 v1 = MakeVectorE0E1(a, a);
  2859. SingleOpcode(opcode, v0: v0, v1: v1);
  2860. CompareAgainstUnicorn();
  2861. }
  2862. #endif
  2863. }
  2864. }