예제 #1
0
        public void bmv_32x32()
        {
            for (var sample = 0; sample < SampleSize; sample++)
            {
                var m  = Random.BitMatrix32();
                var c  = Random.BitVector(n32);
                var z1 = m * c;
                var z2 = BitVector32.Alloc();
                for (var i = 0; i < m.RowCount; i++)
                {
                    var r = m.RowVector(i);
                    z2[i] = r % c;
                }

                Claim.yea(z1 == z2);
            }
        }
예제 #2
0
        public void movemask256_f64()
        {
            var n   = Pow2.T12;
            var src = Random.Span256 <double>(n);

            for (var i = 0; i < n; i++)
            {
                var srcVector = src.ToCpuVec256(i);

                var mmExpect = BitVector32.Alloc();
                for (byte r = 0; r < srcVector.Length(); r++)
                {
                    if (BitMask.test(srcVector[r], 63))
                    {
                        mmExpect.Enable(r);
                    }
                }

                var mmActual = ginx.movemask(srcVector).ToBitVector(n32);
                Claim.yea(mmExpect == mmActual);
            }
        }
예제 #3
0
        public void movemask128_u8()
        {
            var n   = SampleSize;
            var src = Random.Span128 <byte>(blocks: n);

            for (var i = 0; i < n; i++)
            {
                var srcVector = src.ToCpuVec128(i);

                var mmExpect = BitVector32.Alloc();
                for (byte r = 0; r < srcVector.Length(); r++)
                {
                    if (BitMask.test(srcVector[r], 7))
                    {
                        mmExpect.Enable(r);
                    }
                }

                var mmActual = ginx.movemask(srcVector).ToBitVector(n32);
                Claim.yea(mmExpect == mmActual);
            }
        }