#include #include #include #include "Vec128.h" using namespace std; extern void F32fromI32(Vec128 x[2], const Vec128& a); extern void I32fromF32(Vec128 x[2], const Vec128& a); extern void F64fromI64(Vec128 x[2], const Vec128& a); extern void I64fromF64(Vec128 x[2], const Vec128& a); extern void F32fromU32(Vec128 x[2], const Vec128& a); extern void U32fromF32(Vec128 x[2], const Vec128& a); extern void F64fromU64(Vec128 x[2], const Vec128& a); extern void U64fromF64(Vec128 x[2], const Vec128& a); extern void F32fromF64(Vec128 x[2], const Vec128& a, const Vec128& b); extern void F64fromF32(Vec128 x[2], const Vec128& a); void PackedConvertA(void) { const char nl = '\n'; Vec128 x[2], a; // F32_I32 a.m_I32[0] = 10; a.m_I32[1] = -500; a.m_I32[2] = 600; a.m_I32[3] = -1024; F32fromI32(x, a); cout << "\nResults for CvtOp::F32_I32\n"; cout << "a: " << a.ToStringI32() << nl; cout << "x[0]: " << x[0].ToStringF32() << nl; // I32_F32 a.m_F32[0] = -1.25f; a.m_F32[1] = 100.875f; a.m_F32[2] = -200.0f; a.m_F32[3] = (float)M_PI; I32fromF32(x, a); cout << "\nResults for CvtOp::I32_F32\n"; cout << "a: " << a.ToStringF32() << nl; cout << "x[0]: " << x[0].ToStringI32() << nl; // F64_I64 a.m_I64[0] = 1000; a.m_I64[1] = -500000000000; F64fromI64(x, a); cout << "\nResults for CvtOp::F64_I64\n"; cout << "a: " << a.ToStringI64() << nl; cout << "x[0]: " << x[0].ToStringF64() << nl; // I64_F64 a.m_F64[0] = -122.66666667; a.m_F64[1] = 1234567890123.75; I64fromF64(x, a); cout << "\nResults for CvtOp::I64_F64\n"; cout << "a: " << a.ToStringF64() << nl; cout << "x[0]: " << x[0].ToStringI64() << nl; } void PackedConvertB(void) { const char nl = '\n'; Vec128 x[2], a; // F32_U32 a.m_U32[0] = 10; a.m_U32[1] = 500; a.m_U32[2] = 600; a.m_U32[3] = 1024; F32fromU32(x, a); cout << "\nResults for CvtOp::F32_U32\n"; cout << "a: " << a.ToStringU32() << nl; cout << "x[0]: " << x[0].ToStringF32() << nl; // U32_F32 a.m_F32[0] = 1.25f; a.m_F32[1] = 100.875f; a.m_F32[2] = 200.0f; a.m_F32[3] = (float)M_PI; U32fromF32(x, a); cout << "\nResults for CvtOp::U32_F32\n"; cout << "a: " << a.ToStringF32() << nl; cout << "x[0]: " << x[0].ToStringU32() << nl; // F64_U64 a.m_I64[0] = 1000; a.m_I64[1] = 420000000000; F64fromU64(x, a); cout << "\nResults for CvtOp::F64_U64\n"; cout << "a: " << a.ToStringU64() << nl; cout << "x[0]: " << x[0].ToStringF64() << nl; // U64_F64 a.m_F64[0] = 698.40; a.m_F64[1] = 1234567890123.75; U64fromF64(x, a); cout << "\nResults for CvtOp::U64_F64\n"; cout << "a: " << a.ToStringF64() << nl; cout << "x[0]: " << x[0].ToStringU64() << nl; } void PackedConvertC(void) { const char nl = '\n'; Vec128 x[2], a, b; // F32_F64 a.m_F64[0] = M_PI; a.m_F64[1] = M_LOG10E; b.m_F64[0] = -M_E; b.m_F64[1] = M_LN2; F32fromF64(x, a, b); cout << "\nResults for CvtOp::F32_F64\n"; cout << "a: " << a.ToStringF64() << nl; cout << "b: " << b.ToStringF64() << nl; cout << "x[0]: " << x[0].ToStringF32() << nl; // F64_F32 a.m_F32[0] = 1.0f / 9.0f; a.m_F32[1] = 100.875f; a.m_F32[2] = 200.0f; a.m_F32[3] = (float)M_SQRT2; F64fromF32(x, a); cout << "\nResults for CvtOp::F64_F32\n"; cout << "a: " << a.ToStringF32() << nl; cout << "x[0]: " << x[0].ToStringF64() << nl; cout << "x[1]: " << x[1].ToStringF64() << nl; } int main() { PackedConvertA(); PackedConvertB(); PackedConvertC(); return 0; }