コード例 #1
0
        public static Vector128 <ushort> op_LeftShift(Vector128 <ushort> vector, Vector128 <ushort> count)
        {
            Vector128 <uint> loMask      = Vector128.Create((uint)0xFFFF);
            Vector128 <uint> vectorChunk = vector.As <uint>() & loMask;
            Vector128 <uint> countChunk  = count.As <uint>() & loMask;
            Vector128 <uint> result      = Avx2.ShiftLeftLogicalVariable(vectorChunk, countChunk) & loMask;

            vectorChunk = Sse2.ShiftRightLogical(vector.As <uint>(), 16);
            countChunk  = Sse2.ShiftRightLogical(count.As <uint>(), 16);
            result     |= Sse2.ShiftLeftLogical(Avx2.ShiftLeftLogicalVariable(vectorChunk, countChunk) & loMask, 16);
            return(result.As <ushort>());
        }
コード例 #2
0
        public static Vector128 <byte> op_Multiply(Vector128 <byte> left, Vector128 <byte> right)
        {
            Vector128 <ushort> lowBits = Vector128.Create((ushort)0x00FF);
            var lowProduct             = Sse2.And(lowBits, Sse2.MultiplyLow(left.As <ushort>(), right.As <ushort>())).AsByte();
            var highProduct            =
                Sse2.ShiftLeftLogical(
                    Sse2.MultiplyLow(
                        Sse2.ShiftRightLogical(left.As <ushort>(), 8),
                        Sse2.ShiftRightLogical(right.As <ushort>(), 8)
                        ),
                    8).AsByte();

            return(Sse2.Or(lowProduct, highProduct));
        }
コード例 #3
0
        public static Vector128 <byte> op_LeftShift(Vector128 <byte> vector, byte count)
        {
            var highBits = Vector128.Create((ushort)0xFF00);
            var loBits   = Vector128.Create((ushort)0xFF);
            var mask     = Sse2.Or(highBits, Sse2.ShiftLeftLogical(loBits, count));

            return(Sse2.And(Sse2.ShiftLeftLogical(vector.As <ushort>(), count), mask).AsByte());
        }
コード例 #4
0
 public static Vector128 <short> op_Division(Vector128 <short> left, Vector128 <short> right)
 => Vector128.Create(
     (short)((short)Sse2.Extract(left.As <ushort>(), 0) / (short)Sse2.Extract(right.As <ushort>(), 0)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 1) / (short)Sse2.Extract(right.As <ushort>(), 1)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 2) / (short)Sse2.Extract(right.As <ushort>(), 2)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 3) / (short)Sse2.Extract(right.As <ushort>(), 3)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 4) / (short)Sse2.Extract(right.As <ushort>(), 4)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 5) / (short)Sse2.Extract(right.As <ushort>(), 5)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 6) / (short)Sse2.Extract(right.As <ushort>(), 6)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 7) / (short)Sse2.Extract(right.As <ushort>(), 7)));
コード例 #5
0
 public static Vector128 <short> op_Division(Vector128 <short> vector, short scalar)
 => Vector128.Create(
     (short)((short)Sse2.Extract(vector.As <ushort>(), 0) / scalar),
     (short)((short)Sse2.Extract(vector.As <ushort>(), 1) / scalar),
     (short)((short)Sse2.Extract(vector.As <ushort>(), 2) / scalar),
     (short)((short)Sse2.Extract(vector.As <ushort>(), 3) / scalar),
     (short)((short)Sse2.Extract(vector.As <ushort>(), 4) / scalar),
     (short)((short)Sse2.Extract(vector.As <ushort>(), 5) / scalar),
     (short)((short)Sse2.Extract(vector.As <ushort>(), 6) / scalar),
     (short)((short)Sse2.Extract(vector.As <ushort>(), 7) / scalar));
コード例 #6
0
 public static Vector128 <short> op_Modulus(Vector128 <short> left, Vector128 <short> right)
 => Vector128.Create(
     (short)((short)Sse2.Extract(left.As <ushort>(), 0) % (short)Sse2.Extract(right.As <ushort>(), 0)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 1) % (short)Sse2.Extract(right.As <ushort>(), 1)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 2) % (short)Sse2.Extract(right.As <ushort>(), 2)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 3) % (short)Sse2.Extract(right.As <ushort>(), 3)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 4) % (short)Sse2.Extract(right.As <ushort>(), 4)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 5) % (short)Sse2.Extract(right.As <ushort>(), 5)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 6) % (short)Sse2.Extract(right.As <ushort>(), 6)),
     (short)((short)Sse2.Extract(left.As <ushort>(), 7) % (short)Sse2.Extract(right.As <ushort>(), 7)));
コード例 #7
0
 public static Vector128 <sbyte> op_Modulus(Vector128 <sbyte> left, Vector128 <sbyte> right)
 => Vector128.Create(
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 0) % (sbyte)Sse41.Extract(right.As <byte>(), 0)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 1) % (sbyte)Sse41.Extract(right.As <byte>(), 1)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 2) % (sbyte)Sse41.Extract(right.As <byte>(), 2)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 3) % (sbyte)Sse41.Extract(right.As <byte>(), 3)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 4) % (sbyte)Sse41.Extract(right.As <byte>(), 4)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 5) % (sbyte)Sse41.Extract(right.As <byte>(), 5)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 6) % (sbyte)Sse41.Extract(right.As <byte>(), 6)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 7) % (sbyte)Sse41.Extract(right.As <byte>(), 7)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 8) % (sbyte)Sse41.Extract(right.As <byte>(), 8)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 9) % (sbyte)Sse41.Extract(right.As <byte>(), 9)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 10) % (sbyte)Sse41.Extract(right.As <byte>(), 10)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 11) % (sbyte)Sse41.Extract(right.As <byte>(), 11)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 12) % (sbyte)Sse41.Extract(right.As <byte>(), 12)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 13) % (sbyte)Sse41.Extract(right.As <byte>(), 13)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 14) % (sbyte)Sse41.Extract(right.As <byte>(), 14)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 15) % (sbyte)Sse41.Extract(right.As <byte>(), 15)));
コード例 #8
0
 public static Vector128 <sbyte> op_Division(Vector128 <sbyte> left, Vector128 <sbyte> right)
 => Vector128.Create(
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 0) / (sbyte)Sse41.Extract(right.As <byte>(), 0)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 1) / (sbyte)Sse41.Extract(right.As <byte>(), 1)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 2) / (sbyte)Sse41.Extract(right.As <byte>(), 2)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 3) / (sbyte)Sse41.Extract(right.As <byte>(), 3)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 4) / (sbyte)Sse41.Extract(right.As <byte>(), 4)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 5) / (sbyte)Sse41.Extract(right.As <byte>(), 5)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 6) / (sbyte)Sse41.Extract(right.As <byte>(), 6)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 7) / (sbyte)Sse41.Extract(right.As <byte>(), 7)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 8) / (sbyte)Sse41.Extract(right.As <byte>(), 8)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 9) / (sbyte)Sse41.Extract(right.As <byte>(), 9)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 10) / (sbyte)Sse41.Extract(right.As <byte>(), 10)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 11) / (sbyte)Sse41.Extract(right.As <byte>(), 11)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 12) / (sbyte)Sse41.Extract(right.As <byte>(), 12)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 13) / (sbyte)Sse41.Extract(right.As <byte>(), 13)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 14) / (sbyte)Sse41.Extract(right.As <byte>(), 14)),
     (sbyte)((sbyte)Sse41.Extract(left.As <byte>(), 15) / (sbyte)Sse41.Extract(right.As <byte>(), 15)));
コード例 #9
0
 public static Vector128 <double> op_Modulus(Vector128 <double> left, Vector128 <double> right)
 => Vector128.Create(
     ((System.Runtime.Intrinsics.Vector128 <double>)left).ToScalar() % ((System.Runtime.Intrinsics.Vector128 <double>)right).ToScalar(),
     Reinterpret.Cast <ulong, double>(Sse41.X64.Extract(left.As <ulong>(), 1)) % Reinterpret.Cast <ulong, double>(Sse41.X64.Extract(right.As <ulong>(), 1)));
コード例 #10
0
 public static Vector128 <bool> op_LogicalNot(Vector128 <bool> vector)
 => (Vector128.Create((byte)1) ^ vector.As <byte>()).As <bool>();
コード例 #11
0
 public static Vector128 <long> op_LeftShift(Vector128 <long> vector, Vector128 <long> count)
 => Avx2.ShiftLeftLogicalVariable(vector, count.As <ulong>());
コード例 #12
0
        public static Vector128 <byte> op_LessThan(Vector128 <byte> left, Vector128 <byte> right)
        {
            var offset = Vector128.Create(sbyte.MinValue);

            return(Sse2.CompareLessThan(Sse2.Add(left.As <sbyte>(), offset), Sse2.Add(right.As <sbyte>(), offset)).AsByte());
        }
コード例 #13
0
        public static Vector128 <ushort> op_GreaterThan(Vector128 <ushort> left, Vector128 <ushort> right)
        {
            var offset = Vector128.Create(short.MinValue);

            return(Sse2.CompareGreaterThan(Sse2.Add(left.As <short>(), offset), Sse2.Add(right.As <short>(), offset)).AsUInt16());
        }
コード例 #14
0
 public static Vector128 <sbyte> op_LeftShift(Vector128 <sbyte> vector, byte count)
 => op_LeftShift(vector.As <byte>(), count).As <sbyte>();
コード例 #15
0
 public static Vector128 <short> op_LeftShift(Vector128 <short> vector, Vector128 <short> count)
 => op_LeftShift(vector, count.As <ushort>());
コード例 #16
0
 public static Vector128 <short> op_RightShift(Vector128 <short> vector, Vector128 <ushort> count)
 => op_RightShift(vector.As <ushort>(), count).As <short>();
コード例 #17
0
        public static Vector128 <uint> op_LessThan(Vector128 <uint> left, Vector128 <uint> right)
        {
            var offset = Vector128.Create(int.MinValue);

            return(Sse2.CompareLessThan(Sse2.Add(left.As <int>(), offset), Sse2.Add(right.As <int>(), offset)).AsUInt32());
        }
コード例 #18
0
 public static Vector128 <uint> op_LeftShift(Vector128 <uint> vector, Vector128 <int> count)
 => Avx2.ShiftLeftLogicalVariable(vector, count.As <uint>());
コード例 #19
0
        public static Vector128 <ulong> op_GreaterThan(Vector128 <ulong> left, Vector128 <ulong> right)
        {
            var offset = Vector128.Create(long.MinValue);

            return(Sse42.CompareGreaterThan(Sse2.Add(left.As <long>(), offset), Sse2.Add(right.As <long>(), offset)).AsUInt64());
        }
コード例 #20
0
 public static Vector128 <sbyte> op_RightShift(Vector128 <sbyte> vector, Vector128 <byte> count)
 => op_RightShift(vector.As <byte>(), count).As <sbyte>();
コード例 #21
0
 public static Vector128 <sbyte> op_Division(Vector128 <sbyte> vector, sbyte scalar)
 => Vector128.Create(
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 0) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 1) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 2) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 3) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 4) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 5) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 6) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 7) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 8) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 9) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 10) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 11) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 12) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 13) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 14) / scalar),
     (sbyte)((sbyte)Sse41.Extract(vector.As <byte>(), 15) / scalar));
コード例 #22
0
 public static Vector128 <sbyte> op_Multiply(Vector128 <sbyte> left, Vector128 <sbyte> right)
 => op_Multiply(left.As <byte>(), right.As <byte>()).As <sbyte>();
コード例 #23
0
 public static Vector128 <sbyte> op_LeftShift(Vector128 <sbyte> vector, Vector128 <sbyte> count)
 => op_LeftShift(vector, count.As <byte>());