using System; using System.Diagnostics; namespace Unity.Burst.Intrinsics { public unsafe static partial class X86 { /// /// AVX2 intrinsics /// public static class Avx2 { /// /// Evaluates to true at compile time if AVX2 intrinsics are supported. /// public static bool IsAvx2Supported { get { return false; } } /// /// Create mask from the most significant bit of each 8-bit element in a, and store the result in dst. /// /// /// **** vpmovmskb r32, ymm /// /// Vector a /// Integer [DebuggerStepThrough] public static int mm256_movemask_epi8(v256 a) { uint result = 0; byte* ptr = &a.Byte0; uint bit = 1; for (int i = 0; i < 32; ++i, bit <<= 1) { result |= (((uint)ptr[i]) >> 7) * bit; } return (int)result; } /// /// Extract an 8-bit integer from a, selected with index (which must be constant), and store the result in dst. /// /// Vector a /// Index in the vector /// Integer [DebuggerStepThrough] public static int mm256_extract_epi8(v256 a, int index) { return (&a.Byte0)[index & 31]; } /// /// Extract a 16-bit integer from a, selected with index (which must be constant), and store the result in dst. /// /// Vector a /// Index in the vector /// Integer [DebuggerStepThrough] public static int mm256_extract_epi16(v256 a, int index) { return (&a.UShort0)[index & 15]; } /// /// Copy the lower double-precision (64-bit) floating-point element of a to dst. /// /// Vector a /// Double [DebuggerStepThrough] public static double mm256_cvtsd_f64(v256 a) { // Burst IR is fine here. return a.Double0; } /// /// Copy the lower 32-bit integer in a to dst. /// /// Vector a /// Integer [DebuggerStepThrough] public static int mm256_cvtsi256_si32(v256 a) { // Burst IR is fine here. return a.SInt0; } /// /// Copy the lower 64-bit integer in a to dst. /// /// Vector a /// 64-bit integer [DebuggerStepThrough] public static long mm256_cvtsi256_si64(v256 a) { // Burst IR is fine here. return a.SLong0; } /// /// Compare packed 8-bit integers in a and b for equality, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_cmpeq_epi8(v256 a, v256 b) { return new v256(Sse2.cmpeq_epi8(a.Lo128, b.Lo128), Sse2.cmpeq_epi8(a.Hi128, b.Hi128)); } /// /// Compare packed 16-bit integers in a and b for equality, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_cmpeq_epi16(v256 a, v256 b) { return new v256(Sse2.cmpeq_epi16(a.Lo128, b.Lo128), Sse2.cmpeq_epi16(a.Hi128, b.Hi128)); } /// /// Compare packed 32-bit integers in a and b for equality, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_cmpeq_epi32(v256 a, v256 b) { return new v256(Sse2.cmpeq_epi32(a.Lo128, b.Lo128), Sse2.cmpeq_epi32(a.Hi128, b.Hi128)); } /// /// Compare packed 64-bit integers in a and b for equality, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_cmpeq_epi64(v256 a, v256 b) { return new v256(Sse4_1.cmpeq_epi64(a.Lo128, b.Lo128), Sse4_1.cmpeq_epi64(a.Hi128, b.Hi128)); } /// /// Compare packed 8-bit integers in a and b for greater-than, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_cmpgt_epi8(v256 a, v256 b) { return new v256(Sse2.cmpgt_epi8(a.Lo128, b.Lo128), Sse2.cmpgt_epi8(a.Hi128, b.Hi128)); } /// /// Compare packed 16-bit integers in a and b for greater-than, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_cmpgt_epi16(v256 a, v256 b) { return new v256(Sse2.cmpgt_epi16(a.Lo128, b.Lo128), Sse2.cmpgt_epi16(a.Hi128, b.Hi128)); } /// /// Compare packed 32-bit integers in a and b for greater-than, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_cmpgt_epi32(v256 a, v256 b) { return new v256(Sse2.cmpgt_epi32(a.Lo128, b.Lo128), Sse2.cmpgt_epi32(a.Hi128, b.Hi128)); } /// /// Compare packed 64-bit integers in a and b for equality, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_cmpgt_epi64(v256 a, v256 b) { return new v256(Sse4_2.cmpgt_epi64(a.Lo128, b.Lo128), Sse4_2.cmpgt_epi64(a.Hi128, b.Hi128)); } /// /// Compare packed 8-bit integers in a and b, and store packed maximum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_max_epi8(v256 a, v256 b) { return new v256(Sse4_1.max_epi8(a.Lo128, b.Lo128), Sse4_1.max_epi8(a.Hi128, b.Hi128)); } /// /// Compare packed 16-bit integers in a and b, and store packed maximum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_max_epi16(v256 a, v256 b) { return new v256(Sse2.max_epi16(a.Lo128, b.Lo128), Sse2.max_epi16(a.Hi128, b.Hi128)); } /// /// Compare packed 32-bit integers in a and b, and store packed maximum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_max_epi32(v256 a, v256 b) { return new v256(Sse4_1.max_epi32(a.Lo128, b.Lo128), Sse4_1.max_epi32(a.Hi128, b.Hi128)); } /// /// Compare packed unsigned 8-bit integers in a and b, and store packed maximum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_max_epu8(v256 a, v256 b) { return new v256(Sse2.max_epu8(a.Lo128, b.Lo128), Sse2.max_epu8(a.Hi128, b.Hi128)); } /// /// Compare packed unsigned 16-bit integers in a and b, and store packed maximum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_max_epu16(v256 a, v256 b) { return new v256(Sse4_1.max_epu16(a.Lo128, b.Lo128), Sse4_1.max_epu16(a.Hi128, b.Hi128)); } /// /// Compare packed unsigned 32-bit integers in a and b, and store packed maximum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_max_epu32(v256 a, v256 b) { return new v256(Sse4_1.max_epu32(a.Lo128, b.Lo128), Sse4_1.max_epu32(a.Hi128, b.Hi128)); } /// /// Compare packed 8-bit integers in a and b, and store packed minimum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_min_epi8(v256 a, v256 b) { return new v256(Sse4_1.min_epi8(a.Lo128, b.Lo128), Sse4_1.min_epi8(a.Hi128, b.Hi128)); } /// /// Compare packed 16-bit integers in a and b, and store packed minimum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_min_epi16(v256 a, v256 b) { return new v256(Sse2.min_epi16(a.Lo128, b.Lo128), Sse2.min_epi16(a.Hi128, b.Hi128)); } /// /// Compare packed 32-bit integers in a and b, and store packed minimum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_min_epi32(v256 a, v256 b) { return new v256(Sse4_1.min_epi32(a.Lo128, b.Lo128), Sse4_1.min_epi32(a.Hi128, b.Hi128)); } /// /// Compare packed unsigned 8-bit integers in a and b, and store packed minimum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_min_epu8(v256 a, v256 b) { return new v256(Sse2.min_epu8(a.Lo128, b.Lo128), Sse2.min_epu8(a.Hi128, b.Hi128)); } /// /// Compare packed unsigned 16-bit integers in a and b, and store packed minimum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_min_epu16(v256 a, v256 b) { return new v256(Sse4_1.min_epu16(a.Lo128, b.Lo128), Sse4_1.min_epu16(a.Hi128, b.Hi128)); } /// /// Compare packed unsigned 32-bit integers in a and b, and store packed minimum values in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_min_epu32(v256 a, v256 b) { return new v256(Sse4_1.min_epu32(a.Lo128, b.Lo128), Sse4_1.min_epu32(a.Hi128, b.Hi128)); } /// /// Compute the bitwise AND of 256 bits (representing integer data) in a and b, and store the result in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_and_si256(v256 a, v256 b) { return new v256(Sse2.and_si128(a.Lo128, b.Lo128), Sse2.and_si128(a.Hi128, b.Hi128)); } /// /// Compute the bitwise NOT of 256 bits (representing integer data) in a and then AND with b, and store the result in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_andnot_si256(v256 a, v256 b) { return new v256(Sse2.andnot_si128(a.Lo128, b.Lo128), Sse2.andnot_si128(a.Hi128, b.Hi128)); } /// /// Compute the bitwise OR of 256 bits (representing integer data) in a and b, and store the result in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_or_si256(v256 a, v256 b) { return new v256(Sse2.or_si128(a.Lo128, b.Lo128), Sse2.or_si128(a.Hi128, b.Hi128)); } /// /// Compute the bitwise XOR of 256 bits (representing integer data) in a and b, and store the result in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_xor_si256(v256 a, v256 b) { return new v256(Sse2.xor_si128(a.Lo128, b.Lo128), Sse2.xor_si128(a.Hi128, b.Hi128)); } /// /// Compute the absolute value of packed 8-bit integers in a, and store the unsigned results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_abs_epi8(v256 a) { return new v256(Ssse3.abs_epi8(a.Lo128), Ssse3.abs_epi8(a.Hi128)); } /// /// Compute the absolute value of packed 16-bit integers in a, and store the unsigned results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_abs_epi16(v256 a) { return new v256(Ssse3.abs_epi16(a.Lo128), Ssse3.abs_epi16(a.Hi128)); } /// /// Compute the absolute value of packed 32-bit integers in a, and store the unsigned results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_abs_epi32(v256 a) { return new v256(Ssse3.abs_epi32(a.Lo128), Ssse3.abs_epi32(a.Hi128)); } /// /// Add packed 8-bit integers in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_add_epi8(v256 a, v256 b) { return new v256(Sse2.add_epi8(a.Lo128, b.Lo128), Sse2.add_epi8(a.Hi128, b.Hi128)); } /// /// Add packed 16-bit integers in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_add_epi16(v256 a, v256 b) { return new v256(Sse2.add_epi16(a.Lo128, b.Lo128), Sse2.add_epi16(a.Hi128, b.Hi128)); } /// /// Add packed 32-bit integers in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_add_epi32(v256 a, v256 b) { return new v256(Sse2.add_epi32(a.Lo128, b.Lo128), Sse2.add_epi32(a.Hi128, b.Hi128)); } /// /// Add packed 64-bit integers in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_add_epi64(v256 a, v256 b) { return new v256(Sse2.add_epi64(a.Lo128, b.Lo128), Sse2.add_epi64(a.Hi128, b.Hi128)); } /// /// Add packed 8-bit integers in a and b using saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_adds_epi8(v256 a, v256 b) { return new v256(Sse2.adds_epi8(a.Lo128, b.Lo128), Sse2.adds_epi8(a.Hi128, b.Hi128)); } /// /// Add packed 16-bit integers in a and b using saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_adds_epi16(v256 a, v256 b) { return new v256(Sse2.adds_epi16(a.Lo128, b.Lo128), Sse2.adds_epi16(a.Hi128, b.Hi128)); } /// /// Add packed unsigned 8-bit integers in a and b using saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_adds_epu8(v256 a, v256 b) { return new v256(Sse2.adds_epu8(a.Lo128, b.Lo128), Sse2.adds_epu8(a.Hi128, b.Hi128)); } /// /// Add packed unsigned 16-bit integers in a and b using saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_adds_epu16(v256 a, v256 b) { return new v256(Sse2.adds_epu16(a.Lo128, b.Lo128), Sse2.adds_epu16(a.Hi128, b.Hi128)); } /// /// Subtract packed 8-bit integers in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_sub_epi8(v256 a, v256 b) { return new v256(Sse2.sub_epi8(a.Lo128, b.Lo128), Sse2.sub_epi8(a.Hi128, b.Hi128)); } /// /// Subtract packed 16-bit integers in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_sub_epi16(v256 a, v256 b) { return new v256(Sse2.sub_epi16(a.Lo128, b.Lo128), Sse2.sub_epi16(a.Hi128, b.Hi128)); } /// /// Subtract packed 32-bit integers in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_sub_epi32(v256 a, v256 b) { return new v256(Sse2.sub_epi32(a.Lo128, b.Lo128), Sse2.sub_epi32(a.Hi128, b.Hi128)); } /// /// Subtract packed 64-bit integers in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_sub_epi64(v256 a, v256 b) { return new v256(Sse2.sub_epi64(a.Lo128, b.Lo128), Sse2.sub_epi64(a.Hi128, b.Hi128)); } /// /// Subtract packed 8-bit integers in a and b using saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_subs_epi8(v256 a, v256 b) { return new v256(Sse2.subs_epi8(a.Lo128, b.Lo128), Sse2.subs_epi8(a.Hi128, b.Hi128)); } /// /// Subtract packed 16-bit integers in a and b using saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_subs_epi16(v256 a, v256 b) { return new v256(Sse2.subs_epi16(a.Lo128, b.Lo128), Sse2.subs_epi16(a.Hi128, b.Hi128)); } /// /// Subtract packed unsigned 8-bit integers in a and b using saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_subs_epu8(v256 a, v256 b) { return new v256(Sse2.subs_epu8(a.Lo128, b.Lo128), Sse2.subs_epu8(a.Hi128, b.Hi128)); } /// /// Subtract packed unsigned 16-bit integers in a and b using saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_subs_epu16(v256 a, v256 b) { return new v256(Sse2.subs_epu16(a.Lo128, b.Lo128), Sse2.subs_epu16(a.Hi128, b.Hi128)); } /// /// Average packed unsigned 8-bit integers in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_avg_epu8(v256 a, v256 b) { return new v256(Sse2.avg_epu8(a.Lo128, b.Lo128), Sse2.avg_epu8(a.Hi128, b.Hi128)); } /// /// Average packed unsigned 16-bit integers in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_avg_epu16(v256 a, v256 b) { return new v256(Sse2.avg_epu16(a.Lo128, b.Lo128), Sse2.avg_epu16(a.Hi128, b.Hi128)); } /// /// Horizontally add adjacent pairs of 16-bit integers in a and b, and pack the signed 16-bit results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_hadd_epi16(v256 a, v256 b) { return new v256(Ssse3.hadd_epi16(a.Lo128, b.Lo128), Ssse3.hadd_epi16(a.Hi128, b.Hi128)); } /// /// Horizontally add adjacent pairs of 32-bit integers in a and b, and pack the signed 16-bit results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_hadd_epi32(v256 a, v256 b) { return new v256(Ssse3.hadd_epi32(a.Lo128, b.Lo128), Ssse3.hadd_epi32(a.Hi128, b.Hi128)); } /// /// Horizontally add adjacent pairs of 16-bit integers in a and b using saturation, and pack the signed 16-bit results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_hadds_epi16(v256 a, v256 b) { return new v256(Ssse3.hadds_epi16(a.Lo128, b.Lo128), Ssse3.hadds_epi16(a.Hi128, b.Hi128)); } /// /// Horizontally subtract adjacent pairs of 16-bit integers in a and b, and pack the signed 16-bit results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_hsub_epi16(v256 a, v256 b) { return new v256(Ssse3.hsub_epi16(a.Lo128, b.Lo128), Ssse3.hsub_epi16(a.Hi128, b.Hi128)); } /// /// Horizontally subtract adjacent pairs of 32-bit integers in a and b, and pack the signed 16-bit results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_hsub_epi32(v256 a, v256 b) { return new v256(Ssse3.hsub_epi32(a.Lo128, b.Lo128), Ssse3.hsub_epi32(a.Hi128, b.Hi128)); } /// /// Horizontally subtract adjacent pairs of 16-bit integers in a and b using saturation, and pack the signed 16-bit results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_hsubs_epi16(v256 a, v256 b) { return new v256(Ssse3.hsubs_epi16(a.Lo128, b.Lo128), Ssse3.hsubs_epi16(a.Hi128, b.Hi128)); } /// /// Multiply packed signed 16-bit integers in a and b, producing /// intermediate signed 32-bit integers. Horizontally add adjacent /// pairs of intermediate 32-bit integers, and pack the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_madd_epi16(v256 a, v256 b) { return new v256(Sse2.madd_epi16(a.Lo128, b.Lo128), Sse2.madd_epi16(a.Hi128, b.Hi128)); } /// /// Vertically multiply each unsigned 8-bit integer from a with the /// corresponding signed 8-bit integer from b, producing /// intermediate signed 16-bit integers. Horizontally add adjacent /// pairs of intermediate signed 16-bit integers, and pack the /// saturated results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_maddubs_epi16(v256 a, v256 b) { return new v256(Ssse3.maddubs_epi16(a.Lo128, b.Lo128), Ssse3.maddubs_epi16(a.Hi128, b.Hi128)); } /// /// Multiply the packed 16-bit integers in a and b, producing intermediate 32-bit integers, and store the high 16 bits of the intermediate integers in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_mulhi_epi16(v256 a, v256 b) { return new v256(Sse2.mulhi_epi16(a.Lo128, b.Lo128), Sse2.mulhi_epi16(a.Hi128, b.Hi128)); } /// /// Multiply the packed unsigned 16-bit integers in a and b, /// producing intermediate 32-bit integers, and store the high 16 /// bits of the intermediate integers in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_mulhi_epu16(v256 a, v256 b) { return new v256(Sse2.mulhi_epu16(a.Lo128, b.Lo128), Sse2.mulhi_epu16(a.Hi128, b.Hi128)); } /// /// Multiply the packed 16-bit integers in a and b, producing /// intermediate 32-bit integers, and store the low 16 bits of the /// intermediate integers in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_mullo_epi16(v256 a, v256 b) { return new v256(Sse2.mullo_epi16(a.Lo128, b.Lo128), Sse2.mullo_epi16(a.Hi128, b.Hi128)); } /// /// Multiply the packed 32-bit integers in a and b, producing /// intermediate 64-bit integers, and store the low 32 bits of the /// intermediate integers in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_mullo_epi32(v256 a, v256 b) { return new v256(Sse4_1.mullo_epi32(a.Lo128, b.Lo128), Sse4_1.mullo_epi32(a.Hi128, b.Hi128)); } /// /// Multiply the low unsigned 32-bit integers from each packed 64-bit element in a and b, and store the unsigned 64-bit results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_mul_epu32(v256 a, v256 b) { return new v256(Sse2.mul_epu32(a.Lo128, b.Lo128), Sse2.mul_epu32(a.Hi128, b.Hi128)); } /// /// Multiply the low 32-bit integers from each packed 64-bit element in a and b, and store the signed 64-bit results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_mul_epi32(v256 a, v256 b) { return new v256(Sse4_1.mul_epi32(a.Lo128, b.Lo128), Sse4_1.mul_epi32(a.Hi128, b.Hi128)); } /// /// Negate packed 8-bit integers in a when the corresponding signed /// 8-bit integer in b is negative, and store the results in dst. /// Element in dst are zeroed out when the corresponding element in /// b is zero. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_sign_epi8(v256 a, v256 b) { return new v256(Ssse3.sign_epi8(a.Lo128, b.Lo128), Ssse3.sign_epi8(a.Hi128, b.Hi128)); } /// /// Negate packed 16-bit integers in a when the corresponding signed /// 16-bit integer in b is negative, and store the results in dst. /// Element in dst are zeroed out when the corresponding element in /// b is zero. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_sign_epi16(v256 a, v256 b) { return new v256(Ssse3.sign_epi16(a.Lo128, b.Lo128), Ssse3.sign_epi16(a.Hi128, b.Hi128)); } /// /// Negate packed 32-bit integers in a when the corresponding signed /// 32-bit integer in b is negative, and store the results in dst. /// Element in dst are zeroed out when the corresponding element in /// b is zero. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_sign_epi32(v256 a, v256 b) { return new v256(Ssse3.sign_epi32(a.Lo128, b.Lo128), Ssse3.sign_epi32(a.Hi128, b.Hi128)); } /// /// Multiply packed 16-bit integers in a and b, producing /// intermediate signed 32-bit integers. Truncate each intermediate /// integer to the 18 most significant bits, round by adding 1, and /// store bits [16:1] to dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_mulhrs_epi16(v256 a, v256 b) { return new v256(Ssse3.mulhrs_epi16(a.Lo128, b.Lo128), Ssse3.mulhrs_epi16(a.Hi128, b.Hi128)); } /// /// Compute the absolute differences of packed unsigned 8-bit /// integers in a and b, then horizontally sum each consecutive 8 /// differences to produce four unsigned 16-bit integers, and pack /// these unsigned 16-bit integers in the low 16 bits of 64-bit /// elements in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_sad_epu8(v256 a, v256 b) { return new v256(Sse2.sad_epu8(a.Lo128, b.Lo128), Sse2.sad_epu8(a.Hi128, b.Hi128)); } /// /// Compute the sum of absolute differences (SADs) of quadruplets of /// unsigned 8-bit integers in a compared to those in b, and store /// the 16-bit results in dst. Eight SADs are performed for each /// 128-bit lane using one quadruplet from b and eight quadruplets /// from a. One quadruplet is selected from b starting at on the /// offset specified in imm8. Eight quadruplets are formed from /// sequential 8-bit integers selected from a starting at the offset /// specified in imm8. /// /// Vector a /// Vector b /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_mpsadbw_epu8(v256 a, v256 b, int imm8) { return new v256(Sse4_1.mpsadbw_epu8(a.Lo128, b.Lo128, imm8 & 7), Sse4_1.mpsadbw_epu8(a.Hi128, b.Hi128, (imm8 >> 3) & 7)); } /// /// Shift 128-bit lanes in a left by imm8 bytes while shifting in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_slli_si256(v256 a, int imm8) { return new v256(Sse2.slli_si128(a.Lo128, imm8), Sse2.slli_si128(a.Hi128, imm8)); } // This is just a #define alias /// /// Shift 128-bit lanes in a left by imm8 bytes while shifting in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_bslli_epi128(v256 a, int imm8) { return mm256_slli_si256(a, imm8); } /// /// Shift 128-bit lanes in a right by imm8 bytes while shifting in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_srli_si256(v256 a, int imm8) { return new v256(Sse2.srli_si128(a.Lo128, imm8), Sse2.srli_si128(a.Hi128, imm8)); } // This is just a #define alias /// /// Shift 128-bit lanes in a right by imm8 bytes while shifting in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_bsrli_epi128(v256 a, int imm8) { return mm256_srli_si256(a, imm8); } /// /// Shift packed 16-bit integers in a left by count while shifting /// in zeros, and store the results in dst. /// /// Vector a /// Shift amount /// Vector [DebuggerStepThrough] public static v256 mm256_sll_epi16(v256 a, v128 count) { return new v256(Sse2.sll_epi16(a.Lo128, count), Sse2.sll_epi16(a.Hi128, count)); } /// /// Shift packed 32-bit integers in a left by count while shifting /// in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_sll_epi32(v256 a, v128 count) { return new v256(Sse2.sll_epi32(a.Lo128, count), Sse2.sll_epi32(a.Hi128, count)); } /// /// Shift packed 64-bit integers in a left by count while shifting /// in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_sll_epi64(v256 a, v128 count) { return new v256(Sse2.sll_epi64(a.Lo128, count), Sse2.sll_epi64(a.Hi128, count)); } /// /// Shift packed 16-bit integers in a left by imm8 while shifting in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_slli_epi16(v256 a, int imm8) { return new v256(Sse2.slli_epi16(a.Lo128, imm8), Sse2.slli_epi16(a.Hi128, imm8)); } /// /// Shift packed 32-bit integers in a left by imm8 while shifting in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_slli_epi32(v256 a, int imm8) { return new v256(Sse2.slli_epi32(a.Lo128, imm8), Sse2.slli_epi32(a.Hi128, imm8)); } /// /// Shift packed 64-bit integers in a left by imm8 while shifting in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_slli_epi64(v256 a, int imm8) { return new v256(Sse2.slli_epi64(a.Lo128, imm8), Sse2.slli_epi64(a.Hi128, imm8)); } /// /// Shift packed 32-bit integers in a left by the amount specified /// by the corresponding element in count while shifting in zeros, /// and store the results in dst. /// /// Vector a /// Corresponding element /// Vector [DebuggerStepThrough] public static v256 mm256_sllv_epi32(v256 a, v256 count) { return new v256(sllv_epi32(a.Lo128, count.Lo128), sllv_epi32(a.Hi128, count.Hi128)); } /// /// Shift packed 64-bit integers in a left by the amount specified /// by the corresponding element in count while shifting in zeros, /// and store the results in dst. /// /// Vector a /// Corresponding element /// Vector [DebuggerStepThrough] public static v256 mm256_sllv_epi64(v256 a, v256 count) { return new v256(sllv_epi64(a.Lo128, count.Lo128), sllv_epi64(a.Hi128, count.Hi128)); } /// /// Shift packed 32-bit integers in a left by the amount specified /// by the corresponding element in count while shifting in zeros, /// and store the results in dst. /// /// Vector a /// Corresponding element /// Vector [DebuggerStepThrough] public static v128 sllv_epi32(v128 a, v128 count) { v128 dst = default; uint* aptr = &a.UInt0; uint* dptr = &dst.UInt0; int* sptr = &count.SInt0; for (int i = 0; i < 4; ++i) { int shift = sptr[i]; if (shift >= 0 && shift <= 31) { dptr[i] = aptr[i] << shift; } else { dptr[i] = 0; } } return dst; } /// /// Shift packed 64-bit integers in a left by the amount specified /// by the corresponding element in count while shifting in zeros, /// and store the results in dst. /// /// Vector a /// Corresponding element /// Vector [DebuggerStepThrough] public static v128 sllv_epi64(v128 a, v128 count) { v128 dst = default; ulong* aptr = &a.ULong0; ulong* dptr = &dst.ULong0; long* sptr = &count.SLong0; for (int i = 0; i < 2; ++i) { int shift = (int)sptr[i]; if (shift >= 0 && shift <= 63) { dptr[i] = aptr[i] << shift; } else { dptr[i] = 0; } } return dst; } /// /// Shift packed 16-bit integers in a right by count while shifting in sign bits, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_sra_epi16(v256 a, v128 count) { return new v256(Sse2.sra_epi16(a.Lo128, count), Sse2.sra_epi16(a.Hi128, count)); } /// /// Shift packed 32-bit integers in a right by count while shifting in sign bits, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_sra_epi32(v256 a, v128 count) { return new v256(Sse2.sra_epi32(a.Lo128, count), Sse2.sra_epi32(a.Hi128, count)); } /// /// Shift packed 16-bit integers in a right by imm8 while shifting in sign bits, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_srai_epi16(v256 a, int imm8) { return new v256(Sse2.srai_epi16(a.Lo128, imm8), Sse2.srai_epi16(a.Hi128, imm8)); } /// /// Shift packed 32-bit integers in a right by imm8 while shifting in sign bits, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_srai_epi32(v256 a, int imm8) { return new v256(Sse2.srai_epi32(a.Lo128, imm8), Sse2.srai_epi32(a.Hi128, imm8)); } /// /// Shift packed 32-bit integers in a right by the amount specified /// by the corresponding element in count while shifting in sign /// bits, and store the results in dst. /// /// Vector a /// Corresponding element /// Vector [DebuggerStepThrough] public static v256 mm256_srav_epi32(v256 a, v256 count) { return new v256(srav_epi32(a.Lo128, count.Lo128), srav_epi32(a.Hi128, count.Hi128)); } /// /// Shift packed 32-bit integers in a right by the amount specified /// by the corresponding element in count while shifting in sign /// bits, and store the results in dst. /// /// Vector a /// Corresponding element /// Vector [DebuggerStepThrough] public static v128 srav_epi32(v128 a, v128 count) { v128 dst = default; int* aptr = &a.SInt0; int* dptr = &dst.SInt0; int* sptr = &count.SInt0; for (int i = 0; i < 4; ++i) { // Work around modulo 32 shifts on the general register file int shift1 = Math.Min(sptr[i] & 0xff, 32); int shift2 = 0; if (shift1 >= 16) { shift1 -= 16; shift2 += 16; } dptr[i] = (aptr[i] >> shift1) >> shift2; } return dst; } /// /// Shift packed 16-bit integers in a right by count while shifting /// in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_srl_epi16(v256 a, v128 count) { return new v256(Sse2.srl_epi16(a.Lo128, count), Sse2.srl_epi16(a.Hi128, count)); } /// /// Shift packed 32-bit integers in a right by count while shifting /// in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_srl_epi32(v256 a, v128 count) { return new v256(Sse2.srl_epi32(a.Lo128, count), Sse2.srl_epi32(a.Hi128, count)); } /// /// Shift packed 64-bit integers in a right by count while shifting /// in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_srl_epi64(v256 a, v128 count) { return new v256(Sse2.srl_epi64(a.Lo128, count), Sse2.srl_epi64(a.Hi128, count)); } /// /// Shift packed 16-bit integers in a right by imm8 while shifting in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_srli_epi16(v256 a, int imm8) { return new v256(Sse2.srli_epi16(a.Lo128, imm8), Sse2.srli_epi16(a.Hi128, imm8)); } /// /// Shift packed 32-bit integers in a right by imm8 while shifting in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_srli_epi32(v256 a, int imm8) { return new v256(Sse2.srli_epi32(a.Lo128, imm8), Sse2.srli_epi32(a.Hi128, imm8)); } /// /// Shift packed 64-bit integers in a right by imm8 while shifting in zeros, and store the results in dst. /// /// Vector a /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_srli_epi64(v256 a, int imm8) { return new v256(Sse2.srli_epi64(a.Lo128, imm8), Sse2.srli_epi64(a.Hi128, imm8)); } /// /// Shift packed 32-bit integers in a right by the amount specified /// by the corresponding element in count while shifting in zeros, /// and store the results in dst. /// /// Vector a /// Corresponding element /// Vector [DebuggerStepThrough] public static v256 mm256_srlv_epi32(v256 a, v256 count) { return new v256(srlv_epi32(a.Lo128, count.Lo128), srlv_epi32(a.Hi128, count.Hi128)); } /// /// Shift packed 64-bit integers in a right by the amount specified /// by the corresponding element in count while shifting in zeros, /// and store the results in dst. /// /// Vector a /// Corresponding element /// Vector [DebuggerStepThrough] public static v256 mm256_srlv_epi64(v256 a, v256 count) { return new v256(srlv_epi64(a.Lo128, count.Lo128), srlv_epi64(a.Hi128, count.Hi128)); } /// /// Shift packed 32-bit integers in a right by the amount specified /// by the corresponding element in count while shifting in zeros, /// and store the results in dst. /// /// Vector a /// Corresponding element /// Vector [DebuggerStepThrough] public static v128 srlv_epi32(v128 a, v128 count) { v128 dst = default; uint* aptr = &a.UInt0; uint* dptr = &dst.UInt0; int* sptr = &count.SInt0; for (int i = 0; i < 4; ++i) { int shift = sptr[i]; if (shift >= 0 && shift <= 31) { dptr[i] = aptr[i] >> shift; } else { dptr[i] = 0; } } return dst; } /// /// Shift packed 64-bit integers in a right by the amount specified /// by the corresponding element in count while shifting in zeros, /// and store the results in dst. /// /// Vector a /// Corresponding element /// Vector [DebuggerStepThrough] public static v128 srlv_epi64(v128 a, v128 count) { v128 dst = default; ulong* aptr = &a.ULong0; ulong* dptr = &dst.ULong0; long* sptr = &count.SLong0; for (int i = 0; i < 2; ++i) { int shift = (int)sptr[i]; if (shift >= 0 && shift <= 63) { dptr[i] = aptr[i] >> shift; } else { dptr[i] = 0; } } return dst; } /// /// Blend packed 32-bit integers from a and b using control mask imm8, and store the results in dst. /// /// Vector a /// Vector b /// Control mask /// Vector [DebuggerStepThrough] public static v128 blend_epi32(v128 a, v128 b, int imm8) { return Sse4_1.blend_ps(a, b, imm8); } /// /// Blend packed 32-bit integers from a and b using control mask imm8, and store the results in dst. /// /// Vector a /// Vector b /// Control mask /// Vector [DebuggerStepThrough] public static v256 mm256_blend_epi32(v256 a, v256 b, int imm8) { return Avx.mm256_blend_ps(a, b, imm8); } /// /// Concatenate pairs of 16-byte blocks in a and b into a 32-byte temporary result, shift the result right by imm8 bytes, and store the low 16 bytes in dst. /// /// Vector a /// Vector b /// Offset /// Vector [DebuggerStepThrough] public static v256 mm256_alignr_epi8(v256 a, v256 b, int imm8) { return new v256(Ssse3.alignr_epi8(a.Lo128, b.Lo128, imm8), Ssse3.alignr_epi8(a.Hi128, b.Hi128, imm8)); } /// /// Blend packed 8-bit integers from a and b using mask, and store the results in dst. /// /// Vector a /// Vector b /// Mask /// Vector [DebuggerStepThrough] public static v256 mm256_blendv_epi8(v256 a, v256 b, v256 mask) { return new v256(Sse4_1.blendv_epi8(a.Lo128, b.Lo128, mask.Lo128), Sse4_1.blendv_epi8(a.Hi128, b.Hi128, mask.Hi128)); } /// /// Blend packed 16-bit integers from a and b within 128-bit lanes using control mask imm8, and store the results in dst. /// /// Vector a /// Vector b /// Control mask /// Vector [DebuggerStepThrough] public static v256 mm256_blend_epi16(v256 a, v256 b, int imm8) { return new v256(Sse4_1.blend_epi16(a.Lo128, b.Lo128, imm8), Sse4_1.blend_epi16(a.Hi128, b.Hi128, imm8)); } /// /// Convert packed 16-bit integers from a and b to packed 8-bit integers using signed saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_packs_epi16(v256 a, v256 b) { return new v256(Sse2.packs_epi16(a.Lo128, b.Lo128), Sse2.packs_epi16(a.Hi128, b.Hi128)); } /// /// Convert packed 32-bit integers from a and b to packed 16-bit integers using signed saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_packs_epi32(v256 a, v256 b) { return new v256(Sse2.packs_epi32(a.Lo128, b.Lo128), Sse2.packs_epi32(a.Hi128, b.Hi128)); } /// /// Convert packed 16-bit integers from a and b to packed 8-bit integers using unsigned saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_packus_epi16(v256 a, v256 b) { return new v256(Sse2.packus_epi16(a.Lo128, b.Lo128), Sse2.packus_epi16(a.Hi128, b.Hi128)); } /// /// Convert packed 32-bit integers from a and b to packed 16-bit integers using unsigned saturation, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_packus_epi32(v256 a, v256 b) { return new v256(Sse4_1.packus_epi32(a.Lo128, b.Lo128), Sse4_1.packus_epi32(a.Hi128, b.Hi128)); } /// /// Unpack and interleave 8-bit integers from the high half of each 128-bit lane in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_unpackhi_epi8(v256 a, v256 b) { return new v256(Sse2.unpackhi_epi8(a.Lo128, b.Lo128), Sse2.unpackhi_epi8(a.Hi128, b.Hi128)); } /// /// Unpack and interleave 16-bit integers from the high half of each 128-bit lane in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_unpackhi_epi16(v256 a, v256 b) { return new v256(Sse2.unpackhi_epi16(a.Lo128, b.Lo128), Sse2.unpackhi_epi16(a.Hi128, b.Hi128)); } /// /// Unpack and interleave 32-bit integers from the high half of each 128-bit lane in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_unpackhi_epi32(v256 a, v256 b) { return new v256(Sse2.unpackhi_epi32(a.Lo128, b.Lo128), Sse2.unpackhi_epi32(a.Hi128, b.Hi128)); } /// /// Unpack and interleave 64-bit integers from the high half of each 128-bit lane in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_unpackhi_epi64(v256 a, v256 b) { return new v256(Sse2.unpackhi_epi64(a.Lo128, b.Lo128), Sse2.unpackhi_epi64(a.Hi128, b.Hi128)); } /// /// Unpack and interleave 8-bit integers from the low half of each 128-bit lane in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_unpacklo_epi8(v256 a, v256 b) { return new v256(Sse2.unpacklo_epi8(a.Lo128, b.Lo128), Sse2.unpacklo_epi8(a.Hi128, b.Hi128)); } /// /// Unpack and interleave 16-bit integers from the low half of each 128-bit lane in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_unpacklo_epi16(v256 a, v256 b) { return new v256(Sse2.unpacklo_epi16(a.Lo128, b.Lo128), Sse2.unpacklo_epi16(a.Hi128, b.Hi128)); } /// /// Unpack and interleave 32-bit integers from the low half of each 128-bit lane in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_unpacklo_epi32(v256 a, v256 b) { return new v256(Sse2.unpacklo_epi32(a.Lo128, b.Lo128), Sse2.unpacklo_epi32(a.Hi128, b.Hi128)); } /// /// Unpack and interleave 64-bit integers from the low half of each 128-bit lane in a and b, and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_unpacklo_epi64(v256 a, v256 b) { return new v256(Sse2.unpacklo_epi64(a.Lo128, b.Lo128), Sse2.unpacklo_epi64(a.Hi128, b.Hi128)); } /// /// Shuffle 8-bit integers in a within 128-bit lanes according to /// shuffle control mask in the corresponding 8-bit element of b, /// and store the results in dst. /// /// Vector a /// Vector b /// Vector [DebuggerStepThrough] public static v256 mm256_shuffle_epi8(v256 a, v256 b) { return new v256(Ssse3.shuffle_epi8(a.Lo128, b.Lo128), Ssse3.shuffle_epi8(a.Hi128, b.Hi128)); } /// /// Shuffle 32-bit integers in a within 128-bit lanes using the control in imm8, and store the results in dst. /// /// Vector a /// Control /// Vector [DebuggerStepThrough] public static v256 mm256_shuffle_epi32(v256 a, int imm8) { return new v256(Sse2.shuffle_epi32(a.Lo128, imm8), Sse2.shuffle_epi32(a.Hi128, imm8)); } /// /// Shuffle 16-bit integers in the high 64 bits of 128-bit lanes of /// a using the control in imm8. Store the results in the high 64 /// bits of 128-bit lanes of dst, with the low 64 bits of 128-bit /// lanes being copied from from a to dst. /// /// Vector a /// Control /// Vector [DebuggerStepThrough] public static v256 mm256_shufflehi_epi16(v256 a, int imm8) { return new v256(Sse2.shufflehi_epi16(a.Lo128, imm8), Sse2.shufflehi_epi16(a.Hi128, imm8)); } /// /// Shuffle 16-bit integers in the low 64 bits of 128-bit lanes of /// a using the control in imm8. Store the results in the low 64 /// bits of 128-bit lanes of dst, with the high 64 bits of 128-bit /// lanes being copied from from a to dst. /// /// Vector a /// Control /// Vector [DebuggerStepThrough] public static v256 mm256_shufflelo_epi16(v256 a, int imm8) { return new v256(Sse2.shufflelo_epi16(a.Lo128, imm8), Sse2.shufflelo_epi16(a.Hi128, imm8)); } /// /// Extract 128 bits (composed of integer data) from a, selected with imm8, and store the result in dst. /// /// Vector a /// Selection /// Vector [DebuggerStepThrough] public static v128 mm256_extracti128_si256(v256 a, int imm8) { // Burst IR is fine. return Avx.mm256_extractf128_si256(a, imm8); } /// /// Copy a to dst, then insert 128 bits (composed of integer data) from b into dst at the location specified by imm8. /// /// Vector a /// Vector b /// Location /// Vector [DebuggerStepThrough] public static v256 mm256_inserti128_si256(v256 a, v128 b, int imm8) { // Burst IR is fine. return Avx.mm256_insertf128_ps(a, b, imm8); } /// /// Broadcast the low single-precision (32-bit) floating-point element from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v128 broadcastss_ps(v128 a) { return new v128(a.Float0); } /// /// Broadcast the low single-precision (32-bit) floating-point element from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_broadcastss_ps(v128 a) { return new v256(a.Float0); } /// /// Broadcast the low double-precision (64-bit) floating-point element from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v128 broadcastsd_pd(v128 a) { return new v128(a.Double0); } /// /// Broadcast the low double-precision (64-bit) floating-point element from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_broadcastsd_pd(v128 a) { return new v256(a.Double0); } /// /// Broadcast the low packed 8-bit integer from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v128 broadcastb_epi8(v128 a) { return new v128(a.Byte0); } /// /// Broadcast the low packed 16-bit integer from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v128 broadcastw_epi16(v128 a) { return new v128(a.SShort0); } /// /// Broadcast the low packed 32-bit integer from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v128 broadcastd_epi32(v128 a) { return new v128(a.SInt0); } /// /// Broadcast the low packed 64-bit integer from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v128 broadcastq_epi64(v128 a) { return new v128(a.SLong0); } /// /// Broadcast the low packed 8-bit integer from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_broadcastb_epi8(v128 a) { return new v256(a.Byte0); } /// /// Broadcast the low packed 16-bit integer from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_broadcastw_epi16(v128 a) { return new v256(a.SShort0); } /// /// Broadcast the low packed 32-bit integer from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_broadcastd_epi32(v128 a) { return new v256(a.SInt0); } /// /// Broadcast the low packed 64-bit integer from a to all elements of dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_broadcastq_epi64(v128 a) { return new v256(a.SLong0); } /// /// Broadcast 128 bits of integer data from a to all 128-bit lanes in dst /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_broadcastsi128_si256(v128 a) { // Burst IR is fine return new v256(a, a); } /// /// Sign extend packed 8-bit integers in a to packed 16-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepi8_epi16(v128 a) { v256 dst = default; short* dptr = &dst.SShort0; sbyte* aptr = &a.SByte0; for (int j = 0; j <= 15; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed 8-bit integers in a to packed 32-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepi8_epi32(v128 a) { v256 dst = default; int* dptr = &dst.SInt0; sbyte* aptr = &a.SByte0; for (int j = 0; j <= 7; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed 8-bit integers in a to packed 64-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepi8_epi64(v128 a) { v256 dst = default; long* dptr = &dst.SLong0; sbyte* aptr = &a.SByte0; for (int j = 0; j <= 3; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed 16-bit integers in a to packed 32-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepi16_epi32(v128 a) { v256 dst = default; int* dptr = &dst.SInt0; short* aptr = &a.SShort0; for (int j = 0; j <= 7; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed 16-bit integers in a to packed 64-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepi16_epi64(v128 a) { v256 dst = default; long* dptr = &dst.SLong0; short* aptr = &a.SShort0; for (int j = 0; j <= 3; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed 32-bit integers in a to packed 64-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepi32_epi64(v128 a) { v256 dst = default; long* dptr = &dst.SLong0; int* aptr = &a.SInt0; for (int j = 0; j <= 3; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed unsigned 8-bit integers in a to packed 16-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepu8_epi16(v128 a) { v256 dst = default; short* dptr = &dst.SShort0; byte* aptr = &a.Byte0; for (int j = 0; j <= 15; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed unsigned 8-bit integers in a to packed 32-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepu8_epi32(v128 a) { v256 dst = default; int* dptr = &dst.SInt0; byte* aptr = &a.Byte0; for (int j = 0; j <= 7; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed unsigned 8-bit integers in a to packed 64-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepu8_epi64(v128 a) { v256 dst = default; long* dptr = &dst.SLong0; byte* aptr = &a.Byte0; for (int j = 0; j <= 3; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed unsigned 16-bit integers in a to packed 32-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepu16_epi32(v128 a) { v256 dst = default; int* dptr = &dst.SInt0; ushort* aptr = &a.UShort0; for (int j = 0; j <= 7; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed unsigned 16-bit integers in a to packed 64-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepu16_epi64(v128 a) { v256 dst = default; long* dptr = &dst.SLong0; ushort* aptr = &a.UShort0; for (int j = 0; j <= 3; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Sign extend packed unsigned 32-bit integers in a to packed 64-bit integers, and store the results in dst. /// /// Vector a /// Vector [DebuggerStepThrough] public static v256 mm256_cvtepu32_epi64(v128 a) { v256 dst = default; long* dptr = &dst.SLong0; uint* aptr = &a.UInt0; for (int j = 0; j <= 3; j++) { dptr[j] = aptr[j]; } return dst; } /// /// Load packed 32-bit integers from memory into dst using mask /// (elements are zeroed out when the highest bit is not set in the /// corresponding element). /// /// Memory address /// Mask /// Vector [DebuggerStepThrough] public static v128 maskload_epi32(void* mem_addr, v128 mask) { v128 dst = default; int* sptr = (int*)mem_addr; int* mptr = &mask.SInt0; int* dptr = &dst.SInt0; for (int i = 0; i < 4; ++i) { if (mptr[i] < 0) { dptr[i] = sptr[i]; } } return dst; } /// /// Load packed 64-bit integers from memory into dst using mask /// (elements are zeroed out when the highest bit is not set in the /// corresponding element). /// /// Memory address /// Mask /// Vector [DebuggerStepThrough] public static v128 maskload_epi64(void* mem_addr, v128 mask) { v128 dst = default; long* sptr = (long*)mem_addr; long* mptr = &mask.SLong0; long* dptr = &dst.SLong0; for (int i = 0; i < 2; ++i) { if (mptr[i] < 0) { dptr[i] = sptr[i]; } } return dst; } /// /// Store packed 32-bit integers from a into memory using mask /// (elements are not stored when the highest bit is not set in the /// corresponding element). /// /// Memory address /// Mask /// Vector a [DebuggerStepThrough] public static void maskstore_epi32(void* mem_addr, v128 mask, v128 a) { int* dptr = (int*)mem_addr; int* mptr = &mask.SInt0; int* sptr = &a.SInt0; for (int i = 0; i < 4; ++i) { if (mptr[i] < 0) { dptr[i] = sptr[i]; } } } /// /// Store packed 64-bit integers from a into memory using mask /// (elements are not stored when the highest bit is not set in the /// corresponding element). /// /// Memory address /// Mask /// Vector a [DebuggerStepThrough] public static void maskstore_epi64(void* mem_addr, v128 mask, v128 a) { long* dptr = (long*)mem_addr; long* mptr = &mask.SLong0; long* sptr = &a.SLong0; for (int i = 0; i < 2; ++i) { if (mptr[i] < 0) { dptr[i] = sptr[i]; } } } /// /// Load packed 32-bit integers from memory into dst using mask /// (elements are zeroed out when the highest bit is not set in the /// corresponding element). /// /// Memory address /// Mask /// Vector [DebuggerStepThrough] public static v256 mm256_maskload_epi32(void* mem_addr, v256 mask) { v256 dst = default; int* sptr = (int*)mem_addr; int* mptr = &mask.SInt0; int* dptr = &dst.SInt0; for (int i = 0; i < 8; ++i) { if (mptr[i] < 0) { dptr[i] = sptr[i]; } } return dst; } /// /// Load packed 64-bit integers from memory into dst using mask /// (elements are zeroed out when the highest bit is not set in the /// corresponding element). /// /// Memory address /// Mask /// Vector [DebuggerStepThrough] public static v256 mm256_maskload_epi64(void* mem_addr, v256 mask) { v256 dst = default; long* sptr = (long*)mem_addr; long* mptr = &mask.SLong0; long* dptr = &dst.SLong0; for (int i = 0; i < 4; ++i) { if (mptr[i] < 0) { dptr[i] = sptr[i]; } } return dst; } /// /// Store packed 32-bit integers from a into memory using mask /// (elements are not stored when the highest bit is not set in the /// corresponding element). /// /// Memory address /// Mask /// Vector a [DebuggerStepThrough] public static void mm256_maskstore_epi32(void* mem_addr, v256 mask, v256 a) { int* dptr = (int*)mem_addr; int* mptr = &mask.SInt0; int* sptr = &a.SInt0; for (int i = 0; i < 8; ++i) { if (mptr[i] < 0) { dptr[i] = sptr[i]; } } } /// /// Store packed 64-bit integers from a into memory using mask /// (elements are not stored when the highest bit is not set in the /// corresponding element). /// /// Memory address /// Mask /// Vector a [DebuggerStepThrough] public static void mm256_maskstore_epi64(void* mem_addr, v256 mask, v256 a) { long* dptr = (long*)mem_addr; long* mptr = &mask.SLong0; long* sptr = &a.SLong0; for (int i = 0; i < 4; ++i) { if (mptr[i] < 0) { dptr[i] = sptr[i]; } } } /// /// Shuffle 32-bit integers in a across lanes using the corresponding index in idx, and store the results in dst. /// /// Vector a /// idx /// Vector [DebuggerStepThrough] public static v256 mm256_permutevar8x32_epi32(v256 a, v256 idx) { v256 dst = default; int* iptr = &idx.SInt0; int* aptr = &a.SInt0; int* dptr = &dst.SInt0; for (int i = 0; i < 8; ++i) { int index = iptr[i] & 7; dptr[i] = aptr[index]; } return dst; } /// /// Shuffle single-precision (32-bit) floating-point elements in a across lanes using the corresponding index in idx. /// /// Vector a /// idx /// Vector [DebuggerStepThrough] public static v256 mm256_permutevar8x32_ps(v256 a, v256 idx) { return mm256_permutevar8x32_epi32(a, idx); } /// /// Shuffle 64-bit integers in a across lanes using the control in imm8, and store the results in dst. /// /// Vector a /// Control /// Vector [DebuggerStepThrough] public static v256 mm256_permute4x64_epi64(v256 a, int imm8) { v256 dst = default; long* aptr = &a.SLong0; long* dptr = &dst.SLong0; for (int i = 0; i < 4; ++i, imm8 >>= 2) { dptr[i] = aptr[imm8 & 3]; } return dst; } /// /// Shuffle double-precision (64-bit) floating-point elements in a across lanes using the control in imm8, and store the results in dst. /// /// Vector a /// Control /// Vector [DebuggerStepThrough] public static v256 mm256_permute4x64_pd(v256 a, int imm8) { return mm256_permute4x64_epi64(a, imm8); } /// /// Shuffle 128-bits (composed of integer data) selected by imm8 from a and b, and store the results in dst. /// /// Vector a /// Vector b /// Selection /// Vector [DebuggerStepThrough] public static v256 mm256_permute2x128_si256(v256 a, v256 b, int imm8) { return Avx.mm256_permute2f128_si256(a, b, imm8); } /// /// Load 256-bits of integer data from memory into dst using a /// non-temporal memory hint. mem_addr must be aligned on a 32-byte /// boundary or a general-protection exception may be generated. /// /// Memory address /// Vector [DebuggerStepThrough] public static v256 mm256_stream_load_si256(void* mem_addr) { return *(v256*)mem_addr; } private static void EmulatedGather(T* dptr, void* base_addr, long* indexPtr, int scale, int n, U* mask) where T : unmanaged where U : unmanaged, IComparable { U maskZero = default; for (int i = 0; i < n; ++i) { long baseIndex = indexPtr[i]; long offset = baseIndex * scale; T* mem_addr = (T*)((byte*)base_addr + offset); if (mask == null || mask[i].CompareTo(maskZero) < 0) { dptr[i] = *mem_addr; } } } private static void EmulatedGather(T* dptr, void* base_addr, int* indexPtr, int scale, int n, U* mask) where T : unmanaged where U : unmanaged, IComparable { U maskZero = default; for (int i = 0; i < n; ++i) { long baseIndex = indexPtr[i]; long offset = baseIndex * scale; T* mem_addr = (T*)((byte*)base_addr + offset); if (mask == null || mask[i].CompareTo(maskZero) < 0) { dptr[i] = *mem_addr; } } } /// /// Gather 32-bit integers from memory using 32-bit indices. 32-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 32-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst. /// scale should be 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_i32gather_epi32(void* base_addr, v256 vindex, int scale) { v256 dst = default; EmulatedGather(&dst.SInt0, base_addr, &vindex.SInt0, scale, sizeof(v256) / sizeof(int), (int*)null); return dst; } /// /// Gather double-precision (64-bit) floating-point elements from /// memory using 32-bit indices. 64-bit elements are loaded from /// addresses starting at base_addr and offset by each 32-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst. scale should be /// 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_i32gather_pd(void* base_addr, v128 vindex, int scale) { v256 dst = default; EmulatedGather(&dst.Double0, base_addr, &vindex.SInt0, scale, 4, null); return dst; } /// /// Gather single-precision (32-bit) floating-point elements from /// memory using 32-bit indices. 32-bit elements are loaded from /// addresses starting at base_addr and offset by each 32-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst using mask /// (elements are copied from src when the highest bit is not set /// in the corresponding element). scale should be 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_i32gather_ps(void* base_addr, v256 vindex, int scale) { v256 dst = default; EmulatedGather(&dst.Float0, base_addr, &vindex.SInt0, scale, 8, null); return dst; } /// /// Gather double-precision (64-bit) floating-point elements from /// memory using 64-bit indices. 64-bit elements are loaded from /// addresses starting at base_addr and offset by each 64-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst. scale should be /// 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_i64gather_pd(void* base_addr, v256 vindex, int scale) { v256 dst = default; EmulatedGather(&dst.Double0, base_addr, &vindex.SLong0, scale, 4, null); return dst; } /// /// Gather single-precision (32-bit) floating-point elements from /// memory using 64-bit indices. 32-bit elements are loaded from /// addresses starting at base_addr and offset by each 64-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst. scale should be /// 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v128 mm256_i64gather_ps(void* base_addr, v256 vindex, int scale) { v128 dst = default; EmulatedGather(&dst.Float0, base_addr, &vindex.SLong0, scale, 4, null); return dst; } /// /// Gather double-precision (64-bit) floating-point elements from /// memory using 32-bit indices. 64-bit elements are loaded from /// addresses starting at base_addr and offset by each 32-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst. scale should be /// 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v128 i32gather_pd(void* base_addr, v128 vindex, int scale) { v128 dst = default; EmulatedGather(&dst.Double0, base_addr, &vindex.SInt0, scale, 2, null); return dst; } /// /// Gather single-precision (32-bit) floating-point elements from /// memory using 32-bit indices. 32-bit elements are loaded from /// addresses starting at base_addr and offset by each 32-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst. scale should be /// 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v128 i32gather_ps(void* base_addr, v128 vindex, int scale) { v128 dst = default; EmulatedGather(&dst.Float0, base_addr, &vindex.SInt0, scale, 4, null); return dst; } /// /// Gather double-precision (64-bit) floating-point elements from /// memory using 64-bit indices. 64-bit elements are loaded from /// addresses starting at base_addr and offset by each 64-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst. scale should be /// 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v128 i64gather_pd(void* base_addr, v128 vindex, int scale) { v128 dst = default; EmulatedGather(&dst.Double0, base_addr, &vindex.SLong0, scale, 2, null); return dst; } /// /// Gather single-precision (32-bit) floating-point elements from /// memory using 64-bit indices. 32-bit elements are loaded from /// addresses starting at base_addr and offset by each 64-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst. scale should be /// 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v128 i64gather_ps(void* base_addr, v128 vindex, int scale) { v128 dst = default; EmulatedGather(&dst.Float0, base_addr, &vindex.SLong0, scale, 2, null); return dst; } /// /// Gather 64-bit integers from memory using 32-bit indices. 64-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 32-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst. /// scale should be 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_i32gather_epi64(void* base_addr, v128 vindex, int scale) { v256 dst = default; EmulatedGather(&dst.SLong0, base_addr, &vindex.SInt0, scale, 4, null); return dst; } /// /// Gather 32-bit integers from memory using 64-bit indices. 32-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 64-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst. /// scale should be 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v128 mm256_i64gather_epi32(void* base_addr, v256 vindex, int scale) { v128 dst = default; EmulatedGather(&dst.SInt0, base_addr, &vindex.SLong0, scale, 4, null); return dst; } /// /// Gather 64-bit integers from memory using 64-bit indices. 64-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 64-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst. /// scale should be 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_i64gather_epi64(void* base_addr, v256 vindex, int scale) { v256 dst = default; EmulatedGather(&dst.SLong0, base_addr, &vindex.SLong0, scale, 4, null); return dst; } /// /// Gather 32-bit integers from memory using 32-bit indices. 32-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 32-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst. /// scale should be 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v128 i32gather_epi32(void* base_addr, v128 vindex, int scale) { v128 dst = default; EmulatedGather(&dst.SInt0, base_addr, &vindex.SInt0, scale, 4, null); return dst; } /// /// Gather 64-bit integers from memory using 32-bit indices. 64-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 32-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst. /// scale should be 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v128 i32gather_epi64(void* base_addr, v128 vindex, int scale) { v128 dst = default; EmulatedGather(&dst.SLong0, base_addr, &vindex.SInt0, scale, 2, null); return dst; } /// /// Gather 32-bit integers from memory using 64-bit indices. 32-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 64-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst. /// scale should be 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v128 i64gather_epi32(void* base_addr, v128 vindex, int scale) { v128 dst = default; EmulatedGather(&dst.SInt0, base_addr, &vindex.SLong0, scale, 2, null); return dst; } /// /// Gather 64-bit integers from memory using 64-bit indices. 64-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 64-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst. /// scale should be 1, 2, 4 or 8. /// /// Base address /// Offset /// Index scale /// Vector [DebuggerStepThrough] public static v128 i64gather_epi64(void* base_addr, v128 vindex, int scale) { v128 dst = default; EmulatedGather(&dst.SLong0, base_addr, &vindex.SLong0, scale, 2, null); return dst; } /// /// Gather double-precision (64-bit) floating-point elements from /// memory using 32-bit indices. 64-bit elements are loaded from /// addresses starting at base_addr and offset by each 32-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst using mask /// (elements are copied from src when the highest bit is not set /// in the corresponding element). scale should be 1, 2, 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_mask_i32gather_pd(v256 src, void* base_addr, v128 vindex, v256 mask, int scale) { v256 dst = src; EmulatedGather(&dst.Double0, base_addr, &vindex.SInt0, scale, 4, &mask.SLong0); return dst; } /// /// Gather single-precision (32-bit) floating-point elements from /// memory using 32-bit indices. 32-bit elements are loaded from /// addresses starting at base_addr and offset by each 32-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst using mask /// (elements are copied from src when the highest bit is not set /// in the corresponding element). scale should be 1, 2, 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_mask_i32gather_ps(v256 src, void* base_addr, v256 vindex, v256 mask, int scale) { v256 dst = src; EmulatedGather(&dst.Float0, base_addr, &vindex.SInt0, scale, 8, &mask.SInt0); return dst; } /// /// Gather double-precision (64-bit) floating-point elements from /// memory using 64-bit indices. 64-bit elements are loaded from /// addresses starting at base_addr and offset by each 64-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst using mask /// (elements are copied from src when the highest bit is not set /// in the corresponding element). scale should be 1, 2, 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_mask_i64gather_pd(v256 src, void* base_addr, v256 vindex, v256 mask, int scale) { v256 dst = src; EmulatedGather(&dst.Double0, base_addr, &vindex.SLong0, scale, 4, &mask.SLong0); return dst; } /// /// Gather single-precision (32-bit) floating-point elements from /// memory using 64-bit indices. 32-bit elements are loaded from /// addresses starting at base_addr and offset by each 64-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst using mask /// (elements are copied from src when the highest bit is not set /// in the corresponding element). scale should be 1, 2, 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v128 mm256_mask_i64gather_ps(v128 src, void* base_addr, v256 vindex, v128 mask, int scale) { v128 dst = src; EmulatedGather(&dst.Float0, base_addr, &vindex.SLong0, scale, 4, &mask.SInt0); return dst; } /// /// Gather 32-bit integers from memory using 32-bit indices. 32-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 32-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst /// using mask (elements are copied from src when the highest bit /// is not set in the corresponding element). scale should be 1, 2, /// 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_mask_i32gather_epi32(v256 src, void* base_addr, v256 vindex, v256 mask, int scale) { v256 dst = src; EmulatedGather(&dst.SInt0, base_addr, &vindex.SInt0, scale, 8, &mask.SInt0); return dst; } /// /// Gather 64-bit integers from memory using 32-bit indices. 64-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 32-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst /// using mask (elements are copied from src when the highest bit /// is not set in the corresponding element). scale should be 1, 2, /// 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_mask_i32gather_epi64(v256 src, void* base_addr, v128 vindex, v256 mask, int scale) { v256 dst = src; EmulatedGather(&dst.SLong0, base_addr, &vindex.SInt0, scale, 4, &mask.SLong0); return dst; } /// /// Gather 64-bit integers from memory using 64-bit indices. 64-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 64-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst /// using mask (elements are copied from src when the highest bit /// is not set in the corresponding element). scale should be 1, 2, /// 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v256 mm256_mask_i64gather_epi64(v256 src, void* base_addr, v256 vindex, v256 mask, int scale) { v256 dst = src; EmulatedGather(&dst.SLong0, base_addr, &vindex.SLong0, scale, 4, &mask.SLong0); return dst; } /// /// Gather 32-bit integers from memory using 64-bit indices. 32-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 64-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst /// using mask (elements are copied from src when the highest bit /// is not set in the corresponding element). scale should be 1, 2, /// 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v128 mm256_mask_i64gather_epi32(v128 src, void* base_addr, v256 vindex, v128 mask, int scale) { v128 dst = src; EmulatedGather(&dst.SInt0, base_addr, &vindex.SLong0, scale, 4, &mask.SInt0); return dst; } /// /// Gather double-precision (64-bit) floating-point elements from /// memory using 32-bit indices. 64-bit elements are loaded from /// addresses starting at base_addr and offset by each 32-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst using mask /// (elements are copied from src when the highest bit is not set /// in the corresponding element). scale should be 1, 2, 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v128 mask_i32gather_pd(v128 src, void* base_addr, v128 vindex, v128 mask, int scale) { v128 dst = src; EmulatedGather(&dst.Double0, base_addr, &vindex.SInt0, scale, 2, &mask.SLong0); return dst; } /// /// Gather single-precision (32-bit) floating-point elements from /// memory using 32-bit indices. 32-bit elements are loaded from /// addresses starting at base_addr and offset by each 32-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst using mask /// (elements are copied from src when the highest bit is not set /// in the corresponding element). scale should be 1, 2, 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v128 mask_i32gather_ps(v128 src, void* base_addr, v128 vindex, v128 mask, int scale) { v128 dst = src; EmulatedGather(&dst.Float0, base_addr, &vindex.SInt0, scale, 4, &mask.SInt0); return dst; } /// /// Gather double-precision (64-bit) floating-point elements from /// memory using 64-bit indices. 64-bit elements are loaded from /// addresses starting at base_addr and offset by each 64-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst using mask /// (elements are copied from src when the highest bit is not set /// in the corresponding element). scale should be 1, 2, 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v128 mask_i64gather_pd(v128 src, void* base_addr, v128 vindex, v128 mask, int scale) { v128 dst = src; EmulatedGather(&dst.Double0, base_addr, &vindex.SLong0, scale, 2, &mask.SLong0); return dst; } /// /// Gather single-precision (32-bit) floating-point elements from /// memory using 64-bit indices. 32-bit elements are loaded from /// addresses starting at base_addr and offset by each 64-bit /// element in vindex (each index is scaled by the factor in /// scale). Gathered elements are merged into dst using mask /// (elements are copied from src when the highest bit is not set /// in the corresponding element). scale should be 1, 2, 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v128 mask_i64gather_ps(v128 src, void* base_addr, v128 vindex, v128 mask, int scale) { v128 dst = src; dst.UInt2 = dst.UInt3 = 0; EmulatedGather(&dst.Float0, base_addr, &vindex.SLong0, scale, 2, &mask.SInt0); return dst; } /// /// Gather 32-bit integers from memory using 32-bit indices. 32-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 32-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst /// using mask (elements are copied from src when the highest bit /// is not set in the corresponding element). scale should be 1, 2, /// 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v128 mask_i32gather_epi32(v128 src, void* base_addr, v128 vindex, v128 mask, int scale) { v128 dst = src; EmulatedGather(&dst.SInt0, base_addr, &vindex.SInt0, scale, 4, &mask.SInt0); return dst; } /// /// Gather 64-bit integers from memory using 32-bit indices. 64-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 32-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst /// using mask (elements are copied from src when the highest bit /// is not set in the corresponding element). scale should be 1, 2, /// 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v128 mask_i32gather_epi64(v128 src, void* base_addr, v128 vindex, v128 mask, int scale) { v128 dst = src; EmulatedGather(&dst.SLong0, base_addr, &vindex.SInt0, scale, 2, &mask.SLong0); return dst; } /// /// Gather 32-bit integers from memory using 64-bit indices. 32-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 64-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst /// using mask (elements are copied from src when the highest bit /// is not set in the corresponding element). scale should be 1, 2, /// 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v128 mask_i64gather_epi32(v128 src, void* base_addr, v128 vindex, v128 mask, int scale) { v128 dst = src; dst.UInt2 = dst.UInt3 = 0; EmulatedGather(&dst.SInt0, base_addr, &vindex.SLong0, scale, 2, &mask.SInt0); return dst; } /// /// Gather 64-bit integers from memory using 64-bit indices. 64-bit /// elements are loaded from addresses starting at base_addr and /// offset by each 64-bit element in vindex (each index is scaled /// by the factor in scale). Gathered elements are merged into dst /// using mask (elements are copied from src when the highest bit /// is not set in the corresponding element). scale should be 1, 2, /// 4 or 8. /// /// Source /// Base address /// Offset /// Mask /// Index scale /// Vector [DebuggerStepThrough] public static v128 mask_i64gather_epi64(v128 src, void* base_addr, v128 vindex, v128 mask, int scale) { v128 dst = src; EmulatedGather(&dst.SLong0, base_addr, &vindex.SLong0, scale, 2, &mask.SLong0); return dst; } } } }