Exemplo n.º 1
0
    static int Main()
    {
        int returnVal = Pass;

        for (int i = 0; i < 10; i++)
        {
            Vector <Single> singleVector = getRandomVector <Single>(singles);
            if (VectorConvertTest.VectorConvertSingleInt(singleVector) != Pass)
            {
                Console.WriteLine("Testing Converts Between Single and Int32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Single> singleVector = getRandomVector <Single>(singles);
            if (VectorConvertTest.VectorConvertSingleUInt(singleVector) != Pass)
            {
                Console.WriteLine("Testing Converts Between Single and UInt32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Double> doubleVector = getRandomVector <Double>(doubles);
            if (VectorConvertTest.VectorConvertDoubleInt64(doubleVector) != Pass)
            {
                Console.WriteLine("Testing Converts between Double and Int64 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Double> doubleVector = getRandomVector <Double>(doubles);
            if (VectorConvertTest.VectorConvertDoubleUInt64(doubleVector) != Pass)
            {
                Console.WriteLine("Testing Converts between Double and UInt64 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Double> doubleVector1 = getRandomVector <Double>(doubles);
            Vector <Double> doubleVector2 = getRandomVector <Double>(doubles);
            if (VectorConvertTest.VectorConvertDoubleSingle(doubleVector1, doubleVector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Single and Double failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Int64> int64Vector1 = getRandomVector <Int64>(int64s);
            Vector <Int64> int64Vector2 = getRandomVector <Int64>(int64s);
            if (VectorConvertTest.VectorConvertInt64And32(int64Vector1, int64Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Int64 and Int32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Int32> int32Vector1 = getRandomVector <Int32>(int32s);
            Vector <Int32> int32Vector2 = getRandomVector <Int32>(int32s);
            if (VectorConvertTest.VectorConvertInt32And16(int32Vector1, int32Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Int32 and Int16 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Int16> int16Vector1 = getRandomVector <Int16>(int16s);
            Vector <Int16> int16Vector2 = getRandomVector <Int16>(int16s);
            if (VectorConvertTest.VectorConvertInt16And8(int16Vector1, int16Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Int16 and SByte failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <UInt64> uint64Vector1 = getRandomVector <UInt64>(uint64s);
            Vector <UInt64> uint64Vector2 = getRandomVector <UInt64>(uint64s);
            if (VectorConvertTest.VectorConvertUInt64And32(uint64Vector1, uint64Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between UInt64 and UInt32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <UInt32> uint32Vector1 = getRandomVector <UInt32>(uint32s);
            Vector <UInt32> uint32Vector2 = getRandomVector <UInt32>(uint32s);
            if (VectorConvertTest.VectorConvertUInt32And16(uint32Vector1, uint32Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between UInt32 and UInt16 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <UInt16> uint16Vector1 = getRandomVector <UInt16>(uint16s);
            Vector <UInt16> uint16Vector2 = getRandomVector <UInt16>(uint16s);
            if (VectorConvertTest.VectorConvertUInt16And8(uint16Vector1, uint16Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between UInt16 and Byte failed");
                returnVal = Fail;
            }
        }

        JitLog jitLog = new JitLog();

        if (!jitLog.Check("System.Numerics.Vector:ConvertToInt32(struct):struct"))
        {
            returnVal = Fail;
        }
        if (!jitLog.Check("System.Numerics.Vector:ConvertToUInt32(struct):struct"))
        {
            returnVal = Fail;
        }
        if (!jitLog.Check("System.Numerics.Vector:ConvertToSingle(struct):struct"))
        {
            returnVal = Fail;
        }
        // Note: SIMD Conversion to Int64/UInt64 is not supported on x86
#if !BIT32
        if (!jitLog.Check("System.Numerics.Vector:ConvertToInt64(struct):struct"))
        {
            returnVal = Fail;
        }
        if (!jitLog.Check("System.Numerics.Vector:ConvertToUInt64(struct):struct"))
        {
            returnVal = Fail;
        }
#endif // !BIT32
        if (!jitLog.Check("System.Numerics.Vector:ConvertToDouble(struct):struct"))
        {
            returnVal = Fail;
        }
        if (!jitLog.Check("System.Numerics.Vector:Narrow(struct,struct):struct"))
        {
            returnVal = Fail;
        }
        if (!jitLog.Check("System.Numerics.Vector:Widen(struct,byref,byref)"))
        {
            returnVal = Fail;
        }
        jitLog.Dispose();

        return(returnVal);
    }
Exemplo n.º 2
0
    static int Main()
    {
        int returnVal = Pass;

        for (int i = 0; i < 10; i++)
        {
            Vector <Single> singleVector = getRandomVector <Single>(singles);
            if (VectorConvertTest.VectorConvertSingleInt(singleVector) != Pass)
            {
                Console.WriteLine("Testing Converts Between Single and Int32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Single> singleVector = getRandomVector <Single>(singles);
            if (VectorConvertTest.VectorConvertSingleUInt(singleVector) != Pass)
            {
                Console.WriteLine("Testing Converts Between Single and UInt32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Double> doubleVector = getRandomVector <Double>(doubles);
            if (VectorConvertTest.VectorConvertDoubleInt64(doubleVector) != Pass)
            {
                Console.WriteLine("Testing Converts between Double and Int64 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Double> doubleVector = getRandomVector <Double>(doubles);
            if (VectorConvertTest.VectorConvertDoubleUInt64(doubleVector) != Pass)
            {
                Console.WriteLine("Testing Converts between Double and UInt64 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Double> doubleVector1 = getRandomVector <Double>(doubles);
            Vector <Double> doubleVector2 = getRandomVector <Double>(doubles);
            if (VectorConvertTest.VectorConvertDoubleSingle(doubleVector1, doubleVector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Single and Double failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Int64> int64Vector1 = getRandomVector <Int64>(int64s);
            Vector <Int64> int64Vector2 = getRandomVector <Int64>(int64s);
            if (VectorConvertTest.VectorConvertInt64And32(int64Vector1, int64Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Int64 and Int32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Int32> int32Vector1 = getRandomVector <Int32>(int32s);
            Vector <Int32> int32Vector2 = getRandomVector <Int32>(int32s);
            if (VectorConvertTest.VectorConvertInt32And16(int32Vector1, int32Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Int32 and Int16 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <Int16> int16Vector1 = getRandomVector <Int16>(int16s);
            Vector <Int16> int16Vector2 = getRandomVector <Int16>(int16s);
            if (VectorConvertTest.VectorConvertInt16And8(int16Vector1, int16Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between Int16 and SByte failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <UInt64> uint64Vector1 = getRandomVector <UInt64>(uint64s);
            Vector <UInt64> uint64Vector2 = getRandomVector <UInt64>(uint64s);
            if (VectorConvertTest.VectorConvertUInt64And32(uint64Vector1, uint64Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between UInt64 and UInt32 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <UInt32> uint32Vector1 = getRandomVector <UInt32>(uint32s);
            Vector <UInt32> uint32Vector2 = getRandomVector <UInt32>(uint32s);
            if (VectorConvertTest.VectorConvertUInt32And16(uint32Vector1, uint32Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between UInt32 and UInt16 failed");
                returnVal = Fail;
            }
        }

        for (int i = 0; i < 10; i++)
        {
            Vector <UInt16> uint16Vector1 = getRandomVector <UInt16>(uint16s);
            Vector <UInt16> uint16Vector2 = getRandomVector <UInt16>(uint16s);
            if (VectorConvertTest.VectorConvertUInt16And8(uint16Vector1, uint16Vector2) != Pass)
            {
                Console.WriteLine("Testing Converts between UInt16 and Byte failed");
                returnVal = Fail;
            }
        }
        return(returnVal);
    }