int main() { TEST_SET_START("20040920095218EJL","EJL", "recipd2"); unsigned long long i6 = 0x7fd0000000000001ull; // 2^1022 + 1 ulp unsigned long long i7 = 0xffd0000000000000ull; // -2^1022 unsigned long long i7r = 0x8010000000000000ull; // -2^-1022 unsigned long long i8 = 0x7606a4533cf5605eull; // random values unsigned long long i8r = 0x09d69cea2b5b5b57ull; unsigned long long i9 = 0x4c042c295376566eull; unsigned long long i9r = 0x33d9618e87b961f4ull; unsigned long long i10 = 0x39b3720562510408ull; unsigned long long i10r = 0x462a54842d7f9b5dull; unsigned long long i11 = 0x6911a64538a389aeull; unsigned long long i11r = 0x16cd02637ed13ff2ull; unsigned long long i12 = 0x1ac4d062d451c99dull; unsigned long long i12r = 0x6518994c26ebbb3eull; double x0 = hide_double(-HUGE_VAL); // -Inf double x1 = hide_double(HUGE_VAL); // Inf double x2 = hide_double(0.0); // 0 double x3 = hide_double(-0.0); // -0 double x4 = hide_double(nan("")); // NaN double x5 = hide_double(2.0); double x5r = hide_double(0.5); double x6 = hide_double(make_double(i6)); double x7 = hide_double(make_double(i7)); double x7r = hide_double(make_double(i7r)); double x8 = hide_double(make_double(i8)); double x8r = hide_double(make_double(i8r)); double x9 = hide_double(make_double(i9)); double x9r = hide_double(make_double(i9r)); double x10 = hide_double(make_double(i10)); double x10r = hide_double(make_double(i10r)); double x11 = hide_double(make_double(i11)); double x11r = hide_double(make_double(i11r)); double x12 = hide_double(make_double(i12)); double x12r = hide_double(make_double(i12r)); vec_double2 x0_v = spu_splats(x0); vec_double2 x1_v = spu_splats(x1); vec_double2 x2_v = spu_splats(x2); vec_double2 x3_v = spu_splats(x3); vec_double2 x4_v = spu_splats(x4); vec_double2 x5_v = spu_splats(x5); vec_double2 x5r_v = spu_splats(x5r); vec_double2 x6_v = spu_splats(x6); vec_double2 x7_v = spu_splats(x7); vec_double2 x7r_v = spu_splats(x7r); vec_double2 x8_v = spu_splats(x8); vec_double2 x8r_v = spu_splats(x8r); vec_double2 x9_v = spu_splats(x9); vec_double2 x9r_v = spu_splats(x9r); vec_double2 x10_v = spu_splats(x10); vec_double2 x10r_v = spu_splats(x10r); vec_double2 x11_v = spu_splats(x11); vec_double2 x11r_v = spu_splats(x11r); vec_double2 x12_v = spu_splats(x12); vec_double2 x12r_v = spu_splats(x12r); vec_double2 res_v; TEST_START("recipd2"); res_v = recipd2(x0_v); TEST_CHECK("20040920095224EJL", allnegzero_double2( res_v ), 0); res_v = recipd2(x1_v); TEST_CHECK("20040920095226EJL", allposzero_double2( res_v ), 0); res_v = recipd2(x2_v); TEST_CHECK("20040920095228EJL", allposinf_double2( res_v ), 0); res_v = recipd2(x3_v); TEST_CHECK("20040920095233EJL", allneginf_double2( res_v ), 0); res_v = recipd2(x4_v); TEST_CHECK("20040920095235EJL", allnan_double2( res_v ), 0); res_v = recipd2(x5_v); TEST_CHECK("20040920095237EJL", allequal_double2( res_v, x5r_v ), 0); res_v = recipd2(x6_v); TEST_CHECK("20040920095239EJL", allzerodenorm_double2( res_v ), 0); res_v = recipd2(x7_v); TEST_CHECK("20040920095242EJL", allequal_double2( res_v, x7r_v ), 0); res_v = recipd2(x8_v); TEST_CHECK("20040920095245EJL", allequal_ulps_double2( res_v, x8r_v, 1 ), 0); res_v = recipd2(x9_v); TEST_CHECK("20040920095247EJL", allequal_ulps_double2( res_v, x9r_v, 1 ), 0); res_v = recipd2(x10_v); TEST_CHECK("20040920095248EJL", allequal_ulps_double2( res_v, x10r_v, 1 ), 0); res_v = recipd2(x11_v); TEST_CHECK("20040920095250EJL", allequal_ulps_double2( res_v, x11r_v, 1 ), 0); res_v = recipd2(x12_v); TEST_CHECK("20040920095252EJL", allequal_ulps_double2( res_v, x12r_v, 1 ), 0); TEST_SET_DONE(); TEST_EXIT(); }
int main() { TEST_SET_START("20040928174038EJL","EJL", "rsqrtd2"); unsigned long long i6 = 0x7464fff515d76f87ull; unsigned long long i6r = 0x25b3c03b72dba06cull; unsigned long long i7 = 0x7606a4533cf5605eull; unsigned long long i7r = 0x24e3056f4b45f6a9ull; unsigned long long i8 = 0x4beae58c6f48733eull; unsigned long long i8r = 0x39f173b787396c5full; unsigned long long i9 = 0x3999ed5c8316b00bull; unsigned long long i9r = 0x43192359a70ec761ull; unsigned long long i10 = 0x68f7885c4b84b793ull; unsigned long long i10r = 0x2b6a62d48c269d90ull; unsigned long long i11 = 0x1aabc083c5c26227ull; unsigned long long i11r = 0x52912e543817fabbull; double x0 = hide_double(-HUGE_VAL); // -Inf -> NaN double x1 = hide_double(HUGE_VAL); // Inf -> +0 double x2 = hide_double(0.0); // +0 -> Inf double x3 = hide_double(-0.0); // -0 -> -Inf double x4 = hide_double(nan("")); // NaN -> NaN double x5 = hide_double(4.0); double x5r = hide_double(0.5); double x6 = hide_double(make_double(i6)); double x6r = hide_double(make_double(i6r)); double x7 = hide_double(make_double(i7)); double x7r = hide_double(make_double(i7r)); double x8 = hide_double(make_double(i8)); double x8r = hide_double(make_double(i8r)); double x9 = hide_double(make_double(i9)); double x9r = hide_double(make_double(i9r)); double x10 = hide_double(make_double(i10)); double x10r = hide_double(make_double(i10r)); double x11 = hide_double(make_double(i11)); double x11r = hide_double(make_double(i11r)); vec_double2 x0_v = spu_splats(x0); vec_double2 x1_v = spu_splats(x1); vec_double2 x2_v = spu_splats(x2); vec_double2 x3_v = spu_splats(x3); vec_double2 x4_v = spu_splats(x4); vec_double2 x5_v = spu_splats(x5); vec_double2 x5r_v = spu_splats(x5r); vec_double2 x6_v = spu_splats(x6); vec_double2 x6r_v = spu_splats(x6r); vec_double2 x7_v = spu_splats(x7); vec_double2 x7r_v = spu_splats(x7r); vec_double2 x8_v = spu_splats(x8); vec_double2 x8r_v = spu_splats(x8r); vec_double2 x9_v = spu_splats(x9); vec_double2 x9r_v = spu_splats(x9r); vec_double2 x10_v = spu_splats(x10); vec_double2 x10r_v = spu_splats(x10r); vec_double2 x11_v = spu_splats(x11); vec_double2 x11r_v = spu_splats(x11r); vec_double2 res_v; TEST_START("rsqrtd2"); res_v = rsqrtd2(x0_v); TEST_CHECK("20040928174042EJL", allnan_double2( res_v ), 0); res_v = rsqrtd2(x1_v); TEST_CHECK("20040928174045EJL", allposzero_double2( res_v ), 0); res_v = rsqrtd2(x2_v); TEST_CHECK("20040928174047EJL", allposinf_double2( res_v ), 0); res_v = rsqrtd2(x3_v); TEST_CHECK("20040928174049EJL", allneginf_double2( res_v ), 0); res_v = rsqrtd2(x4_v); TEST_CHECK("20040928174054EJL", allnan_double2( res_v ), 0); res_v = rsqrtd2(x5_v); TEST_CHECK("20040928174058EJL", allequal_double2( res_v, x5r_v ), 0); res_v = rsqrtd2(x6_v); TEST_CHECK("20040928174101EJL", allequal_ulps_double2( res_v, x6r_v, 1 ), 0); res_v = rsqrtd2(x7_v); TEST_CHECK("20040928174104EJL", allequal_ulps_double2( res_v, x7r_v, 1 ), 0); res_v = rsqrtd2(x8_v); TEST_CHECK("20040928174106EJL", allequal_ulps_double2( res_v, x8r_v, 1 ), 0); res_v = rsqrtd2(x9_v); TEST_CHECK("20040928174108EJL", allequal_ulps_double2( res_v, x9r_v, 1 ), 0); res_v = rsqrtd2(x10_v); TEST_CHECK("20040928174110EJL", allequal_ulps_double2( res_v, x10r_v, 1 ), 0); res_v = rsqrtd2(x11_v); TEST_CHECK("20040928174113EJL", allequal_ulps_double2( res_v, x11r_v, 1 ), 0); TEST_SET_DONE(); TEST_EXIT(); }
int main() { TEST_SET_START("20060828114000MH","MH", "fmad2"); // double denorm_min = hide_double(make_double(0x0000000000000001ull)); double denorm_max = hide_double(make_double(0x000fffffffffffffull)); // double norm_min = hide_double(make_double(0x0010000000000000ull)); double norm_max = hide_double(make_double(0x7fefffffffffffffull)); double x0 = hide_double(1760.135); double y0 = hide_double(19355.03); double z0 = hide_double(-12351.9); double a0 = hide_double(34055113.82905); double x1 = hide_double(-139.035); double y1 = hide_double(0.0); double z1 = hide_double(-1.0); double x2 = hide_double(nan("")); double y2 = hide_double(-1.0); double z2 = hide_double(-0.0); double x3 = hide_double(1.0); double y3 = hide_double(HUGE_VAL); double z3 = hide_double(-1.0); double x4 = norm_max; double y4 = norm_max; double z4 = hide_double(0.0); double x5 = hide_double(100.0); double y5 = denorm_max; double z5 = hide_double(0.0); double a5 = hide_double(make_double(0x0078fffffffffffeull)); vec_double2 x0_v = spu_splats(x0); vec_double2 y0_v = spu_splats(y0); vec_double2 z0_v = spu_splats(z0); vec_double2 x1_v = spu_splats(x1); vec_double2 y1_v = spu_splats(y1); vec_double2 z1_v = spu_splats(z1); vec_double2 x2_v = spu_splats(x2); vec_double2 y2_v = spu_splats(y2); vec_double2 z2_v = spu_splats(z2); vec_double2 x3_v = spu_splats(x3); vec_double2 y3_v = spu_splats(y3); vec_double2 z3_v = spu_splats(z3); vec_double2 x4_v = spu_splats(x4); vec_double2 y4_v = spu_splats(y4); vec_double2 z4_v = spu_splats(z4); vec_double2 x5_v = spu_splats(x5); vec_double2 y5_v = spu_splats(y5); vec_double2 z5_v = spu_splats(z5); vec_double2 a0_v = spu_splats(a0); vec_double2 a1_v = spu_splats(z1); vec_double2 a5_v = spu_splats(a5); vec_double2 res_v; TEST_START("fmad2"); res_v = fmad2(x0_v, y0_v, z0_v); TEST_CHECK("20060828114001MH", allequal_ulps_double2( res_v, a0_v, 1 ), 0); res_v = fmad2(y0_v, x0_v, z0_v); TEST_CHECK("20060828114002MH", allequal_ulps_double2( res_v, a0_v, 1 ), 0); res_v = fmad2(x1_v, y1_v, z1_v); TEST_CHECK("20060828114003MH", allequal_ulps_double2( res_v, a1_v, 1 ), 0); res_v = fmad2(y1_v, x1_v, z1_v); TEST_CHECK("20060828114004MH", allequal_ulps_double2( res_v, a1_v, 1 ), 0); res_v = fmad2(x2_v, y2_v, z2_v); TEST_CHECK("20060828114005MH", allnan_double2( res_v ), 0); res_v = fmad2(y2_v, x2_v, z2_v); TEST_CHECK("20060828114006MH", allnan_double2( res_v ), 0); res_v = fmad2(x3_v, y3_v, z3_v); TEST_CHECK("20060828114007MH", allposinf_double2( res_v ), 0); res_v = fmad2(y3_v, x3_v, z3_v); TEST_CHECK("20060828114008MH", allposinf_double2( res_v ), 0); res_v = fmad2(x4_v, y4_v, z4_v); TEST_CHECK("20060828114009MH", allposinf_double2( res_v ), 0); res_v = fmad2(y4_v, x4_v, z4_v); TEST_CHECK("20060828114010MH", allposinf_double2( res_v ), 0); res_v = fmad2(x5_v, y5_v, z5_v); TEST_CHECK("20060828114011MH", allequal_ulps_double2( res_v, a5_v, 1 ), 0); res_v = fmad2(y5_v, x5_v, z5_v); TEST_CHECK("20060828114012MH", allequal_ulps_double2( res_v, a5_v, 1 ), 0); //printf("res:%.10le, a5:%.10le\n", spu_extract(res_v, 0), spu_extract(a5_v, 0)); TEST_SET_DONE(); TEST_EXIT(); }