12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485 |
- using System;
- using System.Diagnostics;
-
- namespace Unity.Burst.Intrinsics
- {
- public unsafe static partial class X86
- {
- /// <summary>
- /// AVX intrinsics
- /// </summary>
- public static class Avx
- {
- /// <summary>
- /// Evaluates to true at compile time if AVX intrinsics are supported.
- /// </summary>
- public static bool IsAvxSupported { get { return false; } }
-
- /// <summary>
- /// Compare predicates for scalar and packed compare intrinsic functions
- /// </summary>
- public enum CMP
- {
- ///<summary>
- /// Equal (ordered, nonsignaling)
- ///</summary>
- EQ_OQ = 0x00,
- /// <summary>
- /// Less-than (ordered, signaling)
- /// </summary>
- LT_OS = 0x01,
- /// <summary>
- /// Less-than-or-equal (ordered, signaling)
- /// </summary>
- LE_OS = 0x02,
- /// <summary>
- /// Unordered (nonsignaling)
- /// </summary>
- UNORD_Q = 0x03,
- /// <summary>
- /// Not-equal (unordered, nonsignaling)
- /// </summary>
- NEQ_UQ = 0x04,
- /// <summary>
- /// Not-less-than (unordered, signaling)
- /// </summary>
- NLT_US = 0x05,
- /// <summary>
- /// Not-less-than-or-equal (unordered, ignaling)
- /// </summary>
- NLE_US = 0x06,
- /// <summary>
- /// Ordered (nonsignaling)
- /// </summary>
- ORD_Q = 0x07,
- /// <summary>
- /// Equal (unordered, non-signaling)
- /// </summary>
- EQ_UQ = 0x08,
- /// <summary>
- /// Not-greater-than-or-equal (unordered, signaling)
- /// </summary>
- NGE_US = 0x09,
- /// <summary>
- /// Not-greater-than (unordered, signaling)
- /// </summary>
- NGT_US = 0x0A,
- /// <summary>
- /// False (ordered, nonsignaling)
- /// </summary>
- FALSE_OQ = 0x0B,
- /// <summary>
- /// Not-equal (ordered, non-signaling)
- /// </summary>
- NEQ_OQ = 0x0C,
- /// <summary>
- /// Greater-than-or-equal (ordered, signaling)
- /// </summary>
- GE_OS = 0x0D,
- /// <summary>
- /// Greater-than (ordered, signaling)
- /// </summary>
- GT_OS = 0x0E,
- /// <summary>
- /// True (unordered, non-signaling)
- /// </summary>
- TRUE_UQ = 0x0F,
- /// <summary>
- /// Equal (ordered, signaling)
- /// </summary>
- EQ_OS = 0x10,
- /// <summary>
- /// Less-than (ordered, nonsignaling)
- /// </summary>
- LT_OQ = 0x11,
- /// <summary>
- /// Less-than-or-equal (ordered, nonsignaling)
- /// </summary>
- LE_OQ = 0x12,
- /// <summary>
- /// Unordered (signaling)
- /// </summary>
- UNORD_S = 0x13,
- /// <summary>
- /// Not-equal (unordered, signaling)
- /// </summary>
- NEQ_US = 0x14,
- /// <summary>
- /// Not-less-than (unordered, nonsignaling)
- /// </summary>
- NLT_UQ = 0x15,
- /// <summary>
- /// Not-less-than-or-equal (unordered, nonsignaling)
- /// </summary>
- NLE_UQ = 0x16,
- /// <summary>
- /// Ordered (signaling)
- /// </summary>
- ORD_S = 0x17,
- /// <summary>
- /// Equal (unordered, signaling)
- /// </summary>
- EQ_US = 0x18,
- /// <summary>
- /// Not-greater-than-or-equal (unordered, nonsignaling)
- /// </summary>
- NGE_UQ = 0x19,
- /// <summary>
- /// Not-greater-than (unordered, nonsignaling)
- /// </summary>
- NGT_UQ = 0x1A,
- /// <summary>
- /// False (ordered, signaling)
- /// </summary>
- FALSE_OS = 0x1B,
- /// <summary>
- /// Not-equal (ordered, signaling)
- /// </summary>
- NEQ_OS = 0x1C,
- /// <summary>
- /// Greater-than-or-equal (ordered, nonsignaling)
- /// </summary>
- GE_OQ = 0x1D,
- /// <summary>
- /// Greater-than (ordered, nonsignaling)
- /// </summary>
- GT_OQ = 0x1E,
- /// <summary>
- /// True (unordered, signaling)
- /// </summary>
- TRUE_US = 0x1F,
- }
-
- /// <summary>
- /// Add packed double-precision (64-bit) floating-point elements in a and b, and store the results in dst.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_add_pd(v256 a, v256 b)
- {
- return new v256(Sse2.add_pd(a.Lo128, b.Lo128), Sse2.add_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Add packed single-precision (32-bit) floating-point elements in a and b, and store the results in dst.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_add_ps(v256 a, v256 b)
- {
- return new v256(Sse.add_ps(a.Lo128, b.Lo128), Sse.add_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Alternatively add and subtract packed double-precision (64-bit) floating-point elements in a to/from packed elements in b, and store the results in dst.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_addsub_pd(v256 a, v256 b)
- {
- return new v256(Sse3.addsub_pd(a.Lo128, b.Lo128), Sse3.addsub_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Alternatively add and subtract packed single-precision (32-bit) floating-point elements in a to/from packed elements in b, and store the results in dst.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_addsub_ps(v256 a, v256 b)
- {
- return new v256(Sse3.addsub_ps(a.Lo128, b.Lo128), Sse3.addsub_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compute the bitwise AND of packed double-precision (64-bit) floating-point elements in a and b, and store the results in dst.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_and_pd(v256 a, v256 b)
- {
- return new v256(Sse2.and_pd(a.Lo128, b.Lo128), Sse2.and_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compute the bitwise AND of packed single-precision (32-bit) floating-point elements in a and b, and store the results in dst.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_and_ps(v256 a, v256 b)
- {
- return new v256(Sse.and_ps(a.Lo128, b.Lo128), Sse.and_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compute the bitwise NOT of packed double-precision (64-bit) floating-point elements in a and then AND with b, and store the results in dst.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_andnot_pd(v256 a, v256 b)
- {
- return new v256(Sse2.andnot_pd(a.Lo128, b.Lo128), Sse2.andnot_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compute the bitwise NOT of packed single-precision (32-bit) floating-point elements in a and then AND with b, and store the results in dst.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_andnot_ps(v256 a, v256 b)
- {
- return new v256(Sse.andnot_ps(a.Lo128, b.Lo128), Sse.andnot_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Blend packed double-precision (64-bit) floating-point elements from a and b using control mask imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VBLENDPD ymm1, ymm2, ymm3/v256, imm8
- /// Double-Precision Floating-Point values from the second source operand are
- /// conditionally merged with values from the first source operand and written
- /// to the destination. The immediate bits [3:0] determine whether the
- /// corresponding Double-Precision Floating Point value in the destination is
- /// copied from the second source or first source. If a bit in the mask,
- /// corresponding to a word, is "1", then the Double-Precision Floating-Point
- /// value in the second source operand is copied, else the value in the first
- /// source operand is copied
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">Control mask</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_blend_pd(v256 a, v256 b, int imm8)
- {
- return new v256(Sse4_1.blend_pd(a.Lo128, b.Lo128, imm8 & 0x3), Sse4_1.blend_pd(a.Hi128, b.Hi128, imm8 >> 2));
- }
-
- /// <summary>
- /// Blend packed single-precision (32-bit) floating-point elements from a and b using control mask imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VBLENDPS ymm1, ymm2, ymm3/v256, imm8
- /// Single precision floating point values from the second source operand are
- /// conditionally merged with values from the first source operand and written
- /// to the destination. The immediate bits [7:0] determine whether the
- /// corresponding single precision floating-point value in the destination is
- /// copied from the second source or first source. If a bit in the mask,
- /// corresponding to a word, is "1", then the single-precision floating-point
- /// value in the second source operand is copied, else the value in the first
- /// source operand is copied
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">Control mask</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_blend_ps(v256 a, v256 b, int imm8)
- {
- return new v256(Sse4_1.blend_ps(a.Lo128, b.Lo128, imm8 & 0xf), Sse4_1.blend_ps(a.Hi128, b.Hi128, imm8 >> 4));
- }
-
- /// <summary>
- /// Blend packed double-precision (64-bit) floating-point elements from a and b using mask, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VBLENDVPD ymm1, ymm2, ymm3/v256, ymm4
- /// Conditionally copy each quadword data element of double-precision
- /// floating-point value from the second source operand (third operand) and the
- /// first source operand (second operand) depending on mask bits defined in the
- /// mask register operand (fourth operand).
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="mask">Mask</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_blendv_pd(v256 a, v256 b, v256 mask)
- {
- return new v256(Sse4_1.blendv_pd(a.Lo128, b.Lo128, mask.Lo128), Sse4_1.blendv_pd(a.Hi128, b.Hi128, mask.Hi128));
- }
-
- /// <summary>
- /// Blend packed single-precision (32-bit) floating-point elements from a and b using mask, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// Blend Packed Single Precision Floating-Point Values
- /// **** VBLENDVPS ymm1, ymm2, ymm3/v256, ymm4
- /// Conditionally copy each dword data element of single-precision
- /// floating-point value from the second source operand (third operand) and the
- /// first source operand (second operand) depending on mask bits defined in the
- /// mask register operand (fourth operand).
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="mask">Mask</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_blendv_ps(v256 a, v256 b, v256 mask)
- {
- return new v256(Sse4_1.blendv_ps(a.Lo128, b.Lo128, mask.Lo128), Sse4_1.blendv_ps(a.Hi128, b.Hi128, mask.Hi128));
- }
-
- /// <summary>
- /// Divide packed double-precision (64-bit) floating-point elements in a by packed elements in b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VDIVPD ymm1, ymm2, ymm3/v256
- /// Performs an SIMD divide of the four packed double-precision floating-point
- /// values in the first source operand by the four packed double-precision
- /// floating-point values in the second source operand
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_div_pd(v256 a, v256 b)
- {
- return new v256(Sse2.div_pd(a.Lo128, b.Lo128), Sse2.div_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Divide packed single-precision (32-bit) floating-point elements in a by packed elements in b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// Divide Packed Single-Precision Floating-Point Values
- /// **** VDIVPS ymm1, ymm2, ymm3/v256
- /// Performs an SIMD divide of the eight packed single-precision
- /// floating-point values in the first source operand by the eight packed
- /// single-precision floating-point values in the second source operand
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_div_ps(v256 a, v256 b)
- {
- return new v256(Sse.div_ps(a.Lo128, b.Lo128), Sse.div_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Conditionally multiply the packed single-precision (32-bit)
- /// floating-point elements in a and b using the high 4 bits in
- /// imm8, sum the four products, and conditionally store the sum in
- /// dst using the low 4 bits of imm8.
- /// </summary>
- /// <remarks>
- /// **** VDPPS ymm1, ymm2, ymm3/v256, imm8
- /// Multiplies the packed single precision floating point values in the
- /// first source operand with the packed single-precision floats in the
- /// second source. Each of the four resulting single-precision values is
- /// conditionally summed depending on a mask extracted from the high 4 bits
- /// of the immediate operand. This sum is broadcast to each of 4 positions
- /// in the destination if the corresponding bit of the mask selected from
- /// the low 4 bits of the immediate operand is "1". If the corresponding
- /// low bit 0-3 of the mask is zero, the destination is set to zero.
- /// The process is replicated for the high elements of the destination.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_dp_ps(v256 a, v256 b, int imm8)
- {
- return new v256(Sse4_1.dp_ps(a.Lo128, b.Lo128, imm8), Sse4_1.dp_ps(a.Hi128, b.Hi128, imm8));
- }
-
- /// <summary>
- /// Horizontally add adjacent pairs of double-precision (64-bit) floating-point elements in a and b, and pack the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VHADDPD ymm1, ymm2, ymm3/v256
- /// Adds pairs of adjacent double-precision floating-point values in the
- /// first source operand and second source operand and stores results in
- /// the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_hadd_pd(v256 a, v256 b)
- {
- return new v256(Sse3.hadd_pd(a.Lo128, b.Lo128), Sse3.hadd_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Horizontally add adjacent pairs of single-precision (32-bit) floating-point elements in a and b, and pack the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VHADDPS ymm1, ymm2, ymm3/v256
- /// Adds pairs of adjacent single-precision floating-point values in the
- /// first source operand and second source operand and stores results in
- /// the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_hadd_ps(v256 a, v256 b)
- {
- return new v256(Sse3.hadd_ps(a.Lo128, b.Lo128), Sse3.hadd_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Horizontally subtract adjacent pairs of double-precision (64-bit) floating-point elements in a and b, and pack the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VHSUBPD ymm1, ymm2, ymm3/v256
- /// Subtract pairs of adjacent double-precision floating-point values in
- /// the first source operand and second source operand and stores results
- /// in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_hsub_pd(v256 a, v256 b)
- {
- return new v256(Sse3.hsub_pd(a.Lo128, b.Lo128), Sse3.hsub_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Horizontally add adjacent pairs of single-precision (32-bit) floating-point elements in a and b, and pack the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VHSUBPS ymm1, ymm2, ymm3/v256
- /// Subtract pairs of adjacent single-precision floating-point values in
- /// the first source operand and second source operand and stores results
- /// in the destination.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_hsub_ps(v256 a, v256 b)
- {
- return new v256(Sse3.hsub_ps(a.Lo128, b.Lo128), Sse3.hsub_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compare packed double-precision (64-bit) floating-point elements in a and b, and store packed maximum values in dst.
- /// </summary>
- /// <remarks>
- /// **** VMAXPD ymm1, ymm2, ymm3/v256
- /// Performs an SIMD compare of the packed double-precision floating-point
- /// values in the first source operand and the second source operand and
- /// returns the maximum value for each pair of values to the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_max_pd(v256 a, v256 b)
- {
- return new v256(Sse2.max_pd(a.Lo128, b.Lo128), Sse2.max_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compare packed single-precision (32-bit) floating-point elements in a and b, and store packed maximum values in dst.
- /// </summary>
- /// <remarks>
- /// **** VMAXPS ymm1, ymm2, ymm3/v256
- /// Performs an SIMD compare of the packed single-precision floating-point
- /// values in the first source operand and the second source operand and
- /// returns the maximum value for each pair of values to the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_max_ps(v256 a, v256 b)
- {
- return new v256(Sse.max_ps(a.Lo128, b.Lo128), Sse.max_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compare packed double-precision (64-bit) floating-point elements in a and b, and store packed minimum values in dst.
- /// </summary>
- /// <remarks>
- /// **** VMINPD ymm1, ymm2, ymm3/v256
- /// Performs an SIMD compare of the packed double-precision floating-point
- /// values in the first source operand and the second source operand and
- /// returns the minimum value for each pair of values to the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_min_pd(v256 a, v256 b)
- {
- return new v256(Sse2.min_pd(a.Lo128, b.Lo128), Sse2.min_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compare packed single-precision (32-bit) floating-point elements in a and b, and store packed minimum values in dst.
- /// </summary>
- /// <remarks>
- /// **** VMINPS ymm1, ymm2, ymm3/v256
- /// Performs an SIMD compare of the packed single-precision floating-point
- /// values in the first source operand and the second source operand and
- /// returns the minimum value for each pair of values to the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_min_ps(v256 a, v256 b)
- {
- return new v256(Sse.min_ps(a.Lo128, b.Lo128), Sse.min_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Multiply packed double-precision (64-bit) floating-point elements in a and b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VMULPD ymm1, ymm2, ymm3/v256
- /// Performs a SIMD multiply of the four packed double-precision floating-point
- /// values from the first Source operand to the Second Source operand, and
- /// stores the packed double-precision floating-point results in the
- /// destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_mul_pd(v256 a, v256 b)
- {
- return new v256(Sse2.mul_pd(a.Lo128, b.Lo128), Sse2.mul_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Multiply packed single-precision (32-bit) floating-point elements in a and b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VMULPS ymm1, ymm2, ymm3/v256
- /// Performs an SIMD multiply of the eight packed single-precision
- /// floating-point values from the first source operand to the second source
- /// operand, and stores the packed double-precision floating-point results in
- /// the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_mul_ps(v256 a, v256 b)
- {
- return new v256(Sse.mul_ps(a.Lo128, b.Lo128), Sse.mul_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compute the bitwise OR of packed double-precision (64-bit) floating-point elements in a and b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VORPD ymm1, ymm2, ymm3/v256
- /// Performs a bitwise logical OR of the four packed double-precision
- /// floating-point values from the first source operand and the second
- /// source operand, and stores the result in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_or_pd(v256 a, v256 b)
- {
- return new v256(Sse2.or_pd(a.Lo128, b.Lo128), Sse2.or_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compute the bitwise OR of packed single-precision (32-bit) floating-point elements in a and b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VORPS ymm1, ymm2, ymm3/v256
- /// Performs a bitwise logical OR of the eight packed single-precision
- /// floating-point values from the first source operand and the second
- /// source operand, and stores the result in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_or_ps(v256 a, v256 b)
- {
- return new v256(Sse.or_ps(a.Lo128, b.Lo128), Sse.or_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Shuffle double-precision (64-bit) floating-point elements within 128-bit lanes using the control in imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VSHUFPD ymm1, ymm2, ymm3/v256, imm8
- /// Moves either of the two packed double-precision floating-point values from
- /// each double quadword in the first source operand into the low quadword
- /// of each double quadword of the destination; moves either of the two packed
- /// double-precision floating-point values from the second source operand into
- /// the high quadword of each double quadword of the destination operand.
- /// The selector operand determines which values are moved to the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_shuffle_pd(v256 a, v256 b, int imm8)
- {
- return new v256(Sse2.shuffle_pd(a.Lo128, b.Lo128, imm8 & 3), Sse2.shuffle_pd(a.Hi128, b.Hi128, imm8 >> 2));
- }
-
- /// <summary>
- /// Shuffle single-precision (32-bit) floating-point elements in a within 128-bit lanes using the control in imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VSHUFPS ymm1, ymm2, ymm3/v256, imm8
- /// Moves two of the four packed single-precision floating-point values
- /// from each double qword of the first source operand into the low
- /// quadword of each double qword of the destination; moves two of the four
- /// packed single-precision floating-point values from each double qword of
- /// the second source operand into to the high quadword of each double qword
- /// of the destination. The selector operand determines which values are moved
- /// to the destination.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_shuffle_ps(v256 a, v256 b, int imm8)
- {
- return new v256(Sse.shuffle_ps(a.Lo128, b.Lo128, imm8), Sse.shuffle_ps(a.Hi128, b.Hi128, imm8));
- }
-
- /// <summary>
- /// Subtract packed double-precision (64-bit) floating-point elements in b from packed double-precision (64-bit) floating-point elements in a, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VSUBPD ymm1, ymm2, ymm3/v256
- /// Performs an SIMD subtract of the four packed double-precision floating-point
- /// values of the second Source operand from the first Source operand, and
- /// stores the packed double-precision floating-point results in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_sub_pd(v256 a, v256 b)
- {
- return new v256(Sse2.sub_pd(a.Lo128, b.Lo128), Sse2.sub_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Subtract packed single-precision (32-bit) floating-point elements in b from packed single-precision (32-bit) floating-point elements in a, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VSUBPS ymm1, ymm2, ymm3/v256
- /// Performs an SIMD subtract of the eight packed single-precision
- /// floating-point values in the second Source operand from the First Source
- /// operand, and stores the packed single-precision floating-point results in
- /// the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_sub_ps(v256 a, v256 b)
- {
- return new v256(Sse.sub_ps(a.Lo128, b.Lo128), Sse.sub_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compute the bitwise XOR of packed double-precision (64-bit) floating-point elements in a and b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VXORPD ymm1, ymm2, ymm3/v256
- /// Performs a bitwise logical XOR of the four packed double-precision
- /// floating-point values from the first source operand and the second
- /// source operand, and stores the result in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_xor_pd(v256 a, v256 b)
- {
- return new v256(Sse2.xor_pd(a.Lo128, b.Lo128), Sse2.xor_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compute the bitwise XOR of packed single-precision (32-bit) floating-point elements in a and b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VXORPS ymm1, ymm2, ymm3/v256
- /// Performs a bitwise logical XOR of the eight packed single-precision
- /// floating-point values from the first source operand and the second
- /// source operand, and stores the result in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_xor_ps(v256 a, v256 b)
- {
- return new v256(Sse.xor_ps(a.Lo128, b.Lo128), Sse.xor_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compare packed double-precision (64-bit) floating-point elements in a and b based on the comparison operand specified by imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VCMPPD xmm1, xmm2, xmm3/v128, imm8
- /// Performs an SIMD compare of the four packed double-precision floating-point
- /// values in the second source operand (third operand) and the first source
- /// operand (second operand) and returns the results of the comparison to the
- /// destination operand (first operand). The comparison predicate operand
- /// (immediate) specifies the type of comparison performed on each of the pairs
- /// of packed values.
- /// For 128-bit intrinsic function with compare predicate values in range 0-7
- /// compiler may generate SSE2 instructions if it is warranted for performance
- /// reasons.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmp_pd(v128 a, v128 b, int imm8)
- {
- switch ((CMP)(imm8 & 0x1F))
- {
- // The first variants map to SSE variants
- case CMP.EQ_OQ: return Sse2.cmpeq_pd(a, b);
- case CMP.LT_OS: return Sse2.cmplt_pd(a, b);
- case CMP.LE_OS: return Sse2.cmple_pd(a, b);
- case CMP.UNORD_Q: return Sse2.cmpunord_pd(a, b);
- case CMP.NEQ_UQ: return Sse2.cmpneq_pd(a, b);
- case CMP.NLT_US: return Sse2.cmpnlt_pd(a, b);
- case CMP.NLE_US: return Sse2.cmpnle_pd(a, b);
- case CMP.ORD_Q: return Sse2.cmpord_pd(a, b);
-
- case CMP.EQ_UQ: return Sse2.or_pd(Sse2.cmpeq_pd(a, b), Sse2.cmpunord_pd(a, b));
- case CMP.NGE_UQ: return Sse2.or_pd(Sse2.cmpnge_pd(a, b), Sse2.cmpunord_pd(a, b));
- case CMP.NGT_US: return Sse2.or_pd(Sse2.cmpngt_pd(a, b), Sse2.cmpunord_pd(a, b));
- case CMP.FALSE_OQ: return default;
- case CMP.NEQ_OQ: return Sse2.and_pd(Sse2.cmpneq_pd(a, b), Sse2.cmpord_pd(a, b));
- case CMP.GE_OS: return Sse2.and_pd(Sse2.cmpge_pd(a, b), Sse2.cmpord_pd(a, b));
- case CMP.GT_OS: return Sse2.and_pd(Sse2.cmpgt_pd(a, b), Sse2.cmpord_pd(a, b));
- case CMP.TRUE_UQ: return new v128(-1);
-
- case CMP.EQ_OS: return Sse2.and_pd(Sse2.cmpeq_pd(a, b), Sse2.cmpord_pd(a, b));
- case CMP.LT_OQ: return Sse2.and_pd(Sse2.cmplt_pd(a, b), Sse2.cmpord_pd(a, b));
- case CMP.LE_OQ: return Sse2.and_pd(Sse2.cmple_pd(a, b), Sse2.cmpord_pd(a, b));
- case CMP.UNORD_S: return Sse2.cmpunord_pd(a, b);
- case CMP.NEQ_US: return Sse2.cmpneq_pd(a, b);
- case CMP.NLT_UQ: return Sse2.or_pd(Sse2.cmpnlt_pd(a, b), Sse2.cmpunord_pd(a, b));
- case CMP.NLE_UQ: return Sse2.or_pd(Sse2.cmpnle_pd(a, b), Sse2.cmpunord_pd(a, b));
- case CMP.ORD_S: return Sse2.cmpord_pd(a, b);
- case CMP.EQ_US: return Sse2.or_pd(Sse2.cmpeq_pd(a, b), Sse2.cmpunord_pd(a, b));
- case CMP.NGE_US: return Sse2.or_pd(Sse2.cmpnge_pd(a, b), Sse2.cmpunord_pd(a, b));
- case CMP.NGT_UQ: return Sse2.or_pd(Sse2.cmpngt_pd(a, b), Sse2.cmpunord_pd(a, b));
- case CMP.FALSE_OS: return default;
- case CMP.NEQ_OS: return Sse2.and_pd(Sse2.cmpneq_pd(a, b), Sse2.cmpord_pd(a, b));
- case CMP.GE_OQ: return Sse2.and_pd(Sse2.cmpge_pd(a, b), Sse2.cmpord_pd(a, b));
- case CMP.GT_OQ: return Sse2.and_pd(Sse2.cmpgt_pd(a, b), Sse2.cmpord_pd(a, b));
- default:
- return new v128(-1);
- }
- }
-
- /// <summary>
- /// Compare packed double-precision (64-bit) floating-point elements in a and b based on the comparison operand specified by imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VCMPPD ymm1, ymm2, ymm3/v256, imm8
- /// Performs an SIMD compare of the four packed double-precision floating-point
- /// values in the second source operand (third operand) and the first source
- /// operand (second operand) and returns the results of the comparison to the
- /// destination operand (first operand). The comparison predicate operand
- /// (immediate) specifies the type of comparison performed on each of the pairs
- /// of packed values.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_cmp_pd(v256 a, v256 b, int imm8)
- {
- return new v256(cmp_pd(a.Lo128, b.Lo128, imm8), cmp_pd(a.Hi128, b.Hi128, imm8));
- }
-
- /// **** VCMPPS ymm1, ymm2, ymm3/v256, imm8
- /// <summary>
- /// Compare packed single-precision (32-bit) floating-point elements in a and b based on the comparison operand specified by imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VCMPPS xmm1, xmm2, xmm3/v256, imm8
- /// Performs a SIMD compare of the packed single-precision floating-point values
- /// in the second source operand (third operand) and the first source operand
- /// (second operand) and returns the results of the comparison to the
- /// destination operand (first operand). The comparison predicate operand
- /// (immediate) specifies the type of comparison performed on each of the pairs
- /// of packed values.
- /// For 128-bit intrinsic function with compare predicate values in range 0-7
- /// compiler may generate SSE2 instructions if it is warranted for performance
- /// reasons.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmp_ps(v128 a, v128 b, int imm8)
- {
- switch ((CMP)(imm8 & 0x1F))
- {
- // The first variants map to SSE variants
- case CMP.EQ_OQ: return Sse.cmpeq_ps(a, b);
- case CMP.LT_OS: return Sse.cmplt_ps(a, b);
- case CMP.LE_OS: return Sse.cmple_ps(a, b);
- case CMP.UNORD_Q: return Sse.cmpunord_ps(a, b);
- case CMP.NEQ_UQ: return Sse.cmpneq_ps(a, b);
- case CMP.NLT_US: return Sse.cmpnlt_ps(a, b);
- case CMP.NLE_US: return Sse.cmpnle_ps(a, b);
- case CMP.ORD_Q: return Sse.cmpord_ps(a, b);
-
- case CMP.EQ_UQ: return Sse.or_ps(Sse.cmpeq_ps(a, b), Sse.cmpunord_ps(a, b));
- case CMP.NGE_UQ: return Sse.or_ps(Sse.cmpnge_ps(a, b), Sse.cmpunord_ps(a, b));
- case CMP.NGT_US: return Sse.or_ps(Sse.cmpngt_ps(a, b), Sse.cmpunord_ps(a, b));
- case CMP.FALSE_OQ: return default;
- case CMP.NEQ_OQ: return Sse.and_ps(Sse.cmpneq_ps(a, b), Sse.cmpord_ps(a, b));
- case CMP.GE_OS: return Sse.and_ps(Sse.cmpge_ps(a, b), Sse.cmpord_ps(a, b));
- case CMP.GT_OS: return Sse.and_ps(Sse.cmpgt_ps(a, b), Sse.cmpord_ps(a, b));
- case CMP.TRUE_UQ: return new v128(-1);
-
- case CMP.EQ_OS: return Sse.and_ps(Sse.cmpeq_ps(a, b), Sse.cmpord_ps(a, b));
- case CMP.LT_OQ: return Sse.and_ps(Sse.cmplt_ps(a, b), Sse.cmpord_ps(a, b));
- case CMP.LE_OQ: return Sse.and_ps(Sse.cmple_ps(a, b), Sse.cmpord_ps(a, b));
- case CMP.UNORD_S: return Sse.cmpunord_ps(a, b);
- case CMP.NEQ_US: return Sse.cmpneq_ps(a, b);
- case CMP.NLT_UQ: return Sse.or_ps(Sse.cmpnlt_ps(a, b), Sse.cmpunord_ps(a, b));
- case CMP.NLE_UQ: return Sse.or_ps(Sse.cmpnle_ps(a, b), Sse.cmpunord_ps(a, b));
- case CMP.ORD_S: return Sse.cmpord_ps(a, b);
- case CMP.EQ_US: return Sse.or_ps(Sse.cmpeq_ps(a, b), Sse.cmpunord_ps(a, b));
- case CMP.NGE_US: return Sse.or_ps(Sse.cmpnge_ps(a, b), Sse.cmpunord_ps(a, b));
- case CMP.NGT_UQ: return Sse.or_ps(Sse.cmpngt_ps(a, b), Sse.cmpunord_ps(a, b));
- case CMP.FALSE_OS: return default;
- case CMP.NEQ_OS: return Sse.and_ps(Sse.cmpneq_ps(a, b), Sse.cmpord_ps(a, b));
- case CMP.GE_OQ: return Sse.and_ps(Sse.cmpge_ps(a, b), Sse.cmpord_ps(a, b));
- case CMP.GT_OQ: return Sse.and_ps(Sse.cmpgt_ps(a, b), Sse.cmpord_ps(a, b));
- default:
- return new v128(-1);
- }
- }
-
- /// <summary>
- /// Compare packed single-precision (32-bit) floating-point elements in a and b based on the comparison operand specified by imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VCMPPS xmm1, xmm2, xmm3/v256, imm8
- /// Performs a SIMD compare of the packed single-precision floating-point values
- /// in the second source operand (third operand) and the first source operand
- /// (second operand) and returns the results of the comparison to the
- /// destination operand (first operand). The comparison predicate operand
- /// (immediate) specifies the type of comparison performed on each of the pairs
- /// of packed values.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_cmp_ps(v256 a, v256 b, int imm8)
- {
- return new v256(cmp_ps(a.Lo128, b.Lo128, imm8), cmp_ps(a.Hi128, b.Hi128, imm8));
- }
-
- /// <summary>
- /// Compare the lower double-precision (64-bit) floating-point
- /// element in a and b based on the comparison operand specified by
- /// imm8, store the result in the lower element of dst, and copy
- /// the upper element from a to the upper element of dst.
- /// </summary>
- /// <remarks>
- /// **** VCMPSD xmm1, xmm2, xmm3/m64, imm8
- /// Compares the low double-precision floating-point values in the second source
- /// operand (third operand) and the first source operand (second operand) and
- /// returns the results in of the comparison to the destination operand (first
- /// operand). The comparison predicate operand (immediate operand) specifies the
- /// type of comparison performed.
- /// For compare predicate values in range 0-7 compiler may generate SSE2
- /// instructions if it is warranted for performance reasons.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmp_sd(v128 a, v128 b, int imm8)
- {
- v128 full = cmp_pd(a, b, imm8);
- return new v128(full.ULong0, a.ULong1);
- }
-
- /// <summary>
- /// Compare the lower single-precision (32-bit) floating-point
- /// element in a and b based on the comparison operand specified by
- /// imm8, store the result in the lower element of dst, and copy
- /// the upper 3 packed elements from a to the upper elements of
- /// dst.
- /// </summary>
- /// <remarks>
- /// **** VCMPSS xmm1, xmm2, xmm3/m64, imm8
- /// Compares the low single-precision floating-point values in the second source
- /// operand (third operand) and the first source operand (second operand) and
- /// returns the results of the comparison to the destination operand (first
- /// operand). The comparison predicate operand (immediate operand) specifies
- /// the type of comparison performed.
- /// For compare predicate values in range 0-7 compiler may generate SSE2
- /// instructions if it is warranted for performance reasons.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmp_ss(v128 a, v128 b, int imm8)
- {
- v128 full = cmp_ps(a, b, imm8);
- return new v128(full.UInt0, a.UInt1, a.UInt2, a.UInt3);
- }
-
- /// <summary>
- /// Convert packed 32-bit integers in a to packed double-precision (64-bit) floating-point elements, and store the results in dst.
- /// </summary>
- /// <param name="a"></param>
- /// <remarks>
- /// **** VCVTDQ2PD ymm1, xmm2/v128
- /// Converts four packed signed doubleword integers in the source operand to
- /// four packed double-precision floating-point values in the destination
- /// </remarks>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_cvtepi32_pd(v128 a)
- {
- return new v256((double)a.SInt0, (double)a.SInt1, (double)a.SInt2, (double)a.SInt3);
- }
-
- /// <summary>
- /// Convert packed 32-bit integers in a to packed single-precision (32-bit) floating-point elements, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VCVTDQ2PS ymm1, ymm2/v256
- /// Converts eight packed signed doubleword integers in the source operand to
- /// eight packed double-precision floating-point values in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_cvtepi32_ps(v256 a)
- {
- return new v256(Sse2.cvtepi32_ps(a.Lo128), Sse2.cvtepi32_ps(a.Hi128));
- }
-
- /// <summary>
- /// Convert packed double-precision (64-bit) floating-point
- /// elements in a to packed single-precision (32-bit)
- /// floating-point elements, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VCVTPD2PS xmm1, ymm2/v256
- /// Converts four packed double-precision floating-point values in the source
- /// operand to four packed single-precision floating-point values in the
- /// destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 mm256_cvtpd_ps(v256 a)
- {
- v128 lo = Sse2.cvtpd_ps(a.Lo128);
- v128 hi = Sse2.cvtpd_ps(a.Hi128);
- return new v128(lo.Float0, lo.Float1, hi.Float0, hi.Float1);
- }
-
- /// <summary>
- /// Convert packed single-precision (32-bit) floating-point
- /// elements in a to packed 32-bit integers, and store the results
- /// in dst.
- /// </summary>
- /// <remarks>
- /// **** VCVTPS2DQ ymm1, ymm2/v256
- /// Converts eight packed single-precision floating-point values in the source
- /// operand to eight signed doubleword integers in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_cvtps_epi32(v256 a)
- {
- return new v256(Sse2.cvtps_epi32(a.Lo128), Sse2.cvtps_epi32(a.Hi128));
- }
-
- /// <summary>
- /// Convert packed single-precision (32-bit) floating-point
- /// elements in a to packed double-precision (64-bit)
- /// floating-point elements, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VCVTPS2PD ymm1, xmm2/v128
- /// Converts four packed single-precision floating-point values in the source
- /// operand to four packed double-precision floating-point values in the
- /// destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_cvtps_pd(v128 a)
- {
- // The normal Burst IR does fine here.
- return new v256(a.Float0, a.Float1, a.Float2, a.Float3);
- }
-
- /// <summary>
- /// Convert packed double-precision (64-bit) floating-point
- /// elements in a to packed 32-bit integers with truncation, and
- /// store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VCVTTPD2DQ xmm1, ymm2/v256
- /// Converts four packed double-precision floating-point values in the source
- /// operand to four packed signed doubleword integers in the destination.
- /// When a conversion is inexact, a truncated (round toward zero) value is
- /// returned. If a converted result is larger than the maximum signed doubleword
- /// integer, the floating-point invalid exception is raised, and if this
- /// exception is masked, the indefinite integer value (80000000H) is returned
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 mm256_cvttpd_epi32(v256 a)
- {
- return new v128((int)a.Double0, (int)a.Double1, (int)a.Double2, (int)a.Double3);
- }
-
- /// <summary>
- /// Convert packed double-precision(64-bit) floating-point elements
- /// in a to packed 32-bit integers, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VCVTPD2DQ xmm1, ymm2/v256
- /// Converts four packed double-precision floating-point values in the source
- /// operand to four packed signed doubleword integers in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v128 mm256_cvtpd_epi32(v256 a)
- {
- v128 q = Sse2.cvtpd_epi32(new v128(a.Double0, a.Double1));
- v128 r = Sse2.cvtpd_epi32(new v128(a.Double2, a.Double3));
- return new v128(q.SInt0, q.SInt1, r.SInt0, r.SInt1);
- }
-
- /// <summary>
- /// Convert packed single-precision (32-bit) floating-point
- /// elements in a to packed 32-bit integers with truncation, and
- /// store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VCVTTPS2DQ ymm1, ymm2/v256
- /// Converts eight packed single-precision floating-point values in the source
- /// operand to eight signed doubleword integers in the destination.
- /// When a conversion is inexact, a truncated (round toward zero) value is
- /// returned. If a converted result is larger than the maximum signed doubleword
- /// integer, the floating-point invalid exception is raised, and if this
- /// exception is masked, the indefinite integer value (80000000H) is returned
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_cvttps_epi32(v256 a)
- {
- return new v256(Sse2.cvttps_epi32(a.Lo128), Sse2.cvttps_epi32(a.Hi128));
- }
-
- /*
- * Convert Scalar Single-Precision Floating-point value in 256-bit vector to
- * equivalent C/C++ float type.
- */
- /// <summary>
- /// Copy the lower single-precision (32-bit) floating-point element of a to dst.
- /// </summary>
- /// <remarks>
- /// Identical in HPC# to accessing Float0, kept for compatibility with existing code while porting.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Float</returns>
- [DebuggerStepThrough]
- public static float mm256_cvtss_f32(v256 a)
- {
- // Burst IR is fine here.
- return a.Float0;
- }
-
- /// <summary>
- /// Extract 128 bits (composed of 4 packed single-precision (32-bit) floating-point elements) from a, selected with imm8, and store the result in dst.
- /// </summary>
- /// <remarks>
- /// **** VEXTRACTF128 xmm1/v128, ymm2, imm8
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 mm256_extractf128_ps(v256 a, int imm8)
- {
- return imm8 != 0 ? a.Hi128 : a.Lo128;
- }
-
- /// <summary>
- /// Extract 128 bits (composed of 2 packed double-precision (64-bit) floating-point elements) from a, selected with imm8, and store the result in dst.
- /// </summary>
- /// <remarks>
- /// **** VEXTRACTF128 xmm1/v128, ymm2, imm8
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 mm256_extractf128_pd(v256 a, int imm8)
- {
- return imm8 != 0 ? a.Hi128 : a.Lo128;
- }
-
- /// <summary>
- /// Extract 128 bits (composed of integer data) from a, selected with imm8, and store the result in dst.
- /// </summary>
- /// <remarks>
- /// **** VEXTRACTF128 xmm1/v128, ymm2, imm8
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 mm256_extractf128_si256(v256 a, int imm8)
- {
- return imm8 != 0 ? a.Hi128 : a.Lo128;
- }
-
- /// <summary>
- /// Zeros the contents of all YMM registers
- /// </summary>
- /// <remarks>
- /// **** VZEROALL
- /// </remarks>
- [DebuggerStepThrough]
- public static void mm256_zeroall()
- {
- // This is a no-op in C# land
- }
-
- /// <summary>
- /// Zero the upper 128 bits of all YMM registers; the lower 128-bits of the registers are unmodified.
- /// </summary>
- /// <remarks>
- /// **** VZEROUPPER
- /// </remarks>
- [DebuggerStepThrough]
- public static void mm256_zeroupper()
- {
- // This is a no-op in C# land
- }
-
- /// <summary>
- /// Shuffle single-precision (32-bit) floating-point elements in a using the control in b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERMILPS xmm1, xmm2, xmm3/v128
- /// Permute Single-Precision Floating-Point values in the first source operand
- /// using 8-bit control fields in the low bytes of corresponding elements the
- /// shuffle control and store results in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 permutevar_ps(v128 a, v128 b)
- {
- v128 dst = default;
- uint* dptr = &dst.UInt0;
- uint* aptr = &a.UInt0;
- int* bptr = &b.SInt0;
-
- for (int i = 0; i < 4; ++i)
- {
- int ndx = bptr[i] & 3;
- dptr[i] = aptr[ndx];
- }
-
- return dst;
- }
-
- /// <summary>
- /// Shuffle single-precision (32-bit) floating-point elements in a within 128-bit lanes using the control in b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERMILPS ymm1, ymm2, ymm3/v256
- /// Permute Single-Precision Floating-Point values in the first source operand
- /// using 8-bit control fields in the low bytes of corresponding elements the
- /// shuffle control and store results in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_permutevar_ps(v256 a, v256 b)
- {
- return new v256(permutevar_ps(a.Lo128, b.Lo128), permutevar_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Shuffle single-precision (32-bit) floating-point elements in a using the control in imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERMILPS xmm1, xmm2/v128, imm8
- /// Permute Single-Precision Floating-Point values in the first source operand
- /// using four 2-bit control fields in the 8-bit immediate and store results
- /// in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 permute_ps(v128 a, int imm8)
- {
- return Sse2.shuffle_epi32(a, imm8);
- }
-
- /// <summary>
- /// Shuffle single-precision (32-bit) floating-point elements in a
- /// within 128-bit lanes using the control in imm8, and store the
- /// results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERMILPS ymm1, ymm2/v256, imm8
- /// Permute Single-Precision Floating-Point values in the first source operand
- /// using four 2-bit control fields in the 8-bit immediate and store results
- /// in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_permute_ps(v256 a, int imm8)
- {
- return new v256(permute_ps(a.Lo128, imm8), permute_ps(a.Hi128, imm8));
- }
-
- /// <summary>
- /// Shuffle double-precision (64-bit) floating-point elements in a using the control in b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERMILPD xmm1, xmm2, xmm3/v128
- /// Permute Double-Precision Floating-Point values in the first source operand
- /// using 8-bit control fields in the low bytes of the second source operand
- /// and store results in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 permutevar_pd(v128 a, v128 b)
- {
- v128 dst = default;
- double* dptr = &dst.Double0;
- double* aptr = &a.Double0;
- dptr[0] = aptr[(int)(b.SLong0 & 2) >> 1];
- dptr[1] = aptr[(int)(b.SLong1 & 2) >> 1];
- return dst;
- }
-
- /// <summary>
- /// Shuffle double-precision (64-bit) floating-point elements in a within 128-bit lanes using the control in b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERMILPD ymm1, ymm2, ymm3/v256
- /// Permute Double-Precision Floating-Point values in the first source operand
- /// using 8-bit control fields in the low bytes of the second source operand
- /// and store results in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_permutevar_pd(v256 a, v256 b)
- {
- v256 dst = default;
- double* dptr = &dst.Double0;
- double* aptr = &a.Double0;
- dptr[0] = aptr[(int)(b.SLong0 & 2) >> 1];
- dptr[1] = aptr[(int)(b.SLong1 & 2) >> 1];
- dptr[2] = aptr[2 + ((int)(b.SLong2 & 2) >> 1)];
- dptr[3] = aptr[2 + ((int)(b.SLong3 & 2) >> 1)];
- return dst;
- }
-
- /*
- * Permute Double-Precision Floating-Point Values
- */
- /// <summary>
- /// Shuffle double-precision (64-bit) floating-point elements in a within 128-bit lanes using the control in imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERMILPD ymm1, ymm2/v256, imm8
- /// Permute Double-Precision Floating-Point values in the first source operand
- /// using two, 1-bit control fields in the low 2 bits of the 8-bit immediate
- /// and store results in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_permute_pd(v256 a, int imm8)
- {
- return new v256(permute_pd(a.Lo128, imm8 & 3), permute_pd(a.Hi128, imm8 >> 2));
- }
-
- /// <summary>
- /// Shuffle double-precision (64-bit) floating-point elements in a using the control in imm8, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERMILPD xmm1, xmm2/v128, imm8
- /// Permute Double-Precision Floating-Point values in the first source operand
- /// using two, 1-bit control fields in the low 2 bits of the 8-bit immediate
- /// and store results in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 permute_pd(v128 a, int imm8)
- {
- v128 dst = default;
- double* dptr = &dst.Double0;
- double* aptr = &a.Double0;
- dptr[0] = aptr[imm8 & 1];
- dptr[1] = aptr[(imm8 >> 1) & 1];
- return dst;
- }
-
- private static v128 Select4(v256 src1, v256 src2, int control)
- {
- switch (control & 3)
- {
- case 0: return src1.Lo128;
- case 1: return src1.Hi128;
- case 2: return src2.Lo128;
- default: return src2.Hi128;
- }
- }
-
- /// <summary>
- /// Shuffle 128-bits (composed of 4 packed single-precision (32-bit) floating-point elements) selected by imm8 from a and b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERM2F128 ymm1, ymm2, ymm3/v256, imm8
- /// Permute 128 bit floating-point-containing fields from the first source
- /// operand and second source operand using bits in the 8-bit immediate and
- /// store results in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_permute2f128_ps(v256 a, v256 b, int imm8)
- {
- return new v256(Select4(a, b, imm8), Select4(a, b, imm8 >> 4));
- }
-
- /// <summary>
- /// Shuffle 128-bits (composed of 2 packed double-precision (64-bit) floating-point elements) selected by imm8 from a and b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERM2F128 ymm1, ymm2, ymm3/v256, imm8
- /// Permute 128 bit floating-point-containing fields from the first source
- /// operand and second source operand using bits in the 8-bit immediate and
- /// store results in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_permute2f128_pd(v256 a, v256 b, int imm8)
- {
- return mm256_permute2f128_ps(a, b, imm8);
- }
-
-
- /// <summary>
- /// Shuffle 128-bits (composed of integer data) selected by imm8 from a and b, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VPERM2F128 ymm1, ymm2, ymm3/v256, imm8
- /// Permute 128 bit floating-point-containing fields from the first source
- /// operand and second source operand using bits in the 8-bit immediate and
- /// store results in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_permute2f128_si256(v256 a, v256 b, int imm8)
- {
- return mm256_permute2f128_ps(a, b, imm8);
- }
-
- /// <summary>
- /// Broadcast a single-precision (32-bit) floating-point element from memory to all elements of dst.
- /// </summary>
- /// <remarks>
- /// **** VBROADCASTSS ymm1, m32
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_broadcast_ss(void* ptr)
- {
- return new v256(*(uint*)ptr);
- }
-
- /// <summary>
- /// Broadcast a single-precision (32-bit) floating-point element from memory to all elements of dst.
- /// </summary>
- /// <remarks>
- /// **** VBROADCASTSS xmm1, m32
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 broadcast_ss(void* ptr)
- {
- return new v128(*(uint*)ptr);
- }
-
- /// <summary>
- /// Broadcast a double-precision (64-bit) floating-point element from memory to all elements of dst.
- /// </summary>
- /// <remarks>
- /// **** VBROADCASTSD ymm1, m64
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_broadcast_sd(void* ptr)
- {
- return new v256(*(double*)ptr);
- }
-
- /// <summary>
- /// Broadcast 128 bits from memory (composed of 4 packed single-precision (32-bit) floating-point elements) to all elements of dst.
- /// </summary>
- /// <remarks>
- /// **** VBROADCASTF128 ymm1, v128
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_broadcast_ps(void* ptr)
- {
- v128 a = Sse.loadu_ps(ptr);
- return new v256(a, a);
- }
-
- /// <summary>
- /// Broadcast 128 bits from memory (composed of 2 packed double-precision (64-bit) floating-point elements) to all elements of dst.
- /// </summary>
- /// <param name="ptr">Pointer</param>
- /// <returns>
- /// **** VBROADCASTF128 ymm1, v128
- /// </returns>
- [DebuggerStepThrough]
- public static v256 mm256_broadcast_pd(void* ptr)
- {
- return mm256_broadcast_ps(ptr);
- }
-
- /// <summary>
- /// Copy a to dst, then insert 128 bits (composed of 4 packed single-precision (32-bit) floating-point elements) from b into dst at the location specified by imm8.
- /// </summary>
- /// <remarks>
- /// **** VINSERTF128 ymm1, ymm2, xmm3/v128, imm8
- /// Performs an insertion of 128-bits of packed floating-point values from the
- /// second source operand into an the destination at an 128-bit offset from
- /// imm8[0]. The remaining portions of the destination are written by the
- /// corresponding fields of the first source operand
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_insertf128_ps(v256 a, v128 b, int imm8)
- {
- if (0 == (imm8 & 1))
- return new v256(b, a.Hi128);
- else
- return new v256(a.Lo128, b);
- }
-
- /// <summary>
- /// Copy a to dst, then insert 128 bits (composed of 2 packed double-precision (64-bit) floating-point elements) from b into dst at the location specified by imm8.
- /// </summary>
- /// <remarks>
- /// **** VINSERTF128 ymm1, ymm2, xmm3/v128, imm8
- /// Performs an insertion of 128-bits of packed floating-point values from the
- /// second source operand into an the destination at an 128-bit offset from
- /// imm8[0]. The remaining portions of the destination are written by the
- /// corresponding fields of the first source operand
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_insertf128_pd(v256 a, v128 b, int imm8)
- {
- return mm256_insertf128_ps(a, b, imm8);
- }
-
- /// <summary>
- /// Copy a to dst, then insert 128 bits of integer data from b into dst at the location specified by imm8.
- /// </summary>
- /// <remarks>
- /// **** VINSERTF128 ymm1, ymm2, xmm3/v128, imm8
- /// Performs an insertion of 128-bits of packed floating-point values from the
- /// second source operand into an the destination at an 128-bit offset from
- /// imm8[0]. The remaining portions of the destination are written by the
- /// corresponding fields of the first source operand
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">imm8</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_insertf128_si256(v256 a, v128 b, int imm8)
- {
- return mm256_insertf128_ps(a, b, imm8);
- }
-
- /// <summary>
- /// Load 256-bits (composed of 8 packed single-precision (32-bit) floating-point elements) from memory
- /// </summary>
- /// <remarks>
- /// **** VMOVUPS ymm1, v256
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_load_ps(void* ptr)
- {
- return *(v256*)ptr;
- }
-
- /// <summary>
- /// Store 256-bits (composed of 8 packed single-precision (32-bit) floating-point elements) from a into memory
- /// </summary>
- /// <remarks>
- /// **** VMOVUPS v256, ymm1
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <param name="val">Value</param>
- [DebuggerStepThrough]
- public static void mm256_store_ps(void* ptr, v256 val)
- {
- *(v256*)ptr = val;
- }
-
- /// <summary>
- /// Load 256-bits (composed of 8 packed single-precision (32-bit) floating-point elements) from memory
- /// </summary>
- /// <remarks>
- /// **** VMOVUPS ymm1, v256
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_load_pd(void* ptr)
- {
- return mm256_load_ps(ptr);
- }
-
- /// <summary>
- /// Store 256-bits (composed of 4 packed double-precision (64-bit) floating-point elements) from a into memory
- /// </summary>
- /// <remarks>
- /// **** VMOVUPS v256, ymm1
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void mm256_store_pd(void* ptr, v256 a)
- {
- mm256_store_ps(ptr, a);
- }
-
- /// <summary>
- /// Load 256-bits (composed of 4 packed double-precision (64-bit) floating-point elements) from memory
- /// </summary>
- /// <remarks>
- /// **** VMOVUPS ymm1, v256
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_loadu_pd(void* ptr)
- {
- return mm256_load_ps(ptr);
- }
-
- /// <summary>
- /// Store 256-bits (composed of 4 packed double-precision (64-bit) floating-point elements) from a into memory
- /// </summary>
- /// <remarks>
- /// **** VMOVUPS v256, ymm1
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void mm256_storeu_pd(void* ptr, v256 a)
- {
- mm256_store_ps(ptr, a);
- }
-
- /// <summary>
- /// Load 256-bits (composed of 8 packed single-precision (32-bit) floating-point elements) from memory
- /// </summary>
- /// <remarks>
- /// **** VMOVUPS ymm1, v256
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_loadu_ps(void* ptr)
- {
- return mm256_load_ps(ptr);
- }
-
- /// <summary>
- /// Store 256-bits (composed of 8 packed single-precision (32-bit) floating-point elements) from a into memory
- /// </summary>
- /// <remarks>
- /// **** VMOVUPS v256, ymm1
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void mm256_storeu_ps(void* ptr, v256 a)
- {
- mm256_store_ps(ptr, a);
- }
-
- /// <summary>
- /// Load 256-bits (composed of 8 packed 32-bit integers elements) from memory
- /// </summary>
- /// <remarks>
- /// **** VMOVDQU ymm1, v256
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_load_si256(void* ptr)
- {
- return mm256_load_ps(ptr);
- }
-
- /// <summary>
- /// Store 256-bits (composed of 8 packed 32-bit integer elements) from a into memory
- /// </summary>
- /// <remarks>
- /// **** VMOVDQU v256, ymm1
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <param name="v">Vector</param>
- [DebuggerStepThrough]
- public static void mm256_store_si256(void* ptr, v256 v)
- {
- mm256_store_ps(ptr, v);
- }
-
- /// <summary>
- /// Load 256-bits (composed of 8 packed 32-bit integers elements) from memory
- /// </summary>
- /// <remarks>
- /// **** VMOVDQU ymm1, v256
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_loadu_si256(void* ptr)
- {
- return mm256_load_ps(ptr);
- }
-
- /// <summary>
- /// Store 256-bits (composed of 8 packed 32-bit integer elements) from a into memory
- /// </summary>
- /// <remarks>
- /// **** VMOVDQU v256, ymm1
- /// Burst only generates unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <param name="v">Vector</param>
- [DebuggerStepThrough]
- public static void mm256_storeu_si256(void* ptr, v256 v)
- {
- mm256_store_ps(ptr, v);
- }
-
- /// <summary>
- /// Load two 128-bit values (composed of 4 packed single-precision
- /// (32-bit) floating-point elements) from memory, and combine them
- /// into a 256-bit value in dst. hiaddr and loaddr do not need to
- /// be aligned on any particular boundary.
- /// </summary>
- /// <remarks>
- /// This is a composite function which can generate more than one instruction.
- /// </remarks>
- /// <param name="hiaddr">High address pointer</param>
- /// <param name="loaddr">Low address pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_loadu2_m128(void* hiaddr, void* loaddr)
- {
- return mm256_set_m128(Sse.loadu_ps(hiaddr), Sse.loadu_ps(loaddr));
- }
-
- /// <summary>
- /// Load two 128-bit values (composed of 2 packed double-precision
- /// (64-bit) floating-point elements) from memory, and combine them
- /// into a 256-bit value in dst. hiaddr and loaddr do not need to
- /// be aligned on any particular boundary.
- /// </summary>
- /// <remarks>
- /// This is a composite function which can generate more than one instruction.
- /// </remarks>
- /// <param name="hiaddr">High address pointer</param>
- /// <param name="loaddr">Low address pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_loadu2_m128d(void* hiaddr, void* loaddr)
- {
- return mm256_loadu2_m128(hiaddr, loaddr);
- }
-
- /// <summary>
- /// Load two 128-bit values (composed of integer data) from memory,
- /// and combine them into a 256-bit value in dst. hiaddr and loaddr
- /// do not need to be aligned on any particular boundary.
- /// </summary>
- /// <remarks>
- /// This is a composite function which can generate more than one instruction.
- /// </remarks>
- /// <param name="hiaddr">High address pointer</param>
- /// <param name="loaddr">Low address pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_loadu2_m128i(void* hiaddr, void* loaddr)
- {
- return mm256_loadu2_m128(hiaddr, loaddr);
- }
-
- /// <summary>
- /// Set packed __m256 vector dst with the supplied values.
- /// </summary>
- /// <remarks>
- /// This is a composite function which can generate more than one instruction.
- /// </remarks>
- /// <param name="hi">High half of the vector</param>
- /// <param name="lo">Low half of the vector</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set_m128(v128 hi, v128 lo)
- {
- return new v256(lo, hi);
- }
-
- /// <summary>
- /// Store the high and low 128-bit halves (each composed of 4
- /// packed single-precision (32-bit) floating-point elements) from
- /// a into memory two different 128-bit locations. hiaddr and
- /// loaddr do not need to be aligned on any particular boundary.
- /// </summary>
- /// <remarks>
- /// This is a composite function which can generate more than one instruction.
- /// </remarks>
- /// <param name="hiaddr">High address pointer</param>
- /// <param name="loaddr">Low address pointer</param>
- /// <param name="val">Value</param>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static void mm256_storeu2_m128(void* hiaddr, void* loaddr, v256 val)
- {
- Sse.storeu_ps(hiaddr, val.Hi128);
- Sse.storeu_ps(loaddr, val.Lo128);
- }
-
- /// <summary>
- /// Store the high and low 128-bit halves (each composed of 2
- /// packed double-precision (64-bit) floating-point elements) from
- /// a into memory two different 128-bit locations. hiaddr and
- /// loaddr do not need to be aligned on any particular boundary.
- /// </summary>
- /// <remarks>
- /// This is a composite function which can generate more than one instruction.
- /// </remarks>
- /// <param name="hiaddr">High address pointer</param>
- /// <param name="loaddr">Low address pointer</param>
- /// <param name="val">Value</param>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static void mm256_storeu2_m128d(void* hiaddr, void* loaddr, v256 val)
- {
- Sse.storeu_ps(hiaddr, val.Hi128);
- Sse.storeu_ps(loaddr, val.Lo128);
- }
-
- /// <summary>
- /// Store the high and low 128-bit halves (each composed of integer
- /// data) from a into memory two different 128-bit locations. hiaddr
- /// and loaddr do not need to be aligned on any particular boundary.
- /// </summary>
- /// <remarks>
- /// This is a composite function which can generate more than one instruction.
- /// </remarks>
- /// <param name="hiaddr">High address pointer</param>
- /// <param name="loaddr">Low address pointer</param>
- /// <param name="val">Value</param>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static void mm256_storeu2_m128i(void* hiaddr, void* loaddr, v256 val)
- {
- Sse.storeu_ps(hiaddr, val.Hi128);
- Sse.storeu_ps(loaddr, val.Lo128);
- }
-
- /// <summary>
- /// Load packed double-precision (64-bit) floating-point elements
- /// from memory into dst using mask (elements are zeroed out when
- /// the high bit of the corresponding element is not set).
- /// </summary>
- /// <remarks>
- /// **** VMASKMOVPD xmm1, xmm2, v128
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="mask">Mask</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 maskload_pd(void* mem_addr, v128 mask)
- {
- ulong* addr = (ulong*)mem_addr;
- v128 result = default;
- if (mask.SLong0 < 0) result.ULong0 = addr[0];
- if (mask.SLong1 < 0) result.ULong1 = addr[1];
- return result;
- }
-
- /// <summary>
- /// Load packed double-precision (64-bit) floating-point elements
- /// from memory into dst using mask (elements are zeroed out when
- /// the high bit of the corresponding element is not set).
- /// </summary>
- /// <remarks>
- /// **** VMASKMOVPD ymm1, ymm2, v256
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="mask">Mask</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_maskload_pd(void* mem_addr, v256 mask)
- {
- return new v256(maskload_pd(mem_addr, mask.Lo128), maskload_pd(((byte*)mem_addr) + 16, mask.Hi128));
- }
-
- /// <summary>
- /// Store packed double-precision (64-bit) floating-point elements from a into memory using mask.
- /// </summary>
- /// <remarks>
- /// **** VMASKMOVPD v128, xmm1, xmm2
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="mask">Mask</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void maskstore_pd(void* mem_addr, v128 mask, v128 a)
- {
- ulong* addr = (ulong*)mem_addr;
- if (mask.SLong0 < 0) addr[0] = a.ULong0;
- if (mask.SLong1 < 0) addr[1] = a.ULong1;
- }
-
- /// <summary>
- /// Store packed double-precision (64-bit) floating-point elements from a into memory using mask.
- /// </summary>
- /// <remarks>
- /// **** VMASKMOVPD v256, ymm1, ymm2
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="mask">Mask</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void mm256_maskstore_pd(void* mem_addr, v256 mask, v256 a)
- {
- maskstore_pd(mem_addr, mask.Lo128, a.Lo128);
- maskstore_pd(((byte*)mem_addr) + 16, mask.Hi128, a.Hi128);
- }
-
- /// <summary>
- /// Load packed single-precision (32-bit) floating-point elements
- /// from memory into dst using mask (elements are zeroed out when
- /// the high bit of the corresponding element is not set).
- /// </summary>
- /// <remarks>
- /// **** VMASKMOVPS xmm1, xmm2, v128
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="mask">Mask</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 maskload_ps(void* mem_addr, v128 mask)
- {
- uint* addr = (uint*)mem_addr;
- v128 result = default;
- if (mask.SInt0 < 0) result.UInt0 = addr[0];
- if (mask.SInt1 < 0) result.UInt1 = addr[1];
- if (mask.SInt2 < 0) result.UInt2 = addr[2];
- if (mask.SInt3 < 0) result.UInt3 = addr[3];
- return result;
- }
-
- /// <summary>
- /// Load packed single-precision (32-bit) floating-point elements
- /// from memory into dst using mask (elements are zeroed out when
- /// the high bit of the corresponding element is not set).
- /// </summary>
- /// <remarks>
- /// **** VMASKMOVPS ymm1, ymm2, v256
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="mask">Mask</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_maskload_ps(void* mem_addr, v256 mask)
- {
- return new v256(maskload_ps(mem_addr, mask.Lo128), maskload_ps(((byte*)mem_addr) + 16, mask.Hi128));
- }
-
- /// <summary>
- /// Store packed single-precision (32-bit) floating-point elements from a into memory using mask.
- /// </summary>
- /// <remarks>
- /// **** VMASKMOVPS v128, xmm1, xmm2
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="mask">Mask</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void maskstore_ps(void* mem_addr, v128 mask, v128 a)
- {
- uint* addr = (uint*)mem_addr;
- if (mask.SInt0 < 0) addr[0] = a.UInt0;
- if (mask.SInt1 < 0) addr[1] = a.UInt1;
- if (mask.SInt2 < 0) addr[2] = a.UInt2;
- if (mask.SInt3 < 0) addr[3] = a.UInt3;
- }
-
- /// <summary>
- /// Store packed single-precision (32-bit) floating-point elements from a into memory using mask.
- /// </summary>
- /// <remarks>
- /// **** VMASKMOVPS v256, ymm1, ymm2
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="mask">Mask</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void mm256_maskstore_ps(void* mem_addr, v256 mask, v256 a)
- {
- maskstore_ps(mem_addr, mask.Lo128, a.Lo128);
- maskstore_ps(((byte*)mem_addr) + 16, mask.Hi128, a.Hi128);
- }
-
- /*
- * Replicate Single-Precision Floating-Point Values
- * Duplicates odd-indexed single-precision floating-point values from the
- * source operand
- */
- /// <summary>
- /// Duplicate odd-indexed single-precision (32-bit) floating-point elements from a, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VMOVSHDUP ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_movehdup_ps(v256 a)
- {
- return new v256(a.UInt1, a.UInt1, a.UInt3, a.UInt3, a.UInt5, a.UInt5, a.UInt7, a.UInt7);
- }
-
- /// <summary>
- /// Duplicate even-indexed single-precision (32-bit) floating-point elements from a, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VMOVSLDUP ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_moveldup_ps(v256 a)
- {
- return new v256(a.UInt0, a.UInt0, a.UInt2, a.UInt2, a.UInt4, a.UInt4, a.UInt6, a.UInt6);
- }
-
-
- /// <summary>
- /// Duplicate even-indexed double-precision (64-bit) floating-point elements from a, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VMOVDDUP ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_movedup_pd(v256 a)
- {
- return new v256(a.Double0, a.Double0, a.Double2, a.Double2);
- }
-
- /// <summary>
- /// Load 256-bits of integer data from unaligned memory into dst.
- /// This intrinsic may perform better than mm256_loadu_si256 when
- /// the data crosses a cache line boundary.
- /// </summary>
- /// <remarks>
- /// **** VLDDQU ymm1, v256
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_lddqu_si256(void* mem_addr)
- {
- return *(v256*)mem_addr;
- }
-
- /*
- * Store Packed Integers Using Non-Temporal Hint
- * **** VMOVNTDQ v256, ymm1
- * Moves the packed integers in the source operand to the destination using a
- * non-temporal hint to prevent caching of the data during the write to memory
- */
- /// <summary>
- /// Store 256-bits of integer data from a into memory using a
- /// non-temporal memory hint. mem_addr must be aligned on a 32-byte
- /// boundary or a general-protection exception may be generated.
- /// </summary>
- /// <remarks>
- /// **** VMOVNTDQ v256, ymm1
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void mm256_stream_si256(void* mem_addr, v256 a)
- {
- *(v256*)mem_addr = a;
- }
-
-
- /// <summary>
- /// Store 256-bits (composed of 4 packed double-precision (64-bit)
- /// floating-point elements) from a into memory using a
- /// non-temporal memory hint. mem_addr must be aligned on a 32-byte
- /// boundary or a general-protection exception may be generated.
- /// </summary>
- /// <remarks>
- /// **** VMOVNTPD v256, ymm1
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void mm256_stream_pd(void* mem_addr, v256 a)
- {
- *(v256*)mem_addr = a;
- }
-
- /// <summary>
- /// Store 256-bits (composed of 8 packed single-precision (32-bit)
- /// floating-point elements) from a into memory using a
- /// non-temporal memory hint. mem_addr must be aligned on a 32-byte
- /// boundary or a general-protection exception may be generated.
- /// </summary>
- /// <remarks>
- /// **** VMOVNTPS v256, ymm1
- /// </remarks>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void mm256_stream_ps(void* mem_addr, v256 a)
- {
- *(v256*)mem_addr = a;
- }
-
- /// <summary>
- /// Compute the approximate reciprocal of packed single-precision
- /// (32-bit) floating-point elements in a, and store the results in
- /// dst. The maximum relative error for this approximation is less
- /// than 1.5*2^-12.
- /// </summary>
- /// <remarks>
- /// **** VRCPPS ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_rcp_ps(v256 a)
- {
- return new v256(Sse.rcp_ps(a.Lo128), Sse.rcp_ps(a.Hi128));
- }
-
- /// <summary>
- /// Compute the approximate reciprocal square root of packed
- /// single-precision (32-bit) floating-point elements in a, and
- /// store the results in dst. The maximum relative error for this
- /// approximation is less than 1.5*2^-12.
- /// </summary>
- /// <remarks>
- /// **** VRSQRTPS ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_rsqrt_ps(v256 a)
- {
- return new v256(Sse.rsqrt_ps(a.Lo128), Sse.rsqrt_ps(a.Hi128));
- }
-
- /// <summary>
- /// Compute the square root of packed double-precision (64-bit)
- /// floating-point elements in a, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VSQRTPD ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_sqrt_pd(v256 a)
- {
- return new v256(Sse2.sqrt_pd(a.Lo128), Sse2.sqrt_pd(a.Hi128));
- }
-
- /// <summary>
- /// Compute the square root of packed single-precision (32-bit)
- /// floating-point elements in a, and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VSQRTPS ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_sqrt_ps(v256 a)
- {
- return new v256(Sse.sqrt_ps(a.Lo128), Sse.sqrt_ps(a.Hi128));
- }
-
- /// <summary>
- /// Round the packed double-precision (64-bit) floating-point
- /// elements in a using the rounding parameter, and store the
- /// results as packed double-precision floating-point elements in
- /// dst.
- /// </summary>
- /// <remarks>
- ///**** VROUNDPD ymm1,ymm2/v256,imm8
- /// Rounding is done according to the rounding parameter, which can be one of:
- /// (_MM_FROUND_TO_NEAREST_INT |_MM_FROUND_NO_EXC) // round to nearest, and suppress exceptions
- /// (_MM_FROUND_TO_NEG_INF |_MM_FROUND_NO_EXC) // round down, and suppress exceptions
- /// (_MM_FROUND_TO_POS_INF |_MM_FROUND_NO_EXC) // round up, and suppress exceptions
- /// (_MM_FROUND_TO_ZERO |_MM_FROUND_NO_EXC) // truncate, and suppress exceptions
- /// _MM_FROUND_CUR_DIRECTION // use MXCSR.RC; see _MM_SET_ROUNDING_MODE
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="rounding">Rounding mode</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_round_pd(v256 a, int rounding)
- {
- return new v256(Sse4_1.round_pd(a.Lo128, rounding), Sse4_1.round_pd(a.Hi128, rounding));
- }
-
-
- /// <summary>
- /// Round the packed double-precision (64-bit) floating-point
- /// elements in a up to an integer value, and store the results as
- /// packed double-precision floating-point elements in dst.
- /// </summary>
- /// <param name="val">Value</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_ceil_pd(v256 val)
- {
- return mm256_round_pd(val, (int)RoundingMode.FROUND_CEIL);
- }
-
- /// <summary>
- /// Round the packed double-precision (64-bit) floating-point
- /// elements in a down to an integer value, and store the results
- /// as packed double-precision floating-point elements in dst.
- /// </summary>
- /// <param name="val">Value</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_floor_pd(v256 val)
- {
- return mm256_round_pd(val, (int)RoundingMode.FROUND_FLOOR);
- }
-
- /// <summary>
- /// Round the packed single-precision (32-bit) floating-point
- /// elements in a using the rounding parameter, and store the
- /// results as packed single-precision floating-point elements in
- /// dst.
- /// </summary>
- /// <remarks>
- /// **** VROUNDPS ymm1,ymm2/v256,imm8
- /// Round the four single-precision floating-point values values in the source
- /// operand by the rounding mode specified in the immediate operand and place
- /// the result in the destination. The rounding process rounds the input to an
- /// integral value and returns the result as a double-precision floating-point
- /// value. The Precision Floating Point Exception is signaled according to the
- /// immediate operand. If any source operand is an SNaN then it will be
- /// converted to a QNaN.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="rounding">Rounding mode</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_round_ps(v256 a, int rounding)
- {
- return new v256(Sse4_1.round_ps(a.Lo128, rounding), Sse4_1.round_ps(a.Hi128, rounding));
- }
-
- /// <summary>
- /// Round the packed single-precision (32-bit) floating-point
- /// elements in a up to an integer value, and store the results as
- /// packed single-precision floating-point elements in dst.
- /// </summary>
- /// <param name="val">Value</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_ceil_ps(v256 val)
- {
- return mm256_round_ps(val, (int)RoundingMode.FROUND_CEIL);
- }
-
- /// <summary>
- /// Round the packed single-precision (32-bit) floating-point
- /// elements in a down to an integer value, and store the results
- /// as packed single-precision floating-point elements in dst.
- /// </summary>
- /// <param name="val">Value</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_floor_ps(v256 val)
- {
- return mm256_round_ps(val, (int)RoundingMode.FROUND_FLOOR);
- }
-
- /// <summary>
- /// Unpack and interleave double-precision (64-bit) floating-point
- /// elements from the high half of each 128-bit lane in a and b,
- /// and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VUNPCKHPD ymm1,ymm2,ymm3/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_unpackhi_pd(v256 a, v256 b)
- {
- return new v256(Sse2.unpackhi_pd(a.Lo128, b.Lo128), Sse2.unpackhi_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Unpack and interleave double-precision (64-bit) floating-point
- /// elements from the low half of each 128-bit lane in a and b, and
- /// store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VUNPCKLPD ymm1,ymm2,ymm3/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_unpacklo_pd(v256 a, v256 b)
- {
- return new v256(Sse2.unpacklo_pd(a.Lo128, b.Lo128), Sse2.unpacklo_pd(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Unpack and interleave single-precision(32-bit) floating-point
- /// elements from the high half of each 128-bit lane in a and b,
- /// and store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VUNPCKHPS ymm1,ymm2,ymm3/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_unpackhi_ps(v256 a, v256 b)
- {
- return new v256(Sse.unpackhi_ps(a.Lo128, b.Lo128), Sse.unpackhi_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Unpack and interleave single-precision (32-bit) floating-point
- /// elements from the low half of each 128-bit lane in a and b, and
- /// store the results in dst.
- /// </summary>
- /// <remarks>
- /// **** VUNPCKLPS ymm1,ymm2,ymm3/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_unpacklo_ps(v256 a, v256 b)
- {
- return new v256(Sse.unpacklo_ps(a.Lo128, b.Lo128), Sse.unpacklo_ps(a.Hi128, b.Hi128));
- }
-
- /// <summary>
- /// Compute the bitwise AND of 256 bits (representing integer data)
- /// in a and b, and set ZF to 1 if the result is zero, otherwise
- /// set ZF to 0. Compute the bitwise NOT of a and then AND with b,
- /// and set CF to 1 if the result is zero, otherwise set CF to 0.
- /// Return the ZF value.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>ZF value</returns>
- [DebuggerStepThrough]
- public static int mm256_testz_si256(v256 a, v256 b)
- {
- return Sse4_1.testz_si128(a.Lo128, b.Lo128) & Sse4_1.testz_si128(a.Hi128, b.Hi128);
- }
-
- /// <summary>
- /// Compute the bitwise AND of 256 bits (representing integer data)
- /// in a and b, and set ZF to 1 if the result is zero, otherwise
- /// set ZF to 0. Compute the bitwise NOT of a and then AND with b,
- /// and set CF to 1 if the result is zero, otherwise set CF to 0.
- /// Return the CF value.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>CF value</returns>
- [DebuggerStepThrough]
- public static int mm256_testc_si256(v256 a, v256 b)
- {
- return Sse4_1.testc_si128(a.Lo128, b.Lo128) & Sse4_1.testc_si128(a.Hi128, b.Hi128);
- }
-
- /// <summary>
- /// Compute the bitwise AND of 256 bits (representing integer data)
- /// in a and b, and set ZF to 1 if the result is zero, otherwise
- /// set ZF to 0. Compute the bitwise NOT of a and then AND with b,
- /// and set CF to 1 if the result is zero, otherwise set CF to 0.
- /// Return 1 if both the ZF and CF values are zero, otherwise
- /// return 0.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Integer</returns>
- [DebuggerStepThrough]
- public static int mm256_testnzc_si256(v256 a, v256 b)
- {
- int zf = mm256_testz_si256(a, b);
- int cf = mm256_testc_si256(a, b);
- return 1 - (zf | cf);
- }
-
- /// <summary>
- /// Compute the bitwise AND of 256 bits (representing
- /// double-precision (64-bit) floating-point elements) in a and b,
- /// producing an intermediate 256-bit value, and set ZF to 1 if the
- /// sign bit of each 64-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 64-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return the ZF value.
- /// </summary>
- /// <remarks>
- /// **** VTESTPD ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>ZF value</returns>
- [DebuggerStepThrough]
- public static int mm256_testz_pd(v256 a, v256 b)
- {
- ulong* aptr = &a.ULong0;
- ulong* bptr = &b.ULong0;
- for (int i = 0; i < 4; ++i)
- {
- if (((aptr[i] & bptr[i]) & 0x8000_0000_0000_0000) != 0)
- return 0;
- }
- return 1;
- }
-
- /// <summary>
- /// Compute the bitwise AND of 256 bits (representing
- /// double-precision (64-bit) floating-point elements) in a and b,
- /// producing an intermediate 256-bit value, and set ZF to 1 if the
- /// sign bit of each 64-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 64-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return the CF value.
- /// </summary>
- /// <remarks>
- /// **** VTESTPD ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>CF value</returns>
- [DebuggerStepThrough]
- public static int mm256_testc_pd(v256 a, v256 b)
- {
- ulong* aptr = &a.ULong0;
- ulong* bptr = &b.ULong0;
- for (int i = 0; i < 4; ++i)
- {
- if ((((~aptr[i]) & bptr[i]) & 0x8000_0000_0000_0000) != 0)
- return 0;
- }
- return 1;
- }
-
- /// <summary>
- /// Compute the bitwise AND of 256 bits (representing
- /// double-precision (64-bit) floating-point elements) in a and b,
- /// producing an intermediate 256-bit value, and set ZF to 1 if the
- /// sign bit of each 64-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 64-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return 1 if both the ZF
- /// and CF values are zero, otherwise return 0.
- /// </summary>
- /// <remarks>
- /// **** VTESTPD ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Integer</returns>
- [DebuggerStepThrough]
- public static int mm256_testnzc_pd(v256 a, v256 b)
- {
- return 1 - (mm256_testz_pd(a, b) | mm256_testc_pd(a, b));
- }
-
- /// <summary>
- /// Compute the bitwise AND of 128 bits (representing
- /// double-precision (64-bit) floating-point elements) in a and b,
- /// producing an intermediate 128-bit value, and set ZF to 1 if the
- /// sign bit of each 64-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 64-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return the ZF value.
- /// </summary>
- /// <remarks>
- /// **** VTESTPD xmm1, xmm2/v128
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>ZF value</returns>
- [DebuggerStepThrough]
- public static int testz_pd(v128 a, v128 b)
- {
- ulong* aptr = &a.ULong0;
- ulong* bptr = &b.ULong0;
- for (int i = 0; i < 2; ++i)
- {
- if (((aptr[i] & bptr[i]) & 0x8000_0000_0000_0000) != 0)
- return 0;
- }
- return 1;
- }
-
- /// <summary>
- /// Compute the bitwise AND of 128 bits (representing
- /// double-precision (64-bit) floating-point elements) in a and b,
- /// producing an intermediate 128-bit value, and set ZF to 1 if the
- /// sign bit of each 64-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 64-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return the CF value.
- /// </summary>
- /// <remarks>
- /// **** VTESTPD xmm1, xmm2/v128
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>CF value</returns>
- [DebuggerStepThrough]
- public static int testc_pd(v128 a, v128 b)
- {
- ulong* aptr = &a.ULong0;
- ulong* bptr = &b.ULong0;
- for (int i = 0; i < 2; ++i)
- {
- if ((((~aptr[i]) & bptr[i]) & 0x8000_0000_0000_0000) != 0)
- return 0;
- }
- return 1;
- }
-
- /// <summary>
- /// Compute the bitwise AND of 128 bits (representing
- /// double-precision (64-bit) floating-point elements) in a and b,
- /// producing an intermediate 128-bit value, and set ZF to 1 if the
- /// sign bit of each 64-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 64-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return 1 if both the ZF
- /// and CF values are zero, otherwise return 0.
- /// </summary>
- /// <remarks>
- /// **** VTESTPD xmm1, xmm2/v128
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Integer</returns>
- [DebuggerStepThrough]
- public static int testnzc_pd(v128 a, v128 b)
- {
- return 1 - (testz_pd(a, b) | testc_pd(a, b));
- }
-
- /// <summary>
- /// Compute the bitwise AND of 256 bits (representing
- /// single-precision (32-bit) floating-point elements) in a and b,
- /// producing an intermediate 256-bit value, and set ZF to 1 if the
- /// sign bit of each 32-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 32-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return the ZF value.
- /// </summary>
- /// <remarks>
- /// **** VTESTPS ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>ZF value</returns>
- [DebuggerStepThrough]
- public static int mm256_testz_ps(v256 a, v256 b)
- {
- uint* aptr = &a.UInt0;
- uint* bptr = &b.UInt0;
- for (int i = 0; i < 8; ++i)
- {
- if (((aptr[i] & bptr[i]) & 0x8000_0000) != 0)
- return 0;
- }
- return 1;
-
- }
-
- /// <summary>
- /// Compute the bitwise AND of 256 bits (representing
- /// single-precision (32-bit) floating-point elements) in a and b,
- /// producing an intermediate 256-bit value, and set ZF to 1 if the
- /// sign bit of each 32-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 32-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return the CF value.
- /// </summary>
- /// <remarks>
- /// **** VTESTPS ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>CF value</returns>
- [DebuggerStepThrough]
- public static int mm256_testc_ps(v256 a, v256 b)
- {
- uint* aptr = &a.UInt0;
- uint* bptr = &b.UInt0;
- for (int i = 0; i < 8; ++i)
- {
- if ((((~aptr[i]) & bptr[i]) & 0x8000_0000) != 0)
- return 0;
- }
- return 1;
- }
-
- /// <summary>
- /// Compute the bitwise AND of 256 bits (representing
- /// single-precision (32-bit) floating-point elements) in a and b,
- /// producing an intermediate 256-bit value, and set ZF to 1 if the
- /// sign bit of each 32-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 32-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return 1 if both the ZF
- /// and CF values are zero, otherwise return 0.
- /// </summary>
- /// <remarks>
- /// **** VTESTPS ymm1, ymm2/v256
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Integer</returns>
- [DebuggerStepThrough]
- public static int mm256_testnzc_ps(v256 a, v256 b)
- {
- return 1 - (mm256_testz_ps(a, b) | mm256_testc_ps(a, b));
- }
-
- /// <summary>
- /// Compute the bitwise AND of 128 bits (representing
- /// single-precision (32-bit) floating-point elements) in a and b,
- /// producing an intermediate 128-bit value, and set ZF to 1 if the
- /// sign bit of each 32-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 32-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return the ZF value.
- /// </summary>
- /// <remarks>
- /// **** VTESTPS xmm1, xmm2/v128
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>ZF value</returns>
- [DebuggerStepThrough]
- public static int testz_ps(v128 a, v128 b)
- {
- uint* aptr = &a.UInt0;
- uint* bptr = &b.UInt0;
- for (int i = 0; i < 4; ++i)
- {
- if (((aptr[i] & bptr[i]) & 0x8000_0000) != 0)
- return 0;
- }
- return 1;
-
- }
-
- /// <summary>
- /// Compute the bitwise AND of 128 bits (representing
- /// single-precision (32-bit) floating-point elements) in a and b,
- /// producing an intermediate 128-bit value, and set ZF to 1 if the
- /// sign bit of each 32-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 32-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return the CF value.
- /// </summary>
- /// <remarks>
- /// **** VTESTPS xmm1, xmm2/v128
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>CF value</returns>
- [DebuggerStepThrough]
- public static int testc_ps(v128 a, v128 b)
- {
- uint* aptr = &a.UInt0;
- uint* bptr = &b.UInt0;
- for (int i = 0; i < 4; ++i)
- {
- if ((((~aptr[i]) & bptr[i]) & 0x8000_0000) != 0)
- return 0;
- }
- return 1;
- }
-
- /// <summary>
- /// Compute the bitwise AND of 128 bits (representing
- /// single-precision (32-bit) floating-point elements) in a and b,
- /// producing an intermediate 128-bit value, and set ZF to 1 if the
- /// sign bit of each 32-bit element in the intermediate value is
- /// zero, otherwise set ZF to 0. Compute the bitwise NOT of a and
- /// then AND with b, producing an intermediate value, and set CF to
- /// 1 if the sign bit of each 32-bit element in the intermediate
- /// value is zero, otherwise set CF to 0. Return 1 if both the ZF
- /// and CF values are zero, otherwise return 0.
- /// </summary>
- /// <remarks>
- /// **** VTESTPS xmm1, xmm2/v128
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Integer</returns>
- [DebuggerStepThrough]
- public static int testnzc_ps(v128 a, v128 b)
- {
- return 1 - (testz_ps(a, b) | testc_ps(a, b));
- }
-
- /// <summary>
- /// Set each bit of mask dst based on the most significant bit of the corresponding packed double-precision (64-bit) floating-point element in a.
- /// </summary>
- /// <remarks>
- /// **** VMOVMSKPD r32, ymm2
- /// Extracts the sign bits from the packed double-precision floating-point
- /// values in the source operand, formats them into a 4-bit mask, and stores
- /// the mask in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Integer</returns>
- [DebuggerStepThrough]
- public static int mm256_movemask_pd(v256 a)
- {
- return Sse2.movemask_pd(a.Lo128) | (Sse2.movemask_pd(a.Hi128) << 2);
- }
-
-
- /// <summary>
- /// Set each bit of mask dst based on the most significant bit of the corresponding packed single-precision (32-bit) floating-point element in a.
- /// </summary>
- /// <remarks>
- /// **** VMOVMSKPS r32, ymm2
- /// Extracts the sign bits from the packed single-precision floating-point
- /// values in the source operand, formats them into a 8-bit mask, and stores
- /// the mask in the destination
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <returns>Integer</returns>
- [DebuggerStepThrough]
- public static int mm256_movemask_ps(v256 a)
- {
- return Sse.movemask_ps(a.Lo128) | (Sse.movemask_ps(a.Hi128) << 4);
- }
-
- // Normal IR is fine for this
-
- /// <summary>
- /// Return Vector with all elements set to zero.
- /// </summary>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setzero_pd() { return default; }
-
- /// <summary>
- /// Return Vector with all elements set to zero.
- /// </summary>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setzero_ps() { return default; }
-
- /// <summary>
- /// Return Vector with all elements set to zero.
- /// </summary>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setzero_si256() { return default; }
-
- /// <summary>
- /// Set packed double-precision (64-bit) floating-point elements in dst with the supplied values.
- /// </summary>
- /// <param name="d">Element d</param>
- /// <param name="c">Element c</param>
- /// <param name="b">Element b</param>
- /// <param name="a">Element a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set_pd(double d, double c, double b, double a)
- {
- return new v256(a, b, c, d);
- }
-
- /// <summary>
- /// Set packed single-precision (32-bit) floating-point elements in dst with the supplied values.
- /// </summary>
- /// <param name="e7">Element 7</param>
- /// <param name="e6">Element 6</param>
- /// <param name="e5">Element 5</param>
- /// <param name="e4">Element 4</param>
- /// <param name="e3">Element 3</param>
- /// <param name="e2">Element 2</param>
- /// <param name="e1">Element 1</param>
- /// <param name="e0">Element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set_ps(float e7, float e6, float e5, float e4, float e3, float e2, float e1, float e0)
- {
- return new v256(e0, e1, e2, e3, e4, e5, e6, e7);
- }
-
- /// <summary>
- /// Set packed byte elements in dst with the supplied values.
- /// </summary>
- /// <param name="e31_">Element 31</param>
- /// <param name="e30_">Element 30</param>
- /// <param name="e29_">Element 29</param>
- /// <param name="e28_">Element 28</param>
- /// <param name="e27_">Element 27</param>
- /// <param name="e26_">Element 26</param>
- /// <param name="e25_">Element 25</param>
- /// <param name="e24_">Element 24</param>
- /// <param name="e23_">Element 23</param>
- /// <param name="e22_">Element 22</param>
- /// <param name="e21_">Element 21</param>
- /// <param name="e20_">Element 20</param>
- /// <param name="e19_">Element 19</param>
- /// <param name="e18_">Element 18</param>
- /// <param name="e17_">Element 17</param>
- /// <param name="e16_">Element 16</param>
- /// <param name="e15_">Element 15</param>
- /// <param name="e14_">Element 14</param>
- /// <param name="e13_">Element 13</param>
- /// <param name="e12_">Element 12</param>
- /// <param name="e11_">Element 11</param>
- /// <param name="e10_">Element 10</param>
- /// <param name="e9_">Element 9</param>
- /// <param name="e8_">Element 8</param>
- /// <param name="e7_">Element 7</param>
- /// <param name="e6_">Element 6</param>
- /// <param name="e5_">Element 5</param>
- /// <param name="e4_">Element 4</param>
- /// <param name="e3_">Element 3</param>
- /// <param name="e2_">Element 2</param>
- /// <param name="e1_">Element 1</param>
- /// <param name="e0_">Element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set_epi8(
- byte e31_, byte e30_, byte e29_, byte e28_, byte e27_, byte e26_, byte e25_, byte e24_, byte e23_, byte e22_, byte e21_, byte e20_, byte e19_, byte e18_, byte e17_, byte e16_,
- byte e15_, byte e14_, byte e13_, byte e12_, byte e11_, byte e10_, byte e9_, byte e8_, byte e7_, byte e6_, byte e5_, byte e4_, byte e3_, byte e2_, byte e1_, byte e0_)
- {
- return new v256(
- e0_, e1_, e2_, e3_, e4_, e5_, e6_, e7_,
- e8_, e9_, e10_, e11_, e12_, e13_, e14_, e15_,
- e16_, e17_, e18_, e19_, e20_, e21_, e22_, e23_,
- e24_, e25_, e26_, e27_, e28_, e29_, e30_, e31_);
- }
-
- /// <summary>
- /// Set packed short elements in dst with the supplied values.
- /// </summary>
- /// <param name="e15_">Element 15</param>
- /// <param name="e14_">Element 14</param>
- /// <param name="e13_">Element 13</param>
- /// <param name="e12_">Element 12</param>
- /// <param name="e11_">Element 11</param>
- /// <param name="e10_">Element 10</param>
- /// <param name="e9_">Element 9</param>
- /// <param name="e8_">Element 8</param>
- /// <param name="e7_">Element 7</param>
- /// <param name="e6_">Element 6</param>
- /// <param name="e5_">Element 5</param>
- /// <param name="e4_">Element 4</param>
- /// <param name="e3_">Element 3</param>
- /// <param name="e2_">Element 2</param>
- /// <param name="e1_">Element 1</param>
- /// <param name="e0_">Element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set_epi16(short e15_, short e14_, short e13_, short e12_, short e11_, short e10_, short e9_, short e8_, short e7_, short e6_, short e5_, short e4_, short e3_, short e2_, short e1_, short e0_)
- {
- return new v256(
- e0_, e1_, e2_, e3_, e4_, e5_, e6_, e7_,
- e8_, e9_, e10_, e11_, e12_, e13_, e14_, e15_);
- }
-
- /// <summary>
- /// Set packed int elements in dst with the supplied values.
- /// </summary>
- /// <param name="e7">Element 7</param>
- /// <param name="e6">Element 6</param>
- /// <param name="e5">Element 5</param>
- /// <param name="e4">Element 4</param>
- /// <param name="e3">Element 3</param>
- /// <param name="e2">Element 2</param>
- /// <param name="e1">Element 1</param>
- /// <param name="e0">Element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set_epi32(int e7, int e6, int e5, int e4, int e3, int e2, int e1, int e0)
- {
- return new v256(e0, e1, e2, e3, e4, e5, e6, e7);
- }
-
- /// <summary>
- /// Set packed 64-bit integers in dst with the supplied values.
- /// </summary>
- /// <param name="e3">Element 3</param>
- /// <param name="e2">Element 2</param>
- /// <param name="e1">Element 1</param>
- /// <param name="e0">Element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set_epi64x(long e3, long e2, long e1, long e0)
- {
- return new v256(e0, e1, e2, e3);
- }
-
- /// <summary>
- /// Set packed v256 vector with the supplied values.
- /// </summary>
- /// <param name="hi">High half of the vector</param>
- /// <param name="lo">Low half of the vector</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set_m128d(v128 hi, v128 lo)
- {
- return new v256(lo, hi);
- }
-
- /// <summary>
- /// Set packed v256 vector with the supplied values.
- /// </summary>
- /// <param name="hi">High half of the vector</param>
- /// <param name="lo">Low half of the vector</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set_m128i(v128 hi, v128 lo)
- {
- return new v256(lo, hi);
- }
-
- /// <summary>
- /// Set packed double-precision (64-bit) floating-point elements in dst with the supplied values in reverse order.
- /// </summary>
- /// <param name="d">Element d</param>
- /// <param name="c">Element c</param>
- /// <param name="b">Element b</param>
- /// <param name="a">Element a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setr_pd(double d, double c, double b, double a)
- {
- return new v256(d, c, b, a);
- }
-
- /// <summary>
- /// Set packed single-precision (32-bit) floating-point elements in dst with the supplied values in reverse order.
- /// </summary>
- /// <param name="e7">Element 7</param>
- /// <param name="e6">Element 6</param>
- /// <param name="e5">Element 5</param>
- /// <param name="e4">Element 4</param>
- /// <param name="e3">Element 3</param>
- /// <param name="e2">Element 2</param>
- /// <param name="e1">Element 1</param>
- /// <param name="e0">Element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setr_ps(float e7, float e6, float e5, float e4, float e3, float e2, float e1, float e0)
- {
- return new v256(e7, e6, e5, e4, e3, e2, e1, e0);
- }
-
- /// <summary>
- /// Set packed byte elements in dst with the supplied values in reverse order.
- /// </summary>
- /// <param name="e31_">Element 31</param>
- /// <param name="e30_">Element 30</param>
- /// <param name="e29_">Element 29</param>
- /// <param name="e28_">Element 28</param>
- /// <param name="e27_">Element 27</param>
- /// <param name="e26_">Element 26</param>
- /// <param name="e25_">Element 25</param>
- /// <param name="e24_">Element 24</param>
- /// <param name="e23_">Element 23</param>
- /// <param name="e22_">Element 22</param>
- /// <param name="e21_">Element 21</param>
- /// <param name="e20_">Element 20</param>
- /// <param name="e19_">Element 19</param>
- /// <param name="e18_">Element 18</param>
- /// <param name="e17_">Element 17</param>
- /// <param name="e16_">Element 16</param>
- /// <param name="e15_">Element 15</param>
- /// <param name="e14_">Element 14</param>
- /// <param name="e13_">Element 13</param>
- /// <param name="e12_">Element 12</param>
- /// <param name="e11_">Element 11</param>
- /// <param name="e10_">Element 10</param>
- /// <param name="e9_">Element 9</param>
- /// <param name="e8_">Element 8</param>
- /// <param name="e7_">Element 7</param>
- /// <param name="e6_">Element 6</param>
- /// <param name="e5_">Element 5</param>
- /// <param name="e4_">Element 4</param>
- /// <param name="e3_">Element 3</param>
- /// <param name="e2_">Element 2</param>
- /// <param name="e1_">Element 1</param>
- /// <param name="e0_">Element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setr_epi8(
- byte e31_, byte e30_, byte e29_, byte e28_, byte e27_, byte e26_, byte e25_, byte e24_, byte e23_, byte e22_, byte e21_, byte e20_, byte e19_, byte e18_, byte e17_, byte e16_,
- byte e15_, byte e14_, byte e13_, byte e12_, byte e11_, byte e10_, byte e9_, byte e8_, byte e7_, byte e6_, byte e5_, byte e4_, byte e3_, byte e2_, byte e1_, byte e0_)
- {
- return new v256(
- e31_, e30_, e29_, e28_, e27_, e26_, e25_, e24_,
- e23_, e22_, e21_, e20_, e19_, e18_, e17_, e16_,
- e15_, e14_, e13_, e12_, e11_, e10_, e9_, e8_,
- e7_, e6_, e5_, e4_, e3_, e2_, e1_, e0_);
- }
-
- /// <summary>
- /// Set packed short elements in dst with the supplied values in reverse order.
- /// </summary>
- /// <param name="e15_">Element 15</param>
- /// <param name="e14_">Element 14</param>
- /// <param name="e13_">Element 13</param>
- /// <param name="e12_">Element 12</param>
- /// <param name="e11_">Element 11</param>
- /// <param name="e10_">Element 10</param>
- /// <param name="e9_">Element 9</param>
- /// <param name="e8_">Element 8</param>
- /// <param name="e7_">Element 7</param>
- /// <param name="e6_">Element 6</param>
- /// <param name="e5_">Element 5</param>
- /// <param name="e4_">Element 4</param>
- /// <param name="e3_">Element 3</param>
- /// <param name="e2_">Element 2</param>
- /// <param name="e1_">Element 1</param>
- /// <param name="e0_">Element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setr_epi16(short e15_, short e14_, short e13_, short e12_, short e11_, short e10_, short e9_, short e8_, short e7_, short e6_, short e5_, short e4_, short e3_, short e2_, short e1_, short e0_)
- {
- return new v256(
- e15_, e14_, e13_, e12_, e11_, e10_, e9_, e8_,
- e7_, e6_, e5_, e4_, e3_, e2_, e1_, e0_);
- }
-
- /// <summary>
- /// Set packed int elements in dst with the supplied values in reverse order.
- /// </summary>
- /// <param name="e7">Element 7</param>
- /// <param name="e6">Element 6</param>
- /// <param name="e5">Element 5</param>
- /// <param name="e4">Element 4</param>
- /// <param name="e3">Element 3</param>
- /// <param name="e2">Element 2</param>
- /// <param name="e1">Element 1</param>
- /// <param name="e0">Element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setr_epi32(int e7, int e6, int e5, int e4, int e3, int e2, int e1, int e0)
- {
- return new v256(e7, e6, e5, e4, e3, e2, e1, e0);
- }
-
- /// <summary>
- /// Set packed 64-bit integers in dst with the supplied values in reverse order.
- /// </summary>
- /// <param name="e3">Element 3</param>
- /// <param name="e2">Element 2</param>
- /// <param name="e1">Element 1</param>
- /// <param name="e0">Element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setr_epi64x(long e3, long e2, long e1, long e0)
- {
- return new v256(e3, e2, e1, e0);
- }
-
- /// <summary>
- /// Set packed v256 vector with the supplied values in reverse order.
- /// </summary>
- /// <param name="hi">High half of the vector</param>
- /// <param name="lo">Low half of the vector</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setr_m128(v128 hi, v128 lo)
- {
- return new v256(hi, lo);
- }
-
- /// <summary>
- /// Set packed v256 vector with the supplied values in reverse order.
- /// </summary>
- /// <param name="hi">High half of the vector</param>
- /// <param name="lo">Low half of the vector</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setr_m128d(v128 hi, v128 lo)
- {
- return new v256(hi, lo);
- }
-
- /// <summary>
- /// Set packed v256 vector with the supplied values in reverse order.
- /// </summary>
- /// <param name="hi">High half of the vector</param>
- /// <param name="lo">Low half of the vector</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_setr_m128i(v128 hi, v128 lo)
- {
- return new v256(hi, lo);
- }
-
- /// <summary>
- /// Broadcast double-precision (64-bit) floating-point value a to all elements of dst.
- /// </summary>
- /// <param name="a">Value</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set1_pd(double a)
- {
- return new v256(a);
- }
-
- /// <summary>
- /// Broadcast single-precision (32-bit) floating-point value a to all elements of dst.
- /// </summary>
- /// <param name="a">Value</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set1_ps(float a)
- {
- return new v256(a);
- }
-
- /// <summary>
- /// Broadcast 8-bit integer a to all elements of dst. This intrinsic may generate the vpbroadcastb instruction.
- /// </summary>
- /// <param name="a">8-bit integer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set1_epi8(byte a)
- {
- return new v256(a);
- }
-
- /// <summary>
- /// Broadcast 16-bit integer a to all all elements of dst. This intrinsic may generate the vpbroadcastw instruction.
- /// </summary>
- /// <param name="a">16-bit integer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set1_epi16(short a)
- {
- return new v256(a);
- }
-
- /// <summary>
- /// Broadcast 32-bit integer a to all elements of dst. This intrinsic may generate the vpbroadcastd instruction.
- /// </summary>
- /// <param name="a">32-bit integer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set1_epi32(int a)
- {
- return new v256(a);
- }
-
- /// <summary>
- /// Broadcast 64-bit integer a to all elements of dst. This intrinsic may generate the vpbroadcastq instruction.
- /// </summary>
- /// <param name="a">64-bit integer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_set1_epi64x(long a)
- {
- return new v256(a);
- }
-
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_castpd_ps(v256 a) { return a; }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_castps_pd(v256 a) { return a; }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_castps_si256(v256 a) { return a; }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_castpd_si256(v256 a) { return a; }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_castsi256_ps(v256 a) { return a; }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_castsi256_pd(v256 a) { return a; }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 mm256_castps256_ps128(v256 a) { return a.Lo128; }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 mm256_castpd256_pd128(v256 a) { return a.Lo128; }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 mm256_castsi256_si128(v256 a) { return a.Lo128; }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_castps128_ps256(v128 a) { return new v256(a, Sse.setzero_ps()); }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_castpd128_pd256(v128 a) { return new v256(a, Sse.setzero_ps()); }
- /// <summary>For compatibility with C++ code only. This is a no-op in Burst.</summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_castsi128_si256(v128 a) { return new v256(a, Sse.setzero_ps()); }
-
- /// <summary>Return a 128-bit vector with undefined contents.</summary>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 undefined_ps()
- {
- return default;
- }
-
- /// <summary>Return a 128-bit vector with undefined contents.</summary>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v128 undefined_pd()
- {
- return undefined_ps();
- }
-
- /// <summary>Return a 128-bit vector with undefined contents.</summary>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v128 undefined_si128()
- {
- return undefined_ps();
- }
-
- /// <summary>Return a 256-bit vector with undefined contents.</summary>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_undefined_ps()
- {
- return default;
- }
-
- /// <summary>Return a 256-bit vector with undefined contents.</summary>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_undefined_pd()
- {
- return mm256_undefined_ps();
- }
-
- /// <summary>Return a 256-bit vector with undefined contents.</summary>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_undefined_si256()
- {
- return mm256_undefined_ps();
- }
-
- // Zero-extended cast functions
-
- /// <summary>
- /// Casts vector of type v128 to type v256; the upper 128 bits of the result
- /// are zeroed. This intrinsic is only used for compilation and does not
- /// generate any instructions, thus it has zero latency.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_zextps128_ps256(v128 a) { return new v256(a, Sse.setzero_ps()); }
-
- /// <summary>
- /// Casts vector of type v128 to type v256; the upper 128 bits of the result
- /// are zeroed. This intrinsic is only used for compilation and does not
- /// generate any instructions, thus it has zero latency.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_zextpd128_pd256(v128 a) { return mm256_zextps128_ps256(a); }
-
- /// <summary>
- /// Casts vector of type v128 to type v256; the upper 128 bits of the result
- /// are zeroed. This intrinsic is only used for compilation and does not
- /// generate any instructions, thus it has zero latency.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.AVX)]
- public static v256 mm256_zextsi128_si256(v128 a) { return mm256_zextps128_ps256(a); }
-
-
- /// <summary>
- /// Copy a to dst, and insert the 8-bit integer i into dst at the location specified by index (which must be a constant).
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="i">8-bit integer i</param>
- /// <param name="index">Location</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_insert_epi8(v256 a, int i, int index)
- {
- v256 dst = a;
- byte* target = &dst.Byte0;
- target[index & 31] = (byte)i;
- return dst;
- }
-
- /// <summary>
- /// Copy a to dst, and insert the 16-bit integer i into dst at the location specified by index (which must be a constant).
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="i">16-bit integer i</param>
- /// <param name="index">Location</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_insert_epi16(v256 a, int i, int index)
- {
- v256 dst = a;
- short* target = &dst.SShort0;
- target[index & 15] = (short)i;
- return dst;
- }
-
- /// <summary>
- /// Copy a to dst, and insert the 32-bit integer i into dst at the location specified by index (which must be a constant).
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="i">32-bit integer i</param>
- /// <param name="index">Location</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_insert_epi32(v256 a, int i, int index)
- {
- v256 dst = a;
- int* target = &dst.SInt0;
- target[index & 7] = i;
- return dst;
- }
-
- /// <summary>
- /// Copy a to dst, and insert the 64-bit integer i into dst at the location specified by index (which must be a constant).
- /// </summary>
- /// <remarks>
- /// This intrinsic requires a 64-bit processor.
- /// </remarks>
- /// <param name="a">Vector a</param>
- /// <param name="i">64-bit integer i</param>
- /// <param name="index">Location</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v256 mm256_insert_epi64(v256 a, long i, int index)
- {
- v256 dst = a;
- long* target = &dst.SLong0;
- target[index & 3] = i;
- return dst;
- }
-
- /// <summary>
- /// Extract a 32-bit integer from a, selected with index (which must be a constant), and store the result in dst.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="index">Index</param>
- /// <returns>32-bit integer</returns>
- [DebuggerStepThrough]
- public static int mm256_extract_epi32(v256 a, int index)
- {
- return (&a.SInt0)[index & 7];
- }
-
- /// <summary>
- /// Extract a 64-bit integer from a, selected with index (which must be a constant), and store the result in dst.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <param name="index">Index</param>
- /// <returns>64-bit integer</returns>
- [DebuggerStepThrough]
- public static long mm256_extract_epi64(v256 a, int index)
- {
- return (&a.SLong0)[index & 3];
- }
- }
- }
- }
|