1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252 |
- using System;
- using System.Diagnostics;
-
- namespace Unity.Burst.Intrinsics
- {
- public unsafe static partial class X86
- {
- /// <summary>
- /// SSE intrinsics
- /// </summary>
- public static class Sse
- {
- /// <summary>
- /// Evaluates to true at compile time if SSE intrinsics are supported.
- /// </summary>
- public static bool IsSseSupported { get { return false; } }
-
- /// <summary>
- /// Load 128-bits (composed of 4 packed single-precision (32-bit)
- /// floating-point elements) from memory into dst.
- /// </summary>
- /// <remarks>
- /// Burst will always generate unaligned loads.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 load_ps(void* ptr)
- {
- return GenericCSharpLoad(ptr);
- }
-
- /// <summary>
- /// Load 128-bits (composed of 4 packed single-precision (32-bit)
- /// floating-point elements) from memory into dst. mem_addr does
- /// not need to be aligned on any particular boundary.
- /// </summary>
- /// <param name="ptr">Pointer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 loadu_ps(void* ptr)
- {
- return GenericCSharpLoad(ptr);
- }
-
- /// <summary>
- /// Store 128-bits (composed of 4 packed single-precision (32-bit)
- /// floating-point elements) from a into memory.
- /// </summary>
- /// <remarks>
- /// Burst will always generate unaligned stores.
- /// </remarks>
- /// <param name="ptr">Pointer</param>
- /// <param name="val">Value vector</param>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static void store_ps(void* ptr, v128 val)
- {
- GenericCSharpStore(ptr, val);
- }
-
- /// <summary>
- /// Store 128-bits (composed of 4 packed single-precision (32-bit)
- /// floating-point elements) from a into memory. mem_addr does not
- /// need to be aligned on any particular boundary.
- /// </summary>
- /// <param name="ptr">Pointer</param>
- /// <param name="val">Value vector</param>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static void storeu_ps(void* ptr, v128 val)
- {
- GenericCSharpStore(ptr, val);
- }
-
- /// <summary>
- /// Store 128-bits (composed of 4 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 16-byte boundary or a general-protection exception will be generated.
- /// </summary>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static void stream_ps(void* mem_addr, v128 a)
- {
- GenericCSharpStore(mem_addr, a);
- }
-
- // _mm_cvtsi32_ss
- /// <summary> Convert the 32-bit integer "b" to a single-precision (32-bit) floating-point element, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">32-bit integer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cvtsi32_ss(v128 a, int b)
- {
- v128 dst = a;
- dst.Float0 = b;
- return dst;
- }
-
- // _mm_cvtsi64_ss
- /// <summary> Convert the 64-bit integer "b" to a single-precision (32-bit) floating-point element, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">64-bit integer</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cvtsi64_ss(v128 a, long b)
- {
- v128 dst = a;
- dst.Float0 = b;
- return dst;
- }
-
- // _mm_add_ss
- /// <summary> Add the lower single-precision (32-bit) floating-point element in "a" and "b", 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 add_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 = dst.Float0 + b.Float0;
- return dst;
- }
-
- // _mm_add_ps
- /// <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 v128 add_ps(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 += b.Float0;
- dst.Float1 += b.Float1;
- dst.Float2 += b.Float2;
- dst.Float3 += b.Float3;
- return dst;
- }
-
- // _mm_sub_ss
- /// <summary> Subtract the lower single-precision (32-bit) floating-point element in "b" from the lower single-precision (32-bit) floating-point element in "a", 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 sub_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 = a.Float0 - b.Float0;
- return dst;
- }
-
- // _mm_sub_ps
- /// <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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 sub_ps(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 -= b.Float0;
- dst.Float1 -= b.Float1;
- dst.Float2 -= b.Float2;
- dst.Float3 -= b.Float3;
- return dst;
- }
-
- // _mm_mul_ss
- /// <summary> Multiply the lower single-precision (32-bit) floating-point element in "a" and "b", 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 mul_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 = a.Float0 * b.Float0;
- return dst;
- }
-
- // _mm_mul_ps
- /// <summary> Multiply 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 v128 mul_ps(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 *= b.Float0;
- dst.Float1 *= b.Float1;
- dst.Float2 *= b.Float2;
- dst.Float3 *= b.Float3;
- return dst;
- }
-
- // _mm_div_ss
- /// <summary> Divide the lower single-precision (32-bit) floating-point element in "a" by the lower single-precision (32-bit) floating-point element in "b", 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 div_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 = a.Float0 / b.Float0;
- return dst;
- }
-
- // _mm_div_ps
- /// <summary> Divide packed single-precision (32-bit) floating-point elements in "a" by 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 v128 div_ps(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 /= b.Float0;
- dst.Float1 /= b.Float1;
- dst.Float2 /= b.Float2;
- dst.Float3 /= b.Float3;
- return dst;
- }
-
- // _mm_sqrt_ss
- /// <summary> Compute the square root of the lower single-precision (32-bit) floating-point element in "a", 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>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 sqrt_ss(v128 a)
- {
- v128 dst = a;
- dst.Float0 = (float)Math.Sqrt(a.Float0);
- return dst;
- }
-
- // _mm_sqrt_ps
- /// <summary> Compute the square root of packed single-precision (32-bit) floating-point elements in "a", and store the results in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 sqrt_ps(v128 a)
- {
- v128 dst = default(v128);
- dst.Float0 = (float)Math.Sqrt(a.Float0);
- dst.Float1 = (float)Math.Sqrt(a.Float1);
- dst.Float2 = (float)Math.Sqrt(a.Float2);
- dst.Float3 = (float)Math.Sqrt(a.Float3);
- return dst;
- }
-
- // _mm_rcp_ss
- /// <summary> Compute the approximate reciprocal of the lower single-precision (32-bit) floating-point element in "a", store the result in the lower element of "dst", and copy the upper 3 packed elements from "a" to the upper elements of "dst". The maximum relative error for this approximation is less than 1.5*2^-12. </summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 rcp_ss(v128 a)
- {
- v128 dst = a;
- dst.Float0 = 1.0f / a.Float0;
- return dst;
- }
-
- // _mm_rcp_ps
- /// <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>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 rcp_ps(v128 a)
- {
- v128 dst = default(v128);
- dst.Float0 = 1.0f / a.Float0;
- dst.Float1 = 1.0f / a.Float1;
- dst.Float2 = 1.0f / a.Float2;
- dst.Float3 = 1.0f / a.Float3;
- return dst;
- }
-
- // _mm_rsqrt_ss
- /// <summary> Compute the approximate reciprocal square root of the lower single-precision (32-bit) floating-point element in "a", store the result in the lower element of "dst", and copy the upper 3 packed elements from "a" to the upper elements of "dst". The maximum relative error for this approximation is less than 1.5*2^-12. </summary>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 rsqrt_ss(v128 a)
- {
- v128 dst = a;
- dst.Float0 = 1.0f / (float)Math.Sqrt(a.Float0);
- return dst;
- }
-
- // _mm_rsqrt_ps
- /// <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>
- /// <param name="a">Vector a</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 rsqrt_ps(v128 a)
- {
- v128 dst = default(v128);
- dst.Float0 = 1.0f / (float)Math.Sqrt(a.Float0);
- dst.Float1 = 1.0f / (float)Math.Sqrt(a.Float1);
- dst.Float2 = 1.0f / (float)Math.Sqrt(a.Float2);
- dst.Float3 = 1.0f / (float)Math.Sqrt(a.Float3);
- return dst;
- }
-
- // _mm_min_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b", store the minimum value in the lower element of "dst", and copy the upper element from "a" to the upper element of "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 min_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 = Math.Min(a.Float0, b.Float0);
- return dst;
- }
-
- // _mm_min_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b", and store packed minimum values in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 min_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.Float0 = Math.Min(a.Float0, b.Float0);
- dst.Float1 = Math.Min(a.Float1, b.Float1);
- dst.Float2 = Math.Min(a.Float2, b.Float2);
- dst.Float3 = Math.Min(a.Float3, b.Float3);
- return dst;
- }
-
- // _mm_max_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b", store the maximum value in the lower element of "dst", and copy the upper element from "a" to the upper element of "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 max_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 = Math.Max(a.Float0, b.Float0);
- return dst;
- }
-
- // _mm_max_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b", and store packed maximum values in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 max_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.Float0 = Math.Max(a.Float0, b.Float0);
- dst.Float1 = Math.Max(a.Float1, b.Float1);
- dst.Float2 = Math.Max(a.Float2, b.Float2);
- dst.Float3 = Math.Max(a.Float3, b.Float3);
- return dst;
- }
-
- // _mm_and_ps
- /// <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 v128 and_ps(v128 a, v128 b)
- {
- v128 dst = a;
- dst.UInt0 &= b.UInt0;
- dst.UInt1 &= b.UInt1;
- dst.UInt2 &= b.UInt2;
- dst.UInt3 &= b.UInt3;
- return dst;
- }
-
- // _mm_andnot_ps
- /// <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 v128 andnot_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = (~a.UInt0) & b.UInt0;
- dst.UInt1 = (~a.UInt1) & b.UInt1;
- dst.UInt2 = (~a.UInt2) & b.UInt2;
- dst.UInt3 = (~a.UInt3) & b.UInt3;
- return dst;
- }
-
- // _mm_or_ps
- /// <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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 or_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = a.UInt0 | b.UInt0;
- dst.UInt1 = a.UInt1 | b.UInt1;
- dst.UInt2 = a.UInt2 | b.UInt2;
- dst.UInt3 = a.UInt3 | b.UInt3;
- return dst;
- }
-
- // _mm_xor_ps
- /// <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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 xor_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = a.UInt0 ^ b.UInt0;
- dst.UInt1 = a.UInt1 ^ b.UInt1;
- dst.UInt2 = a.UInt2 ^ b.UInt2;
- dst.UInt3 = a.UInt3 ^ b.UInt3;
- return dst;
- }
-
- // _mm_cmpeq_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" for equality, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmpeq_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.UInt0 = a.Float0 == b.Float0 ? ~0u : 0;
- return dst;
- }
-
- // _mm_cmpeq_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" for equality, 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 v128 cmpeq_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = a.Float0 == b.Float0 ? ~0u : 0;
- dst.UInt1 = a.Float1 == b.Float1 ? ~0u : 0;
- dst.UInt2 = a.Float2 == b.Float2 ? ~0u : 0;
- dst.UInt3 = a.Float3 == b.Float3 ? ~0u : 0;
- return dst;
- }
-
- // _mm_cmplt_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" for less-than, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmplt_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.UInt0 = a.Float0 < b.Float0 ? ~0u : 0u;
- return dst;
- }
-
- // _mm_cmplt_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" for less-than, 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 v128 cmplt_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = a.Float0 < b.Float0 ? ~0u : 0u;
- dst.UInt1 = a.Float1 < b.Float1 ? ~0u : 0u;
- dst.UInt2 = a.Float2 < b.Float2 ? ~0u : 0u;
- dst.UInt3 = a.Float3 < b.Float3 ? ~0u : 0u;
- return dst;
- }
-
- // _mm_cmple_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" for less-than-or-equal, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmple_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.UInt0 = a.Float0 <= b.Float0 ? ~0u : 0;
- return dst;
- }
-
- // _mm_cmple_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" for less-than-or-equal, 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 v128 cmple_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = a.Float0 <= b.Float0 ? ~0u : 0u;
- dst.UInt1 = a.Float1 <= b.Float1 ? ~0u : 0u;
- dst.UInt2 = a.Float2 <= b.Float2 ? ~0u : 0u;
- dst.UInt3 = a.Float3 <= b.Float3 ? ~0u : 0u;
- return dst;
- }
-
- // _mm_cmpgt_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" for greater-than, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 cmpgt_ss(v128 a, v128 b)
- {
- return cmplt_ss(b, a);
- }
-
- // _mm_cmpgt_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" for greater-than, and store the results in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 cmpgt_ps(v128 a, v128 b)
- {
- return cmplt_ps(b, a);
- }
-
- // _mm_cmpge_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" for greater-than-or-equal, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 cmpge_ss(v128 a, v128 b)
- {
- return cmple_ss(b, a);
- }
-
- // _mm_cmpge_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" for greater-than-or-equal, and store the results in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 cmpge_ps(v128 a, v128 b)
- {
- return cmple_ps(b, a);
- }
-
- // _mm_cmpneq_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" for not-equal, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmpneq_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.UInt0 = a.Float0 != b.Float0 ? ~0u : 0u;
- return dst;
- }
-
- // _mm_cmpneq_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" for not-equal, 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 v128 cmpneq_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = a.Float0 != b.Float0 ? ~0u : 0u;
- dst.UInt1 = a.Float1 != b.Float1 ? ~0u : 0u;
- dst.UInt2 = a.Float2 != b.Float2 ? ~0u : 0u;
- dst.UInt3 = a.Float3 != b.Float3 ? ~0u : 0u;
- return dst;
- }
-
- // _mm_cmpnlt_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" for not-less-than, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmpnlt_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.UInt0 = !(a.Float0 < b.Float0) ? ~0u : 0u;
- return dst;
- }
-
- // _mm_cmpnlt_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" for not-less-than, 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 v128 cmpnlt_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = !(a.Float0 < b.Float0) ? ~0u : 0u;
- dst.UInt1 = !(a.Float1 < b.Float1) ? ~0u : 0u;
- dst.UInt2 = !(a.Float2 < b.Float2) ? ~0u : 0u;
- dst.UInt3 = !(a.Float3 < b.Float3) ? ~0u : 0u;
- return dst;
- }
-
- // _mm_cmpnle_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" for not-less-than-or-equal, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmpnle_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.UInt0 = !(a.Float0 <= b.Float0) ? ~0u : 0u;
- return dst;
- }
-
- // _mm_cmpnle_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" for not-less-than-or-equal, 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 v128 cmpnle_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = !(a.Float0 <= b.Float0) ? ~0u : 0u;
- dst.UInt1 = !(a.Float1 <= b.Float1) ? ~0u : 0u;
- dst.UInt2 = !(a.Float2 <= b.Float2) ? ~0u : 0u;
- dst.UInt3 = !(a.Float3 <= b.Float3) ? ~0u : 0u;
- return dst;
- }
-
- // _mm_cmpngt_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" for not-greater-than, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 cmpngt_ss(v128 a, v128 b)
- {
- return cmpnlt_ss(b, a);
- }
-
- // _mm_cmpngt_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" for not-greater-than, and store the results in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 cmpngt_ps(v128 a, v128 b)
- {
- return cmpnlt_ps(b, a);
- }
-
- // _mm_cmpnge_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" for not-greater-than-or-equal, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 cmpnge_ss(v128 a, v128 b)
- {
- return cmpnle_ss(b, a);
- }
-
- // _mm_cmpnge_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" for not-greater-than-or-equal, and store the results in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 cmpnge_ps(v128 a, v128 b)
- {
- return cmpnle_ps(b, a);
- }
-
- // _mm_cmpord_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" to see if neither is NaN, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmpord_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.UInt0 = IsNaN(a.UInt0) || IsNaN(b.UInt0) ? 0 : ~0u;
- return dst;
- }
-
- // _mm_cmpord_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" to see if neither is NaN, 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 v128 cmpord_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = IsNaN(a.UInt0) || IsNaN(b.UInt0) ? 0 : ~0u;
- dst.UInt1 = IsNaN(a.UInt1) || IsNaN(b.UInt1) ? 0 : ~0u;
- dst.UInt2 = IsNaN(a.UInt2) || IsNaN(b.UInt2) ? 0 : ~0u;
- dst.UInt3 = IsNaN(a.UInt3) || IsNaN(b.UInt3) ? 0 : ~0u;
- return dst;
- }
-
- // _mm_cmpunord_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point elements in "a" and "b" to see if either is NaN, 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>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 cmpunord_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.UInt0 = IsNaN(a.UInt0) || IsNaN(b.UInt0) ? ~0u : 0;
- return dst;
- }
-
- // _mm_cmpunord_ps
- /// <summary> Compare packed single-precision (32-bit) floating-point elements in "a" and "b" to see if either is NaN, 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 v128 cmpunord_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.UInt0 = IsNaN(a.UInt0) || IsNaN(b.UInt0) ? ~0u : 0;
- dst.UInt1 = IsNaN(a.UInt1) || IsNaN(b.UInt1) ? ~0u : 0;
- dst.UInt2 = IsNaN(a.UInt2) || IsNaN(b.UInt2) ? ~0u : 0;
- dst.UInt3 = IsNaN(a.UInt3) || IsNaN(b.UInt3) ? ~0u : 0;
- return dst;
- }
-
- // _mm_comieq_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for equality, and return the boolean result (0 or 1). </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int comieq_ss(v128 a, v128 b)
- {
- return a.Float0 == b.Float0 ? 1 : 0;
- }
-
- // _mm_comilt_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for less-than, and return the boolean result (0 or 1). </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int comilt_ss(v128 a, v128 b)
- {
- return a.Float0 < b.Float0 ? 1 : 0;
- }
-
- // _mm_comile_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for less-than-or-equal, and return the boolean result (0 or 1). </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int comile_ss(v128 a, v128 b)
- {
- return a.Float0 <= b.Float0 ? 1 : 0;
- }
-
- // _mm_comigt_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for greater-than, and return the boolean result (0 or 1). </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int comigt_ss(v128 a, v128 b)
- {
- return a.Float0 > b.Float0 ? 1 : 0;
- }
-
- // _mm_comige_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for greater-than-or-equal, and return the boolean result (0 or 1). </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int comige_ss(v128 a, v128 b)
- {
- return a.Float0 >= b.Float0 ? 1 : 0;
- }
-
- // _mm_comineq_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for not-equal, and return the boolean result (0 or 1). </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int comineq_ss(v128 a, v128 b)
- {
- return a.Float0 != b.Float0 ? 1 : 0;
- }
-
- // _mm_ucomieq_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for equality, and return the boolean result (0 or 1). This instruction will not signal an exception for QNaNs. </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int ucomieq_ss(v128 a, v128 b)
- {
- return a.Float0 == b.Float0 ? 1 : 0;
- }
-
- // _mm_ucomilt_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for less-than, and return the boolean result (0 or 1). This instruction will not signal an exception for QNaNs. </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int ucomilt_ss(v128 a, v128 b)
- {
- return a.Float0 < b.Float0 ? 1 : 0;
- }
-
- // _mm_ucomile_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for less-than-or-equal, and return the boolean result (0 or 1). This instruction will not signal an exception for QNaNs. </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int ucomile_ss(v128 a, v128 b)
- {
- return a.Float0 <= b.Float0 ? 1 : 0;
- }
-
- // _mm_ucomigt_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for greater-than, and return the boolean result (0 or 1). This instruction will not signal an exception for QNaNs. </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int ucomigt_ss(v128 a, v128 b)
- {
- return a.Float0 > b.Float0 ? 1 : 0;
- }
-
- // _mm_ucomige_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for greater-than-or-equal, and return the boolean result (0 or 1). This instruction will not signal an exception for QNaNs. </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int ucomige_ss(v128 a, v128 b)
- {
- return a.Float0 >= b.Float0 ? 1 : 0;
- }
-
- // _mm_ucomineq_ss
- /// <summary> Compare the lower single-precision (32-bit) floating-point element in "a" and "b" for not-equal, and return the boolean result (0 or 1). This instruction will not signal an exception for QNaNs. </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Boolean result</returns>
- [DebuggerStepThrough]
- public static int ucomineq_ss(v128 a, v128 b)
- {
- return a.Float0 != b.Float0 ? 1 : 0;
- }
-
- // _mm_cvtss_si32
- /// <summary> Convert the lower single-precision (32-bit) floating-point element in "a" to a 32-bit integer, and store the result in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <returns>Integer</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static int cvtss_si32(v128 a)
- {
- return cvt_ss2si(a);
- }
-
- // _mm_cvt_ss2si
- /// <summary>
- /// Convert the lower single-precision (32-bit) floating-point element in "a" to a 32-bit integer, and store the result in "dst".
- /// Follows standard of rounding to nearest, and for midpoint rounding it rounds to even.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <returns>Integer</returns>
- [DebuggerStepThrough]
- public static int cvt_ss2si(v128 a)
- {
- return (int)Math.Round(a.Float0, MidpointRounding.ToEven);
- }
-
- // _mm_cvtss_si64
- /// <summary>
- /// Convert the lower single-precision (32-bit) floating-point element in "a" to a 64-bit integer, and store the result in "dst".
- /// Follows standard of rounding to nearest, and for midpoint rounding it rounds to even.
- /// </summary>
- /// <param name="a">Vector a</param>
- /// <returns>64-bit integer</returns>
- [DebuggerStepThrough]
- public static long cvtss_si64(v128 a)
- {
- return (long)Math.Round(a.Float0, MidpointRounding.ToEven);
- }
-
- // _mm_cvtss_f32
- /// <summary> Copy the lower single-precision (32-bit) floating-point element of "a" to "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <returns>32-bit floating point element</returns>
- [DebuggerStepThrough]
- public static float cvtss_f32(v128 a)
- {
- return a.Float0;
- }
-
- // _mm_cvttss_si32
- /// <summary> Convert the lower single-precision (32-bit) floating-point element in "a" to a 32-bit integer with truncation, and store the result in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <returns>32-bit integer</returns>
- [DebuggerStepThrough]
- public static int cvttss_si32(v128 a)
- {
- using (var csr = new RoundingScope(MXCSRBits.RoundTowardZero))
- {
- return (int)a.Float0;
- }
- }
-
- // _mm_cvtt_ss2si
- /// <summary> Convert the lower single-precision (32-bit) floating-point element in "a" to a 32-bit integer with truncation, and store the result in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <returns>32-bit integer</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static int cvtt_ss2si(v128 a)
- {
- return cvttss_si32(a);
- }
-
- // _mm_cvttss_si64
- /// <summary> Convert the lower single-precision (32-bit) floating-point element in "a" to a 64-bit integer with truncation, and store the result in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <returns>64-bit integer</returns>
- [DebuggerStepThrough]
- public static long cvttss_si64(v128 a)
- {
- using (var csr = new RoundingScope(MXCSRBits.RoundTowardZero))
- {
- return (long)a.Float0;
- }
- }
-
- // _mm_set_ss
- /// <summary> Copy single-precision (32-bit) floating-point element "a" to the lower element of "dst", and zero the upper 3 elements. </summary>
- /// <param name="a">Floating point element</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 set_ss(float a)
- {
- return new v128(a, 0.0f, 0.0f, 0.0f);
- }
-
- // _mm_set1_ps
- /// <summary> Broadcast single-precision (32-bit) floating-point value "a" to all elements of "dst". </summary>
- /// <param name="a">Floating point element</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 set1_ps(float a)
- {
- return new v128(a, a, a, a);
- }
-
- // _mm_set_ps1
- /// <summary> Broadcast single-precision (32-bit) floating-point value "a" to all elements of "dst". </summary>
- /// <param name="a">Floating point element</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static v128 set_ps1(float a)
- {
- return set1_ps(a);
- }
-
- // _mm_set_ps
- /// <summary> Set packed single-precision (32-bit) floating-point elements in "dst" with the supplied values. </summary>
- /// <param name="e3">Floating point element 3</param>
- /// <param name="e2">Floating point element 2</param>
- /// <param name="e1">Floating point element 1</param>
- /// <param name="e0">Floating point element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 set_ps(float e3, float e2, float e1, float e0)
- {
- return new v128(e0, e1, e2, e3);
- }
-
- // _mm_setr_ps
- /// <summary> Set packed single-precision (32-bit) floating-point elements in "dst" with the supplied values in reverse order. </summary>
- /// <param name="e3">Floating point element 3</param>
- /// <param name="e2">Floating point element 2</param>
- /// <param name="e1">Floating point element 1</param>
- /// <param name="e0">Floating point element 0</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 setr_ps(float e3, float e2, float e1, float e0)
- {
- return new v128(e3, e2, e1, e0);
- }
-
- // _mm_move_ss
- /// <summary> Move the lower single-precision (32-bit) floating-point element from "b" to the lower element of "dst", and copy the upper 3 elements from "a" to the upper elements of "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 move_ss(v128 a, v128 b)
- {
- v128 dst = a;
- dst.Float0 = b.Float0;
- return dst;
- }
-
- // _MM_SHUFFLE macro
- /// <summary>
- /// Return a shuffle immediate suitable for use with shuffle_ps and similar instructions.
- /// </summary>
- /// <param name="d">Integer d</param>
- /// <param name="c">Integer c</param>
- /// <param name="b">Integer b</param>
- /// <param name="a">Integer a</param>
- /// <returns>Shuffle suitable for use with shuffle_ps</returns>
- public static int SHUFFLE(int d, int c, int b, int a)
- {
- return ((a & 3)) | ((b & 3) << 2) | ((c & 3) << 4) | ((d & 3) << 6);
- }
-
- // _mm_shuffle_ps
- /// <summary> Shuffle single-precision (32-bit) floating-point elements in "a" using the control in "imm8", and store the results in "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <param name="imm8">Control</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 shuffle_ps(v128 a, v128 b, int imm8)
- {
- v128 dst = default(v128);
- // Use integers, rather than floats, because of a Mono bug.
- uint* aptr = &a.UInt0;
- uint* bptr = &b.UInt0;
- dst.UInt0 = aptr[(imm8 >> 0) & 3];
- dst.UInt1 = aptr[(imm8 >> 2) & 3];
- dst.UInt2 = bptr[(imm8 >> 4) & 3];
- dst.UInt3 = bptr[(imm8 >> 6) & 3];
- return dst;
- }
-
- // _mm_unpackhi_ps
- /// <summary> Unpack and interleave single-precision (32-bit) floating-point elements from the high half "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 v128 unpackhi_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.Float0 = a.Float2;
- dst.Float1 = b.Float2;
- dst.Float2 = a.Float3;
- dst.Float3 = b.Float3;
- return dst;
- }
-
- // _mm_unpacklo_ps
- /// <summary> Unpack and interleave single-precision (32-bit) floating-point elements from the low half of "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 v128 unpacklo_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.Float0 = a.Float0;
- dst.Float1 = b.Float0;
- dst.Float2 = a.Float1;
- dst.Float3 = b.Float1;
- return dst;
- }
-
- // _mm_movehl_ps
- /// <summary> Move the upper 2 single-precision (32-bit) floating-point elements from "b" to the lower 2 elements of "dst", and copy the upper 2 elements from "a" to the upper 2 elements of "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 movehl_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.Float0 = b.Float2;
- dst.Float1 = b.Float3;
- dst.Float2 = a.Float2;
- dst.Float3 = a.Float3;
- return dst;
- }
-
- // _mm_movelh_ps
- /// <summary> Move the lower 2 single-precision (32-bit) floating-point elements from "b" to the upper 2 elements of "dst", and copy the lower 2 elements from "a" to the lower 2 elements of "dst". </summary>
- /// <param name="a">Vector a</param>
- /// <param name="b">Vector b</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 movelh_ps(v128 a, v128 b)
- {
- v128 dst = default(v128);
- dst.Float0 = a.Float0;
- dst.Float1 = a.Float1;
- dst.Float2 = b.Float0;
- dst.Float3 = b.Float1;
- return dst;
- }
-
- // _mm_movemask_ps
- /// <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>
- /// <param name="a">Vector a</param>
- /// <returns>Integer</returns>
- [DebuggerStepThrough]
- public static int movemask_ps(v128 a)
- {
- int dst = 0;
- if ((a.UInt0 & 0x80000000) != 0) dst |= 1;
- if ((a.UInt1 & 0x80000000) != 0) dst |= 2;
- if ((a.UInt2 & 0x80000000) != 0) dst |= 4;
- if ((a.UInt3 & 0x80000000) != 0) dst |= 8;
- return dst;
- }
-
- /// <summary>
- /// Transposes a 4x4 matrix of single precision floating point values (_MM_TRANSPOSE4_PS).
- /// </summary>
- /// <remarks>
- /// Arguments row0, row1, row2, and row3 are __m128
- /// values whose elements form the corresponding rows
- /// of a 4x4 matrix. The matrix transpose is returned
- /// in arguments row0, row1, row2, and row3 where row0
- /// now holds column 0 of the original matrix, row1 now
- /// holds column 1 of the original matrix, etc.
- /// </remarks>
- /// <param name="row0">__m128 value on corresponding row</param>
- /// <param name="row1">__m128 value on corresponding row</param>
- /// <param name="row2">__m128 value on corresponding row</param>
- /// <param name="row3">__m128 value on corresponding row</param>
- [DebuggerStepThrough]
- [BurstTargetCpu(BurstTargetCpu.X64_SSE2)]
- public static void TRANSPOSE4_PS(ref v128 row0, ref v128 row1, ref v128 row2, ref v128 row3)
- {
- v128 _Tmp3, _Tmp2, _Tmp1, _Tmp0;
-
- _Tmp0 = shuffle_ps((row0), (row1), 0x44);
- _Tmp2 = shuffle_ps((row0), (row1), 0xEE);
- _Tmp1 = shuffle_ps((row2), (row3), 0x44);
- _Tmp3 = shuffle_ps((row2), (row3), 0xEE);
-
- row0 = shuffle_ps(_Tmp0, _Tmp1, 0x88);
- row1 = shuffle_ps(_Tmp0, _Tmp1, 0xDD);
- row2 = shuffle_ps(_Tmp2, _Tmp3, 0x88);
- row3 = shuffle_ps(_Tmp2, _Tmp3, 0xDD);
- }
-
- /// <summary>
- /// Return vector of type v128 with all elements set to zero.
- /// </summary>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 setzero_ps()
- {
- return default;
- }
-
- /// <summary>
- /// Load unaligned 16-bit integer from memory into the first element of dst.
- /// </summary>
- /// <param name="mem_addr">Memory address</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 loadu_si16(void* mem_addr)
- {
- return new v128(*(short*)mem_addr, 0, 0, 0, 0, 0, 0, 0);
- }
-
- /// <summary>
- /// Store 16-bit integer from the first element of a into memory.
- /// mem_addr does not need to be aligned on any particular
- /// boundary.
- /// </summary>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="a">Vector a</param>
- public static void storeu_si16(void* mem_addr, v128 a)
- {
- *(short*)mem_addr = a.SShort0;
- }
-
- /// <summary>
- /// Load unaligned 64-bit integer from memory into the first element of dst.
- /// </summary>
- /// <param name="mem_addr">Memory address</param>
- /// <returns>Vector</returns>
- [DebuggerStepThrough]
- public static v128 loadu_si64(void* mem_addr)
- {
- return new v128(*(long*)mem_addr, 0);
- }
-
- /// <summary>
- /// Store 64-bit integer from the first element of a into memory.
- /// mem_addr does not need to be aligned on any particular
- /// boundary.
- /// </summary>
- /// <param name="mem_addr">Memory address</param>
- /// <param name="a">Vector a</param>
- [DebuggerStepThrough]
- public static void storeu_si64(void* mem_addr, v128 a)
- {
- *(long*)mem_addr = a.SLong0;
- }
- }
- }
- }
|