using System; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; class Program { static void Main() { Vector128vec1 = Vector128.Create(0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA); Vector128 vec2 = Vector128.Create(0x55555555, 0x55555555, 0x55555555, 0x55555555); Vector128 result = Avx2.And(vec1, vec2); Console.WriteLine("Result: " + BitConverter.ToString(BitConverter.GetBytes(result.GetElement(0))) + BitConverter.ToString(BitConverter.GetBytes(result.GetElement(1))) + BitConverter.ToString(BitConverter.GetBytes(result.GetElement(2))) + BitConverter.ToString(BitConverter.GetBytes(result.GetElement(3)))); } }
using System; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; class Program { static void Main() { Vector128This example shows how to perform a conditional move operation on two vectors using Avx2.BlendVariable method. The package library for these code examples using C# AVX2 is System.Runtime.Intrinsics.X86.vec1 = Vector128.Create(1, 2, 3, 4); Vector128 vec2 = Vector128.Create(5, 6, 7, 8); Vector128 mask = Vector128.Create(-1, 0, -1, 0); Vector128 result = Avx2.BlendVariable(vec1, vec2, mask); Console.WriteLine("Result: " + result); } }