Beispiel #1
0
int main()
{
	TEST_SET_START("20060918101000NM","NM", "llrintf4");

//   unsigned long i11 = 0x5efffffful; // 9223371487098961920
//   unsigned long i12 = 0xdefffffful; //-9223371487098961920
//   unsigned long i11 = 0x49fffffful; //2097151.875000
//   unsigned long i12 = 0x4a7ffffful; //4194303.750000

//   float x0  = hide_float(-FLT_MAX);           // -Inf
//   float x1  = hide_float(FLT_MAX);            // Inf
   float x2  = hide_float(0.0);                  // +0
   float x3  = hide_float(-0.0);                 // -0
//   float x4  = hide_float(NANF);            // NaN -> NaN
   float x5  = hide_float( 0.5);
   float x6  = hide_float(-0.5);
   float x7  = hide_float(-0.499999);
   float x8  = hide_float( 0.499999);
   float x9  = hide_float(-999999.5);
   float x10 = hide_float( 999999.5);
//   float x11 = hide_float(make_float(i11));
//   float x12 = hide_float(make_float(i12));
   float x11 = hide_float( 9223371487098961920.);
   float x12 = hide_float(-9223371487098961920.);
   float x13 = (0.0 - FLT_MIN);
   float x14 = FLT_MIN;
   float x15 = hide_float(-2097151.875000);
   float x16 = hide_float(-4194303.750000);
   float x17 = hide_float( 4194303.750000);
   float x18 = hide_float( 2097151.875000);

	vec_float4  x0_v = ((vec_float4){ x2, x3, x5, x6});
	llroundf4_t r0_v = set_llrintf4_t(0,  0,  0, 0);

	vec_float4  x1_v = ((vec_float4){ x7, x8,       x9,     x10});
	llroundf4_t r1_v = set_llrintf4_t(0,  0, -999999, 999999);

	vec_float4  x2_v = ((vec_float4){                    x11,                    x12, x13, x14});
	llroundf4_t r2_v = set_llrintf4_t(9223371487098961920ll, -9223371487098961920ll,    0,  0);

	vec_float4  x3_v = ((vec_float4){       x15,      x16,     x17,     x18});
	llroundf4_t r3_v = set_llrintf4_t(-2097151, -4194303, 4194303, 2097151);

	llroundf4_t  res_v;

   TEST_START("llrintf4");
   res_v = llrintf4 (x0_v);
   TEST_CHECK("20060918101001NM", allequal_llroundf4( res_v, r0_v ), 0);
   res_v = llrintf4 (x1_v);
   TEST_CHECK("20060918101002NM", allequal_llroundf4( res_v, r1_v ), 0);
   res_v = llrintf4 (x2_v);
   TEST_CHECK("20060918101003NM", allequal_llroundf4( res_v, r2_v ), 0);
   res_v = llrintf4 (x3_v);
   TEST_CHECK("20060918101004NM", allequal_llroundf4( res_v, r3_v ), 0);

   TEST_SET_DONE();

   TEST_EXIT();

}
Beispiel #2
0
int main()
{
   TEST_SET_START("20040928182349EJL","EJL", "rsqrtf4");

   unsigned int i3 =   0x742c4455;
   unsigned int i3r =  0x251c099a;
   unsigned int i4 =   0x75e7753f; 
   unsigned int i4r =  0x243e5fe2;
   unsigned int i5 =   0x4baa9e3c; 
   unsigned int i5r =  0x395dbbeb;
   unsigned int i6 =   0x39344296; 
   unsigned int i6r =  0x429889eb; 
   unsigned int i7 =   0x68a586b0; 
   unsigned int i7r =  0x2ae11e67;

   float x3 = hide_float(make_float(i3));
   float x3r = hide_float(make_float(i3r));   
   float x4 = hide_float(make_float(i4));     
   float x4r = hide_float(make_float(i4r));   
   float x5 = hide_float(make_float(i5));     
   float x5r = hide_float(make_float(i5r));   
   float x6 = hide_float(make_float(i6));     
   float x6r = hide_float(make_float(i6r));   
   float x7 = hide_float(make_float(i7));
   float x7r = hide_float(make_float(i7r));
   
   vec_float4 x3_v = spu_splats(x3);
   vec_float4 x3r_v = spu_splats(x3r);
   vec_float4 x4_v = spu_splats(x4);
   vec_float4 x4r_v = spu_splats(x4r);
   vec_float4 x5_v = spu_splats(x5);
   vec_float4 x5r_v = spu_splats(x5r);
   vec_float4 x6_v = spu_splats(x6);
   vec_float4 x6r_v = spu_splats(x6r);
   vec_float4 x7_v = spu_splats(x7);
   vec_float4 x7r_v = spu_splats(x7r);
   
   vec_float4 res_v;

   TEST_START("rsqrtf4");
   res_v = rsqrtf4(x3_v);
   TEST_CHECK("20040928182352EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
   res_v = rsqrtf4(x4_v);
   TEST_CHECK("20040928182355EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
   res_v = rsqrtf4(x5_v);
   TEST_CHECK("20040928182357EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
   res_v = rsqrtf4(x6_v);
   TEST_CHECK("20040928182358EJL", allequal_ulps_float4( res_v, x6r_v, 2 ), 0);
   res_v = rsqrtf4(x7_v);
   TEST_CHECK("20040928182401EJL", allequal_ulps_float4( res_v, x7r_v, 2 ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #3
0
int main()
{
   TEST_SET_START("20040916145017EJL","EJL", "floorf");
   
   unsigned int i3 = 0x4affffff;  // 2^23 - 0.5, largest truncatable value.           
   unsigned int i3i = 0x4afffffe;                                                      
   unsigned int i4 = 0x4b000000;  // 2^23, no fractional part.                        
   unsigned int i5 = 0xcf000001;  // -2^31, one more large, and negative, value.      

   float x0 = hide_float(0.91825f);
   float x0i = hide_float(0.0f);
   float x1 = hide_float(-0.12958f);
   float x1i = hide_float(-1.0f);
   float x2 = hide_float(-79615.1875f);
   float x2i = hide_float(-79616.0f);
   float x3 = hide_float(make_float(i3));
   float x3i = hide_float(make_float(i3i));
   float x4 = hide_float(make_float(i4));
   float x4i = hide_float(make_float(i4));
   float x5 = hide_float(make_float(i5));
   float x5i = hide_float(make_float(i5));

   vec_float4 x0_v = vec_splat_float(x0);
   vec_float4 x0i_v = vec_splat_float(x0i);
   vec_float4 x1_v = vec_splat_float(x1);
   vec_float4 x1i_v = vec_splat_float(x1i);
   vec_float4 x2_v = vec_splat_float(x2);
   vec_float4 x2i_v = vec_splat_float(x2i);
   vec_float4 x3_v = vec_splat_float(x3);
   vec_float4 x3i_v = vec_splat_float(x3i);
   vec_float4 x4_v = vec_splat_float(x4);
   vec_float4 x4i_v = vec_splat_float(x4i);
   vec_float4 x5_v = vec_splat_float(x5);
   vec_float4 x5i_v = vec_splat_float(x5i);
   
   vec_float4 res_v;

   TEST_START("floorf4");
   res_v = floorf4(x0_v);
   TEST_CHECK("20040916145022EJL", allequal_float4( res_v, x0i_v ), 0);
   res_v = floorf4(x1_v);
   TEST_CHECK("20040916145024EJL", allequal_float4( res_v, x1i_v ), 0);
   res_v = floorf4(x2_v);
   TEST_CHECK("20040916145027EJL", allequal_float4( res_v, x2i_v ), 0);
   res_v = floorf4(x3_v);
   TEST_CHECK("20040916145029EJL", allequal_float4( res_v, x3i_v ), 0);
   res_v = floorf4(x4_v);
   TEST_CHECK("20040916145032EJL", allequal_float4( res_v, x4i_v ), 0);
   res_v = floorf4(x5_v);
   TEST_CHECK("20040916145034EJL", allequal_float4( res_v, x5i_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #4
0
int main()
{
   TEST_SET_START("20040928182549EJL","EJL", "sqrtf4");

   unsigned int i3 =   0x742c4455;
   unsigned int i3r =  0x59d20034;
   unsigned int i4 =   0x75e7753f; 
   unsigned int i4r =  0x5aac1fb5;
   unsigned int i5 =   0x4baa9e3c; 
   unsigned int i5r =  0x4593c7d8;
   unsigned int i6 =   0x39344296; 
   unsigned int i6r =  0x3c56d14c; 
   unsigned int i7 =   0x68a586b0; 
   unsigned int i7r =  0x54118f09;

   float x3 = hide_float(make_float(i3));
   float x3r = hide_float(make_float(i3r));   
   float x4 = hide_float(make_float(i4));     
   float x4r = hide_float(make_float(i4r));   
   float x5 = hide_float(make_float(i5));     
   float x5r = hide_float(make_float(i5r));   
   float x6 = hide_float(make_float(i6));     
   float x6r = hide_float(make_float(i6r));   
   float x7 = hide_float(make_float(i7));
   float x7r = hide_float(make_float(i7r));
   
   vec_float4 x3_v = spu_splats(x3);
   vec_float4 x3r_v = spu_splats(x3r);
   vec_float4 x4_v = spu_splats(x4);
   vec_float4 x4r_v = spu_splats(x4r);
   vec_float4 x5_v = spu_splats(x5);
   vec_float4 x5r_v = spu_splats(x5r);
   vec_float4 x6_v = spu_splats(x6);
   vec_float4 x6r_v = spu_splats(x6r);
   vec_float4 x7_v = spu_splats(x7);
   vec_float4 x7r_v = spu_splats(x7r);
   
   vec_float4 res_v;

   TEST_START("sqrtf4");
   res_v = sqrtf4(x3_v);
   TEST_CHECK("20040928182552EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
   res_v = sqrtf4(x4_v);
   TEST_CHECK("20040928182554EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
   res_v = sqrtf4(x5_v);
   TEST_CHECK("20040928182556EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
   res_v = sqrtf4(x6_v);
   TEST_CHECK("20040928182557EJL", allequal_ulps_float4( res_v, x6r_v, 2 ), 0);
   res_v = sqrtf4(x7_v);
   TEST_CHECK("20040928182559EJL", allequal_ulps_float4( res_v, x7r_v, 2 ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #5
0
int main()
{
    TEST_SET_START("20040930102649EJL","EJL", "negatef4");

    unsigned int i3n = 0xffffffff;
    unsigned int i3p = 0x7fffffff;

    float x0n = hide_float(-0.0f);
    float x0p = hide_float(0.0f);
    float x1n = hide_float(-83532.96153153f);
    float x1p = hide_float(83532.96153153f);
    float x2n = hide_float(-0.0000000013152f);
    float x2p = hide_float(0.0000000013152f);
    float x3n = hide_float(make_float(i3n));
    float x3p = hide_float(make_float(i3p));

    vec_float4 x0n_v = spu_splats(x0n);
    vec_float4 x0p_v = spu_splats(x0p);
    vec_float4 x1n_v = spu_splats(x1n);
    vec_float4 x1p_v = spu_splats(x1p);
    vec_float4 x2n_v = spu_splats(x2n);
    vec_float4 x2p_v = spu_splats(x2p);
    vec_float4 x3n_v = spu_splats(x3n);
    vec_float4 x3p_v = spu_splats(x3p);

    vec_float4 res_v;

    TEST_START("negatef4");
    res_v = negatef4(x0n_v);
    TEST_CHECK("20040930102652EJL", allequal_float4( res_v, x0p_v ), 0);
    res_v = negatef4(x0p_v);
    TEST_CHECK("20040930102653EJL", allequal_float4( res_v, x0n_v ), 0);
    res_v = negatef4(x1n_v);
    TEST_CHECK("20040930102655EJL", allequal_float4( res_v, x1p_v ), 0);
    res_v = negatef4(x1p_v);
    TEST_CHECK("20040930102657EJL", allequal_float4( res_v, x1n_v ), 0);
    res_v = negatef4(x2n_v);
    TEST_CHECK("20040930102659EJL", allequal_float4( res_v, x2p_v ), 0);
    res_v = negatef4(x2p_v);
    TEST_CHECK("20040930102701EJL", allequal_float4( res_v, x2n_v ), 0);
    res_v = negatef4(x3n_v);
    TEST_CHECK("20040930102703EJL", allequal_float4( res_v, x3p_v ), 0);
    res_v = negatef4(x3p_v);
    TEST_CHECK("20040930102705EJL", allequal_float4( res_v, x3n_v ), 0);

    TEST_SET_DONE();

    TEST_EXIT();
}
Beispiel #6
0
int main()
{
   TEST_SET_START("20060731203500MH","MH", "negatell2");
   
   vec_llong2 x0n_v = spu_splats(0LL);
   vec_llong2 x0p_v = spu_splats(0LL);
   vec_llong2 x1n_v = spu_splats(-83582LL);
   vec_llong2 x1p_v = spu_splats(83582LL);
   vec_llong2 x2n_v = spu_splats(-13152LL);
   vec_llong2 x2p_v = spu_splats(13152LL);
   vec_llong2 x3n_v = spu_splats(-1LL);
   vec_llong2 x3p_v = spu_splats(1LL);
   vec_llong2 x4n_v = spu_splats((long long)0x8000000000000001ULL);
   vec_llong2 x4p_v = spu_splats(0x7fffffffffffffffLL);
   vec_llong2 x5n_v = spu_splats((long long)0x8000000100000000ULL);
   vec_llong2 x5p_v = spu_splats(0x7fffffff00000000LL);
   
   vec_llong2 res_v;

   TEST_START("negatell2");
   res_v = negatell2(x0n_v);
   TEST_CHECK("20060731203501MH", allequal_llong2( res_v, x0p_v ), 0);
   res_v = negatell2(x0p_v);
   TEST_CHECK("20060731203502MH", allequal_llong2( res_v, x0n_v ), 0);
   res_v = negatell2(x1n_v);
   TEST_CHECK("20060731203503MH", allequal_llong2( res_v, x1p_v ), 0);
   res_v = negatell2(x1p_v);
   TEST_CHECK("20060731203504MH", allequal_llong2( res_v, x1n_v ), 0);
   res_v = negatell2(x2n_v);
   TEST_CHECK("20060731203505MH", allequal_llong2( res_v, x2p_v ), 0);
   res_v = negatell2(x2p_v);
   TEST_CHECK("20060731203506MH", allequal_llong2( res_v, x2n_v ), 0);
   res_v = negatell2(x3n_v);
   TEST_CHECK("20060731203507MH", allequal_llong2( res_v, x3p_v ), 0);
   res_v = negatell2(x3p_v);
   TEST_CHECK("20060731203508MH", allequal_llong2( res_v, x3n_v ), 0);
   res_v = negatell2(x4n_v);
   TEST_CHECK("20060731203509MH", allequal_llong2( res_v, x4p_v ), 0);
   res_v = negatell2(x4p_v);
   TEST_CHECK("20060731203510MH", allequal_llong2( res_v, x4n_v ), 0);
   res_v = negatell2(x5n_v);
   TEST_CHECK("20060731203511MH", allequal_llong2( res_v, x5p_v ), 0);
   res_v = negatell2(x5p_v);
   TEST_CHECK("20060731203512MH", allequal_llong2( res_v, x5n_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #7
0
int main()
{
   TEST_SET_START("20040930102626EJL","EJL", "negated2");
   
   double x0n = hide_double(-0.0);
   double x0p = hide_double(0.0);
   double x1n = hide_double(-83532.96153153);
   double x1p = hide_double(83532.96153153);
   double x2n = hide_double(-0.0000000013152);
   double x2p = hide_double(0.0000000013152);
   double x3n = hide_double(-HUGE_VAL);
   double x3p = hide_double(HUGE_VAL);
   
   vec_double2 x0n_v = spu_splats(x0n);
   vec_double2 x0p_v = spu_splats(x0p);
   vec_double2 x1n_v = spu_splats(x1n);
   vec_double2 x1p_v = spu_splats(x1p);
   vec_double2 x2n_v = spu_splats(x2n);
   vec_double2 x2p_v = spu_splats(x2p);
   vec_double2 x3n_v = spu_splats(x3n);
   vec_double2 x3p_v = spu_splats(x3p);
   
   vec_double2 res_v;

   TEST_START("negated2");
   res_v = negated2(x0n_v);
   TEST_CHECK("20040930102629EJL", allequal_double2( res_v, x0p_v ), 0);
   res_v = negated2(x0p_v);
   TEST_CHECK("20040930102631EJL", allequal_double2( res_v, x0n_v ), 0);
   res_v = negated2(x1n_v);
   TEST_CHECK("20040930102632EJL", allequal_double2( res_v, x1p_v ), 0);
   res_v = negated2(x1p_v);
   TEST_CHECK("20040930102635EJL", allequal_double2( res_v, x1n_v ), 0);
   res_v = negated2(x2n_v);
   TEST_CHECK("20040930102637EJL", allequal_double2( res_v, x2p_v ), 0);
   res_v = negated2(x2p_v);
   TEST_CHECK("20040930102639EJL", allequal_double2( res_v, x2n_v ), 0);
   res_v = negated2(x3n_v);
   TEST_CHECK("20040930102641EJL", allposinf_double2( res_v ), 0);
   res_v = negated2(x3p_v);
   TEST_CHECK("20040930102643EJL", allneginf_double2( res_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #8
0
int main()
{
   TEST_SET_START("20040930102649EJL","EJL", "negatei4");
   
   int x0n = hide_int(0);
   int x0p = hide_int(0);
   int x1n = hide_int(-83532);
   int x1p = hide_int(83532);
   int x2n = hide_int(-13152);
   int x2p = hide_int(13152);
   int x3n = hide_int(-1);
   int x3p = hide_int(1);
   
   vec_int4 x0n_v = spu_splats(x0n);
   vec_int4 x0p_v = spu_splats(x0p);
   vec_int4 x1n_v = spu_splats(x1n);
   vec_int4 x1p_v = spu_splats(x1p);
   vec_int4 x2n_v = spu_splats(x2n);
   vec_int4 x2p_v = spu_splats(x2p);
   vec_int4 x3n_v = spu_splats(x3n);
   vec_int4 x3p_v = spu_splats(x3p);
   
   vec_int4 res_v;

   TEST_START("negatei4");
   res_v = negatei4(x0n_v);
   TEST_CHECK("20040930102652EJL", allequal_int4( res_v, x0p_v ), 0);
   res_v = negatei4(x0p_v);
   TEST_CHECK("20040930102653EJL", allequal_int4( res_v, x0n_v ), 0);
   res_v = negatei4(x1n_v);
   TEST_CHECK("20040930102655EJL", allequal_int4( res_v, x1p_v ), 0);
   res_v = negatei4(x1p_v);
   TEST_CHECK("20040930102657EJL", allequal_int4( res_v, x1n_v ), 0);
   res_v = negatei4(x2n_v);
   TEST_CHECK("20040930102659EJL", allequal_int4( res_v, x2p_v ), 0);
   res_v = negatei4(x2p_v);
   TEST_CHECK("20040930102701EJL", allequal_int4( res_v, x2n_v ), 0);
   res_v = negatei4(x3n_v);
   TEST_CHECK("20040930102703EJL", allequal_int4( res_v, x3p_v ), 0);
   res_v = negatei4(x3p_v);
   TEST_CHECK("20040930102705EJL", allequal_int4( res_v, x3n_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #9
0
int main()
{
   vec_float4 res_v;

   TEST_SET_START("164260798500","RUD", "roundf4");
 

 
   //s=0
   DEFINE_DATA(x1, 1.0, 1.0f)
     DEFINE_DATA(x2, -1.0,-1.0f)
     //s=-1
     DEFINE_DATA(x3, 0.5, 1.0f)
     DEFINE_DATA(x4, -0.5, -1.0f)
     //s=-2
     DEFINE_DATA(x5, 0.25, 0.0f)
     //s=-3
     DEFINE_DATA(x6, 0.125, 0.0f)
     //s=0, e=128, f=7fffff  --> s=0, e=128, f=7fffff 
     DEFINE_DATA_UNSIGNED(x7,0x7fffffff,0x7fffffff)
     //s=0, e=-126, f=0 --> 0
     DEFINE_DATA_UNSIGNED(x8, 0x800000,0x0)
     DEFINE_DATA(x9, 0.4999, 0.f)
     DEFINE_DATA(x10, 0.9999, 1.f)

     //TEST
     TEST_START("roundf4");
     DO_TEST(x1,164260798501RUD)
     DO_TEST(x2,164260798502RUD)
     DO_TEST(x3,164260798503RUD)
     DO_TEST(x4,164260798504RUD)
     DO_TEST(x5,164260798505RUD)
     DO_TEST(x6,164260798506RUD)
     DO_TEST(x7,164260798507RUD)
     DO_TEST(x8,164260798508RUD)
     DO_TEST(x9,164260798509RUD)
     DO_TEST(x10,164260798510RUD)
     TEST_SET_DONE();

   
   TEST_EXIT();
}
Beispiel #10
0
int main()
{
   vec_int4  res_v;

   TEST_SET_START("921537538600","RNT", "irintf4");

   /*  
       Define original values and  the results 
   */
     //s=0
   DEFINE_DATA(x1, 1.0, 1)
     DEFINE_DATA(x2, -1.0,-1)
     
     //s=-1
     DEFINE_DATA(x3, 0.5, 0)
     DEFINE_DATA(x4, -0.5, 0)
     //s=-2
     DEFINE_DATA(x5, 0.25, 0)
     //s=-3
     DEFINE_DATA(x6, 0.125, 0)

     //s=0, e=27, f=0  -> 134217728
     DEFINE_DATA_UNSIGNED(x7, 0x4d000000,134217728)
     //s=0, e=-126, f=0 --> 0
     DEFINE_DATA_UNSIGNED(x8, 0x800000,0)

   /*     TEST   */
   TEST_START("irintf4");
   
   DO_TEST(x1,921537538601RNT)
     DO_TEST(x2,921537538602RNT)
     DO_TEST(x3,921537538603RNT)
     DO_TEST(x4,921537538604RNT)
     DO_TEST(x5,921537538605RNT)
     DO_TEST(x6,921537538606RNT)
     DO_TEST(x7,921537538607RNT)
     DO_TEST(x8,921537538608RNT)
     
   TEST_SET_DONE();
 
   TEST_EXIT();
}
Beispiel #11
0
int main()
{
   TEST_SET_START("20040908101807EJL","EJL", "abs");
   
   int x0n = hide_int(0);
   int x0p = hide_int(0);
   int x1n = hide_int(-1);
   int x1p = hide_int(1);
   int x2n = hide_int(-83532);
   int x2p = hide_int(83532);

   vec_int4 x0n_v = vec_splat_int(x0n);
   vec_int4 x0p_v = vec_splat_int(x0p);
   vec_int4 x1n_v = vec_splat_int(x1n);
   vec_int4 x1p_v = vec_splat_int(x1p);
   vec_int4 x2n_v = vec_splat_int(x2n);
   vec_int4 x2p_v = vec_splat_int(x2p);
   
   vec_int4 res_v;

   TEST_START("absi4");
   res_v = absi4(x0n_v);
   TEST_CHECK("20040908103824EJL", allequal_int4( res_v, x0p_v ), 0);
   res_v = absi4(x0p_v);
   TEST_CHECK("20040908103903EJL", allequal_int4( res_v, x0p_v ), 0);
   res_v = absi4(x1n_v);
   TEST_CHECK("20040908103905EJL", allequal_int4( res_v, x1p_v ), 0);
   res_v = absi4(x1p_v);
   TEST_CHECK("20040908114003EJL", allequal_int4( res_v, x1p_v ), 0);
   res_v = absi4(x2n_v);
   TEST_CHECK("20040908114714EJL", allequal_int4( res_v, x2p_v ), 0);
   res_v = absi4(x2p_v);
   TEST_CHECK("20040908114715EJL", allequal_int4( res_v, x2p_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #12
0
int main()
{
	TEST_SET_START("20060831134500NM","NM", "llabsi2");

	vec_llong2 x0_v = ((vec_llong2){ 0, 0});
	vec_llong2 r0_v = ((vec_llong2){ 0, 0});

	vec_llong2 x1_v = ((vec_llong2){-1, 1});
	vec_llong2 r1_v = ((vec_llong2){ 1, 1});

	vec_llong2 x2_v = ((vec_llong2){ 1,-1});
	vec_llong2 r2_v = ((vec_llong2){ 1, 1});
	// 0x7FFFFFFFFFFFFFFF
	vec_llong2 x3_v = ((vec_llong2){ 9223372036854775807LL,-9223372036854775807LL});
	vec_llong2 r3_v = ((vec_llong2){ 9223372036854775807LL, 9223372036854775807LL});
	// 0x8000000000000000
	vec_llong2 x4_v = ((vec_llong2){0x8000000000000000LL,0x8000000000000000LL});
	vec_llong2 r4_v = ((vec_llong2){0x8000000000000000LL,0x8000000000000000LL});

	vec_llong2  res_v;

   TEST_START("llabsi2");
   res_v = llabsi2 (x0_v);
   TEST_CHECK("20060831134501NM", allequal_llong2( res_v, r0_v ), 0);
   res_v = llabsi2 (x1_v);
   TEST_CHECK("20060831134502NM", allequal_llong2( res_v, r1_v ), 0);
   res_v = llabsi2 (x2_v);
   TEST_CHECK("20060831134503NM", allequal_llong2( res_v, r2_v ), 0);
   res_v = llabsi2 (x3_v);
   TEST_CHECK("20060831134504NM", allequal_llong2( res_v, r3_v ), 0);
   res_v = llabsi2 (x4_v);
   TEST_CHECK("20060831134505NM", allequal_llong2( res_v, r4_v ), 0);

   TEST_SET_DONE();

   TEST_EXIT();

}
Beispiel #13
0
int main()
{
	TestVec64_RemqD test_a[] = {
		{
			// normal 2.5/1.5 29/3
			{0x4004000000000000ULL,0x403d000000000000ULL},
			{0x3ff8000000000000ULL,0x4008000000000000ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL},
			{0xbfe0000000000000ULL,0xbff0000000000000ULL},
			{0x0000000000000002ULL,0x0000000000000002ULL}
		},{
			// normal 
			{0x09d0000000000006ULL,0x1000000000000000ULL},
			{0x8010000000000005ULL,0x0010000000000007ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL},
			{0x800000000000007dULL,0x80037ffffffff1a5ULL},
			{0xFFFFFFFFFFFFFFFFULL,0x0000000000000003ULL}
		},{
			// denorm
			{0x0000000000000001ULL,0x800ffffffffffff3ULL},
			{0x8000000000000001ULL,0x8000000000000005ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL},
			{0x0000000000000000ULL,0x0000000000000002ULL},
			{0xFFFFFFFFFFFFFFFFULL,0x0000000000000001ULL}
		},{
			// divide by inf
			{0xFFEFFFFFFFFFFFFFULL,0x0001000000000000ULL},
			{0x7FF0000000000000ULL,0x7FF0000000000000ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL},
			{0xFFEFFFFFFFFFFFFFULL,0x0001000000000000ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL}
		},{
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL}
			
		}
	};
	TestVec64_RemqD test_b[] = {
		{
			// divide by zero -> nan
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL},
			{0x7ff8000000000000ULL,0x7ff8000000000000ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL}
		},{
			// Inf , -Inf
			{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
			{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL},
			{0x7ff8000000000000ULL,0x7ff8000000000000ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL}
		},{
			// border
			{0xFFE0000000000000ULL,0x7FEFFFFFFFFFFFFFULL},
			{0x0008000000000000ULL,0x0010000000000000ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL},
			{0x8000000000000000ULL,0x0000000000000000ULL},
			{0x0000000000000000ULL,0x0000000000000000ULL}
		},{
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL}
			
		}
	};
	int ii, test_ctr = 1;
	char msg[80];
	vec_double2 res_v;

	TEST_SET_START("20060919210000NM","NM", "remquod2");

   TEST_START("remquod2");

	for (ii=0; ; ii++) {
		if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;

		// set Floating point round mode
		res_v = remquod2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_double2 *)&test_a[ii].yyy[0]), ((vec_llong2 *)&test_a[ii].quo[0]));
		sprintf(msg,"2006091921%04dNM", test_ctr++);
		TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].a_res[0])), 0);
		sprintf(msg,"2006091922%04dNM", test_ctr++);
		TEST_CHECK(msg, allequal_llong2( *((vec_llong2 *)&test_a[ii].quo[0]), *((vec_llong2 *)&test_a[ii].a_quo[0])), 0);
	}
	for (ii=0; ; ii++) {
		if ( (test_b[ii].xxx[0] == 0) && (test_b[ii].xxx[1] == 0) ) break;

		// set Floating point round mode
		res_v = remquod2 (*((vec_double2 *)&test_b[ii].xxx[0]), *((vec_double2 *)&test_b[ii].yyy[0]), ((vec_llong2 *)&test_b[ii].quo[0]));
		sprintf(msg,"2006091923%04dNM", test_ctr++);
		TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_b[ii].a_res[0])), 0);
	}

   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #14
0
int main()
{
   TEST_SET_START("20040920142553EJL","EJL", "recipf4");

   unsigned int i0r = 0x7fffffff;  
   unsigned int i1 = 0xff000000;   // -2^127
   unsigned int i2 = 0xfe7fffff;   // -2^126 - 1 ulp
   unsigned int i2r = 0x80800001;  
   unsigned int i3 =   0x75013340; // random values
   unsigned int i3r =  0x09fd9f35;
   unsigned int i4 =   0x75e7753f; 
   unsigned int i4r =  0x090d9277;
   unsigned int i5 =   0x4c7fed5a; 
   unsigned int i5r =  0x32800954;
   unsigned int i6 =   0x3a0731f0; 
   unsigned int i6r =  0x44f2602e; 
   unsigned int i7 =   0x69784a07; 
   unsigned int i7r =  0x1583f9a3;

   float x0 = hide_float(0.0f);
   float x0r = hide_float(make_float(i0r));
   float x1 = hide_float(make_float(i1));
   float x1r = hide_float(0.0f);
   float x2 = hide_float(make_float(i2));
   float x2r = hide_float(make_float(i2r));   
   float x3 = hide_float(make_float(i3));
   float x3r = hide_float(make_float(i3r));   
   float x4 = hide_float(make_float(i4));     
   float x4r = hide_float(make_float(i4r));   
   float x5 = hide_float(make_float(i5));     
   float x5r = hide_float(make_float(i5r));   
   float x6 = hide_float(make_float(i6));     
   float x6r = hide_float(make_float(i6r));   
   float x7 = hide_float(make_float(i7));
   float x7r = hide_float(make_float(i7r));
   
   vec_float4 x0_v = spu_splats(x0);
   vec_float4 x0r_v = spu_splats(x0r);
   vec_float4 x1_v = spu_splats(x1);
   vec_float4 x1r_v = spu_splats(x1r);
   vec_float4 x2_v = spu_splats(x2);
   vec_float4 x2r_v = spu_splats(x2r);
   vec_float4 x3_v = spu_splats(x3);
   vec_float4 x3r_v = spu_splats(x3r);
   vec_float4 x4_v = spu_splats(x4);
   vec_float4 x4r_v = spu_splats(x4r);
   vec_float4 x5_v = spu_splats(x5);
   vec_float4 x5r_v = spu_splats(x5r);
   vec_float4 x6_v = spu_splats(x6);
   vec_float4 x6r_v = spu_splats(x6r);
   vec_float4 x7_v = spu_splats(x7);
   vec_float4 x7r_v = spu_splats(x7r);
   
   vec_float4 res_v;

   TEST_START("recipf4");
   res_v = recipf4(x0_v);
   TEST_CHECK("20040920142558EJL", allequal_float4( res_v, x0r_v ), 0);
   res_v = recipf4(x1_v);
   TEST_CHECK("20040920142600EJL", allequal_float4( res_v, x1r_v), 0);
   res_v = recipf4(x2_v);
   TEST_CHECK("20040920142602EJL", allequal_ulps_float4( res_v, x2r_v, 2 ), 0);
   res_v = recipf4(x3_v);
   TEST_CHECK("20040920142604EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
   res_v = recipf4(x4_v);
   TEST_CHECK("20040920142606EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
   res_v = recipf4(x5_v);
   TEST_CHECK("20040920142608EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
   res_v = recipf4(x6_v);
   TEST_CHECK("20040920142609EJL", allequal_ulps_float4( res_v, x6r_v, 2 ), 0);
   res_v = recipf4(x7_v);
   TEST_CHECK("20040920142611EJL", allequal_ulps_float4( res_v, x7r_v, 2 ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #15
0
int main()
{
   TEST_SET_START("20060825000000AAN","AAN", "isgreaterequald2");

   //-QNaN: NG
   double x0 = hide_double(-nan(""));
   double y0 = hide_double(1.0);
   unsigned long long r0 = 0x0000000000000000ull;

   //+Inf > -Inf
   double x1 = hide_double( HUGE_VAL);
   double y1 = hide_double(-HUGE_VAL);
   unsigned long long r1 = 0xffffffffffffffffull;

   //-Inf < -Dmax
   double x2 = hide_double(-HUGE_VAL);
   double y2 = hide_double(-DBL_MAX);
   unsigned long long r2 = 0x0000000000000000ull;

   //-Norm > -Inf
   double x3 = hide_double(-67418234.34256245);
   double y3 = hide_double(-HUGE_VAL);
   unsigned long long r3 = 0xffffffffffffffffull;

   //-Norm < -Denorm
   double x4 = hide_double(-273453.3234458053);
   double y4 = hide_double(-3.0e-321);
   unsigned long long r4 = 0x0000000000000000ull;

   //-Norm = -Norm
   double x5 = hide_double(-168.97345223013);
   double y5 = hide_double(-168.97345223013);
   unsigned long long r5 = 0xffffffffffffffffull;

   //-Norm > -Norm
   double x6 = hide_double(-168.97345223013);
   double y6 = hide_double(-21345853556.492);
   unsigned long long r6 = 0xffffffffffffffffull;

   //-Norm < -0
   double x7 = hide_double(-168.97345223013);
   double y7 = hide_double(-0.0);
   unsigned long long r7 = 0x0000000000000000ull;

   //-Unf > -Norm
   double x8 = hide_double(-1.0e-999);
   double y8 = hide_double(-83532.96153153);
   unsigned long long r8 = 0xffffffffffffffffull;

   //-Unf = 0
   double x9 = hide_double(-1.0e-999);
   double y9 = hide_double(0.0);
   unsigned long long r9 = 0xffffffffffffffffull;

   //-0 = 0
   double x10 = hide_double(-0.0);
   double y10 = hide_double( 0.0);
   unsigned long long r10 = 0xffffffffffffffffull;

   //+Unf = 0
   double x11 = hide_double( 1.0e-999);
   double y11 = hide_double( 0.0);
   unsigned long long r11 = 0xffffffffffffffffull;

   //+Unf < +Norm
   double x12 = hide_double( 1e-999);
   double y12 = hide_double(0.0031529324);
   unsigned long long r12 = 0x0000000000000000ull;

   //+Norm > +Denorm
   double x13 = hide_double(5172.2845321);
   double y13 = hide_double(3.0e-321);
   unsigned long long r13 = 0xffffffffffffffffull;

   //+Norm = +Norm
   double x14 = hide_double(5172.2845321);
   double y14 = hide_double(5172.2845321);
   unsigned long long r14 = 0xffffffffffffffffull;

   //+Norm < +Norm
   double x15 = hide_double(264.345643345);
   double y15 = hide_double(2353705.31415);
   unsigned long long r15 = 0x0000000000000000ull;

   //+Norm > -Norm
   double x16 = hide_double( 926.605118542);
   double y16 = hide_double(-9.43574552184);
   unsigned long long r16 = 0xffffffffffffffffull;

   //+Norm < +Dmax
   double x17 = hide_double( 926.605118542);
   double y17 = hide_double(DBL_MAX);
   unsigned long long r17 = 0x0000000000000000ull;
   
   //+Inf > +Dmax
   double x18 = hide_double(HUGE_VAL);
   double y18 = hide_double(DBL_MAX);
   unsigned long long r18 = 0xffffffffffffffffull;

   //+QNaN: NG
   double x19 = hide_double(nan(""));
   double y19 = hide_double(3.14);
   unsigned long long r19 = 0x0000000000000000ull;

   vec_double2 x0_v = spu_splats(x0);
   vec_double2 y0_v = spu_splats(y0);
   vec_ullong2 r0_v = spu_splats(r0);

   vec_double2 x1_v = spu_splats(x1);
   vec_double2 y1_v = spu_splats(y1);
   vec_ullong2 r1_v = spu_splats(r1);

   vec_double2 x2_v = spu_splats(x2);
   vec_double2 y2_v = spu_splats(y2);
   vec_ullong2 r2_v = spu_splats(r2);

   vec_double2 x3_v = spu_splats(x3);
   vec_double2 y3_v = spu_splats(y3);
   vec_ullong2 r3_v = spu_splats(r3);

   vec_double2 x4_v = spu_splats(x4);
   vec_double2 y4_v = spu_splats(y4);
   vec_ullong2 r4_v = spu_splats(r4);

   vec_double2 x5_v = spu_splats(x5);
   vec_double2 y5_v = spu_splats(y5);
   vec_ullong2 r5_v = spu_splats(r5);

   vec_double2 x6_v = spu_splats(x6);
   vec_double2 y6_v = spu_splats(y6);
   vec_ullong2 r6_v = spu_splats(r6);

   vec_double2 x7_v = spu_splats(x7);
   vec_double2 y7_v = spu_splats(y7);
   vec_ullong2 r7_v = spu_splats(r7);

   vec_double2 x8_v = spu_splats(x8);
   vec_double2 y8_v = spu_splats(y8);
   vec_ullong2 r8_v = spu_splats(r8);

   vec_double2 x9_v = spu_splats(x9);
   vec_double2 y9_v = spu_splats(y9);
   vec_ullong2 r9_v = spu_splats(r9);

   vec_double2 x10_v = spu_splats(x10);
   vec_double2 y10_v = spu_splats(y10);
   vec_ullong2 r10_v = spu_splats(r10);

   vec_double2 x11_v = spu_splats(x11);
   vec_double2 y11_v = spu_splats(y11);
   vec_ullong2 r11_v = spu_splats(r11);

   vec_double2 x12_v = spu_splats(x12);
   vec_double2 y12_v = spu_splats(y12);
   vec_ullong2 r12_v = spu_splats(r12);

   vec_double2 x13_v = spu_splats(x13);
   vec_double2 y13_v = spu_splats(y13);
   vec_ullong2 r13_v = spu_splats(r13);

   vec_double2 x14_v = spu_splats(x14);
   vec_double2 y14_v = spu_splats(y14);
   vec_ullong2 r14_v = spu_splats(r14);

   vec_double2 x15_v = spu_splats(x15);
   vec_double2 y15_v = spu_splats(y15);
   vec_ullong2 r15_v = spu_splats(r15);

   vec_double2 x16_v = spu_splats(x16);
   vec_double2 y16_v = spu_splats(y16);
   vec_ullong2 r16_v = spu_splats(r16);

   vec_double2 x17_v = spu_splats(x17);
   vec_double2 y17_v = spu_splats(y17);
   vec_ullong2 r17_v = spu_splats(r17);

   vec_double2 x18_v = spu_splats(x18);
   vec_double2 y18_v = spu_splats(y18);
   vec_ullong2 r18_v = spu_splats(r18);

   vec_double2 x19_v = spu_splats(x19);
   vec_double2 y19_v = spu_splats(y19);
   vec_ullong2 r19_v = spu_splats(r19);
     
   vec_ullong2 res_v;

   TEST_START("isgreaterequald2");

   res_v = (vec_ullong2)isgreaterequald2(x0_v, y0_v);
   TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r0_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x1_v, y1_v);
   TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r1_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x2_v, y2_v);
   TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r2_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x3_v, y3_v);
   TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r3_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x4_v, y4_v);
   TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r4_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x5_v, y5_v);
   TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r5_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x6_v, y6_v);
   TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r6_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x7_v, y7_v);
   TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r7_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x8_v, y8_v);
   TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r8_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x9_v, y9_v);
   TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r9_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x10_v, y10_v);
   TEST_CHECK("20060825000000AAN", allequal_ullong2( res_v, r10_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x11_v, y11_v);
   TEST_CHECK("20060825000001AAN", allequal_ullong2( res_v, r11_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x12_v, y12_v);
   TEST_CHECK("20060825000002AAN", allequal_ullong2( res_v, r12_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x13_v, y13_v);
   TEST_CHECK("20060825000003AAN", allequal_ullong2( res_v, r13_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x14_v, y14_v);
   TEST_CHECK("20060825000004AAN", allequal_ullong2( res_v, r14_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x15_v, y15_v);
   TEST_CHECK("20060825000005AAN", allequal_ullong2( res_v, r15_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x16_v, y16_v);
   TEST_CHECK("20060825000006AAN", allequal_ullong2( res_v, r16_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x17_v, y17_v);
   TEST_CHECK("20060825000007AAN", allequal_ullong2( res_v, r17_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x18_v, y18_v);
   TEST_CHECK("20060825000008AAN", allequal_ullong2( res_v, r18_v ), 0);
   res_v = (vec_ullong2)isgreaterequald2(x19_v, y19_v);
   TEST_CHECK("20060825000009AAN", allequal_ullong2( res_v, r19_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #16
0
int main()
{
	TestVec64_NexA test_a[] = {
		{
			// -1 -> -0 , 0 -> -1
			{0x8000000000000001ULL,0x0000000000000000ULL},
			{0x8000000000000000ULL,0x8000000000000001ULL},
			{0x8000000000000000ULL,0x8000000000000001ULL}
		},{
			// -1 -> -0 , 0 -> -1
			{0x8000000000000001ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000001ULL},
			{0x8000000000000000ULL,0x8000000000000001ULL}
		},{
			// 0 -> -0 , -0 -> 0
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x8000000000000000ULL,0x0000000000000000ULL},
			{0x8000000000000000ULL,0x0000000000000000ULL}
		},{
			// -Inf -> MIN , Inf -> MAX
			{0xFFF0000000000000ULL,0x7FF0000000000000ULL},
			{0x0010000000000000ULL,0x0000000000000000ULL},
			{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}
		},{
			// MAX -> Inf , MIN -> -Inf
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
			{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
			{0x7FF0000000000000ULL,0xFFF0000000000000ULL}
		},{
			// Denormalize -> Denormalize
			{0x0000000000000001ULL,0x8000000000000010ULL},
			{0x0000000000000003ULL,0x8000000000000020ULL},
			{0x0000000000000002ULL,0x8000000000000011ULL}
		},{
			// Denormalize -> Normalize
			{0x000FFFFFFFFFFFFFULL,0x800FFFFFFFFFFFFFULL},
			{0x0020000000000000ULL,0x8020000000000000ULL},
			{0x0010000000000000ULL,0x8010000000000000ULL}
		},{
			// Normalize -> Denormalize
			{0x0010000000000000ULL,0x8010000000000000ULL},
			{0x8010000000000000ULL,0x0020000000000000ULL},
			{0x000FFFFFFFFFFFFFULL,0x800FFFFFFFFFFFFFULL}
		},{
			// equal
			{0x8FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL},
			{0x8FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL},
			{0x8FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL}
		},{
			// 
			{0x8FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL},
			{0x9FFFFFFFFFFFFFFFULL,0x1FFFFFFFFFFFFFFFULL},
			{0x9000000000000000ULL,0x1000000000000000ULL}
		},{
			// 
			{0x7000000000000000ULL,0xF000000000000000ULL},
			{0x0000000000000001ULL,0x8000000000000001ULL},
			{0x6FFFFFFFFFFFFFFFULL,0xEFFFFFFFFFFFFFFFULL}
		},{
			// Nan
			{0x7000000000000000ULL,0xF000000000000000ULL},
			{0xFFF0000000000001ULL,0x7FF0000000000001ULL},
			{0xFFF0000000000001ULL,0x7FF0000000000001ULL}
		},{
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL}
			
		}
	};
	int ii, test_ctr = 1;
	char msg[80];
	vec_double2 res_v;

	TEST_SET_START("20060828130000NM","NM", "nextafterd2");

   TEST_START("nextafterd2");

	for (ii=0; ; ii++) {
		if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;

		res_v = nextafterd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_double2 *)&test_a[ii].yyy[0]));
		sprintf(msg,"2006082813%04dNM", test_ctr++);
		TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans[0])), 0);
	}

   TEST_SET_DONE();

   TEST_EXIT();

}
Beispiel #17
0
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();
}
Beispiel #18
0
int main()
{
	TestVec64_Ldexp test_a[] = {
		{
			// zero
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000400ULL,0xFFFFFFFFFFFFFC00ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL}
		},{
			// MIN , MAX
			{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
			{0x0000000000000001ULL,0x0000000000000001ULL},
			{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
			{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
			{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL},
			{0xFFEFFFFFFFFFFFFFULL,0x7FEFFFFFFFFFFFFFULL}
		},{
			// Inf , -Inf
			{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
			{0x0000000000000001ULL,0x0000000000000001ULL},
			{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
			{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
			{0x7FF0000000000000ULL,0xFFF0000000000000ULL},
			{0x7FF0000000000000ULL,0xFFF0000000000000ULL}
		},{
#ifdef LDEXPD2_ROUND
			// denotmalized 
			{0x8000000000000003ULL,0x0000000000000003ULL},
			{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
			{0x8000000000000002ULL,0x0000000000000001ULL},
			{0x8000000000000001ULL,0x0000000000000002ULL},
			{0x8000000000000001ULL,0x0000000000000001ULL},
			{0x8000000000000002ULL,0x0000000000000002ULL}
		},{
			// denotmalized -54
			{0x0010000000000001ULL,0x8010000000000001ULL},
			{0xFFFFFFFFFFFFFFCAULL,0xFFFFFFFFFFFFFFCAULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000001ULL,0x8000000000000001ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL}
		},{
			// max -> !
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
			{0xFFFFFFFFFFFFF7CEULL,0xFFFFFFFFFFFFF7CEULL},
			{0x0000000000000001ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000001ULL,0x8000000000000001ULL},
			{0x0000000000000000ULL,0x8000000000000001ULL}
		},{
			// max -> !
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
			{0xFFFFFFFFFFFFF7CDULL,0xFFFFFFFFFFFFF7CDULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000001ULL,0x8000000000000001ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL}
		},{
#else  // LDEXPD2_ROUND
			// denotmalized 
			{0x8000000000000003ULL,0x0000000000000003ULL},
			{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
			{0x8000000000000001ULL,0x0000000000000001ULL},
			{0x8000000000000001ULL,0x0000000000000001ULL},
			{0x8000000000000001ULL,0x0000000000000001ULL},
			{0x8000000000000001ULL,0x0000000000000001ULL}
		},{

#endif  // LDEXPD2_ROUND
			// denotmalized 
			{0x0010000000000000ULL,0x8010000000000000ULL},
			{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
			{0x0008000000000000ULL,0x8008000000000000ULL},
			{0x0008000000000000ULL,0x8008000000000000ULL},
			{0x0008000000000000ULL,0x8008000000000000ULL},
			{0x0008000000000000ULL,0x8008000000000000ULL}
		},{
			// denotmalized 
			{0x0008000000000000ULL,0x8008000000000000ULL},
			{0x0000000000000001ULL,0x0000000000000001ULL},
			{0x0010000000000000ULL,0x8010000000000000ULL},
			{0x0010000000000000ULL,0x8010000000000000ULL},
			{0x0010000000000000ULL,0x8010000000000000ULL},
			{0x0010000000000000ULL,0x8010000000000000ULL}
		},{
			// 1.0 
			{0x3ff0000000000000ULL,0xbff0000000000000ULL},
			{0x00000000000003ffULL,0x00000000000003ffULL},
			{0x7FE0000000000000ULL,0xFFE0000000000000ULL},
			{0x7FE0000000000000ULL,0xFFE0000000000000ULL},
			{0x7FE0000000000000ULL,0xFFE0000000000000ULL},
			{0x7FE0000000000000ULL,0xFFE0000000000000ULL}
		},{
			// 1.0 -> max
			{0x3ff0000000000000ULL,0xbff0000000000000ULL},
			{0x0000000000000400ULL,0x0000000000000400ULL},
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}
		},{
			// max -> !
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
			{0xFFFFFFFF00000000ULL,0xFFFFFFFF00000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL},
			{0x0000000000000000ULL,0x8000000000000000ULL}
		},{
			// min-> 
			{0x0000000000000001ULL,0x8000000000000001ULL},
			{0x0FFFFFFFFFFFFFFFULL,0x0FFFFFFFFFFFFFFFULL},
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL},
			{0x7FEFFFFFFFFFFFFFULL,0xFFEFFFFFFFFFFFFFULL}
		},{
			// NaN , -NaN
			{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
			{0x0000000000000001ULL,0x0000000000000001ULL},
			{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
			{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
			{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
			{0x7FFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL}
		},{
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL},
			{0ULL,0ULL}
		}
	};
	int ii, test_ctr = 1;
	char msg[80];
	vec_double2 res_v;

	TEST_SET_START("20060905160000NM","NM", "ldexpd2");

   TEST_START("ldexpd2");

	for (ii=0; ; ii++) {
		if ( (test_a[ii].xxx[0] == 0) && (test_a[ii].xxx[1] == 0) ) break;

		// set Floating point round mode
		spu_mtfpscr(((vec_uint4){0x0100,0,0,0}));
		res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
		sprintf(msg,"2006090516%04dNM", test_ctr++);
		TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans0[0])), 0);

#ifdef LDEXPD2_ROUND

		spu_mtfpscr(((vec_uint4){0x0600,0,0,0}));
		res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
		sprintf(msg,"2006090516%04dNM", test_ctr++);
		TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans1[0])), 0);

		spu_mtfpscr(((vec_uint4){0x0b00,0,0,0}));
		res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
		sprintf(msg,"2006090516%04dNM", test_ctr++);
		TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans2[0])), 0);

		spu_mtfpscr(((vec_uint4){0x0c00,0,0,0}));
		res_v = ldexpd2 (*((vec_double2 *)&test_a[ii].xxx[0]), *((vec_llong2 *)&test_a[ii].exp[0]));
		sprintf(msg,"2006090516%04dNM", test_ctr++);
		TEST_CHECK(msg, allequal_llong2( (vec_llong2)res_v, *((vec_llong2 *)&test_a[ii].ans3[0])), 0);
#endif  // LDEXPD2_ROUND

	}


   TEST_SET_DONE();

   TEST_EXIT();

}
Beispiel #19
0
int main()
{
   TEST_SET_START("20060829000000AAN","AAN", "signbitf4");
   
   //-Nan
   float x0 = hide_float(-NANF);
   unsigned int r0 = 0xffffffff;

   //-Inf
   float x1 = hide_float(-HUGE_VAL);
   unsigned int r1 = 0xffffffff;

   //-Smax
   float x2 = hide_float(-FLT_MAX);
   unsigned int r2 = 0xffffffff;
   
   //-Norm
   float x3 = hide_float(-168.97345223013f);
   unsigned int r3 = 0xffffffff;

   //-Denorm
   float x4 = hide_float(make_float(0x803AAAAA));
   unsigned int r4 = 0xffffffff;

   //-Smin
   float x5 = hide_float(-FLT_MIN);
   unsigned int r5 = 0xffffffff;

   //-Unf
   float x6 = hide_float(-1.0e-999);
   unsigned int r6 = 0xffffffff;

   // -0
   float x7 = hide_float(-0.0f);
   unsigned int r7 = 0xffffffff;

   // 0
   float x8 = hide_float( 0.0f);
   unsigned int r8 = 0x00000000;

   //+Unf
   float x9 = hide_float( 1.0e-999);
   unsigned int r9 = 0x00000000;

   //+Smin
   float x10 = hide_float( FLT_MIN);
   unsigned int r10 = 0x00000000;

   //+Denorm
   float x11 = hide_float(make_float(0x007AAAAA));
   unsigned int r11 = 0x00000000;

   //+Norm
   float x12 = hide_float( 672953.74593f);
   unsigned int r12 = 0x00000000;
   
   //+Smax
   float x13 = hide_float( FLT_MAX);
   unsigned int r13 = 0x00000000;

   //+Inf
   float x14 = hide_float(HUGE_VAL);
   unsigned int r14 = 0x00000000;
   
   //+NaN
   float x15 = hide_float(NANF);
   unsigned int r15 = 0x00000000;

   vec_float4 x0_v = spu_splats(x0);
   vec_uint4  r0_v = spu_splats(r0);

   vec_float4 x1_v = spu_splats(x1);
   vec_uint4  r1_v = spu_splats(r1);

   vec_float4 x2_v = spu_splats(x2);
   vec_uint4  r2_v = spu_splats(r2);

   vec_float4 x3_v = spu_splats(x3);
   vec_uint4  r3_v = spu_splats(r3);

   vec_float4 x4_v = spu_splats(x4);
   vec_uint4  r4_v = spu_splats(r4);

   vec_float4 x5_v = spu_splats(x5);
   vec_uint4  r5_v = spu_splats(r5);

   vec_float4 x6_v = spu_splats(x6);
   vec_uint4  r6_v = spu_splats(r6);

   vec_float4 x7_v = spu_splats(x7);
   vec_uint4  r7_v = spu_splats(r7);

   vec_float4 x8_v = spu_splats(x8);
   vec_uint4  r8_v = spu_splats(r8);

   vec_float4 x9_v = spu_splats(x9);
   vec_uint4  r9_v = spu_splats(r9);

   vec_float4 x10_v = spu_splats(x10);
   vec_uint4  r10_v = spu_splats(r10);

   vec_float4 x11_v = spu_splats(x11);
   vec_uint4  r11_v = spu_splats(r11);

   vec_float4 x12_v = spu_splats(x12);
   vec_uint4  r12_v = spu_splats(r12);

   vec_float4 x13_v = spu_splats(x13);
   vec_uint4  r13_v = spu_splats(r13);

   vec_float4 x14_v = spu_splats(x14);
   vec_uint4  r14_v = spu_splats(r14);

   vec_float4 x15_v = spu_splats(x15);
   vec_uint4  r15_v = spu_splats(r15);
   
   vec_uint4 res_v;

   TEST_START("signbitf4");

   res_v = (vec_uint4)signbitf4(x0_v);
   TEST_CHECK("20060829000000AAN", allequal_uint4( res_v, r0_v ), 0);
   res_v = (vec_uint4)signbitf4(x1_v);
   TEST_CHECK("20060829000001AAN", allequal_uint4( res_v, r1_v ), 0);
   res_v = (vec_uint4)signbitf4(x2_v);
   TEST_CHECK("20060829000002AAN", allequal_uint4( res_v, r2_v ), 0);
   res_v = (vec_uint4)signbitf4(x3_v);
   TEST_CHECK("20060829000003AAN", allequal_uint4( res_v, r3_v ), 0);
   res_v = (vec_uint4)signbitf4(x4_v);
   TEST_CHECK("20060829000004AAN", allequal_uint4( res_v, r4_v ), 0);
   res_v = (vec_uint4)signbitf4(x5_v);
   TEST_CHECK("20060829000005AAN", allequal_uint4( res_v, r5_v ), 0);
   res_v = (vec_uint4)signbitf4(x6_v);
   TEST_CHECK("20060829000006AAN", allequal_uint4( res_v, r6_v ), 0);
   res_v = (vec_uint4)signbitf4(x7_v);
   TEST_CHECK("20060829000007AAN", allequal_uint4( res_v, r7_v ), 0);
   res_v = (vec_uint4)signbitf4(x8_v);
   TEST_CHECK("20060829000008AAN", allequal_uint4( res_v, r8_v ), 0);
   res_v = (vec_uint4)signbitf4(x9_v);
   TEST_CHECK("20060829000009AAN", allequal_uint4( res_v, r9_v ), 0);
   res_v = (vec_uint4)signbitf4(x10_v);
   TEST_CHECK("20060829000010AAN", allequal_uint4( res_v, r10_v ), 0);
   res_v = (vec_uint4)signbitf4(x11_v);
   TEST_CHECK("20060829000011AAN", allequal_uint4( res_v, r11_v ), 0);
   res_v = (vec_uint4)signbitf4(x12_v);
   TEST_CHECK("20060829000012AAN", allequal_uint4( res_v, r12_v ), 0);
   res_v = (vec_uint4)signbitf4(x13_v);
   TEST_CHECK("20060829000013AAN", allequal_uint4( res_v, r13_v ), 0);
   res_v = (vec_uint4)signbitf4(x14_v);
   TEST_CHECK("20060829000014AAN", allequal_uint4( res_v, r14_v ), 0);
   res_v = (vec_uint4)signbitf4(x15_v);
   TEST_CHECK("20060829000015AAN", allequal_uint4( res_v, r15_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #20
0
int main()
{
   TEST_SET_START("20060905000000AAN","AAN", "logbf4");

   // -Norm (IEEE-754: -Nan)
   float x0 = hide_float(make_float(0xFFC00000));
   float r0 = 128.0f;
   
   // -Norm (IEEE-754: -Inf)
   float x1 = hide_float(-HUGE_VALF);
   float r1 = 128.0f;
   
   // -Smax
   float x2 = hide_float(-FLT_MAX);
   float r2 = 128.0f;

   // -Norm
   float x3 = hide_float(-824842.58421394);
   float r3 = 19.0f;
   
   // -Smin
   float x4 = hide_float(make_float(0x80800000));
   float r4 = -126.0f;
   
   // -Denorm
   float x5 = hide_float(make_float(0x807AAAAA));
   float r5 = -HUGE_VALF;
   
   // -Unf
   float x6 = hide_float(-1.0e-999);
   float r6 = -HUGE_VALF;
   
   // -0
   float x7 = hide_float(-0.0);
   float r7 = -HUGE_VALF;

   // 0
   float x8 = hide_float( 0.0);
   float r8 = -HUGE_VALF;
   
   // +Unf
   float x9 = hide_float( 1.0e-999);
   float r9 = -HUGE_VALF;

   // +Denorm
   float x10 = hide_float(make_float(0x007AAAAA));
   float r10 = -HUGE_VALF;
   
   // +Smin
   float x11 = hide_float(make_float(0x00800000));
   float r11 = -126.0f;
   
   // +Norm
   float x12 = hide_float(3.14152634);
   float r12 = 1.0f;

   // +Norm
   float x13 = hide_float(7.0673903e37);
   float r13 = 125.0f;

   // +Norm
   float x14 = hide_float(2.4673e14);
   float r14 = 47.0f;

   // +Norm
   float x15 = hide_float(7.235672e-25);
   float r15 = -81.0f;

   // +Norm
   float x16 = hide_float(9.452854e17);
   float r16 = 59.0f;

   // +Norm
   float x17 = hide_float(3.045784e-18);
   float r17 = -59.0f;

   // -Norm
   float x18 = hide_float(-6.459273e7);
   float r18 = 25.0f;

   // -Norm
   float x19 = hide_float(-2.493472e-9);
   float r19 = -29.0f;

   // -Norm
   float x20 = hide_float(-1.4824543e28);
   float r20 = 93.0f;

   // -Norm
   float x21 = hide_float(-5.53856231e-27);
   float r21 = -88.0f;

   // -Norm
   float x22 = hide_float(-1.000001);
   float r22 = 0.0f;

   // +Smax
   float x23 = hide_float(FLT_MAX);
   float r23 = 128.0f;
   
   //+Norm (IEEE-754: +Inf)
   float x24 = hide_float(HUGE_VALF);
   float r24 = 128.0f;
   
   //+Norm (IEEE-754: +Nan)
   float x25 = hide_float(make_float(0x7FC00000));
   float r25 = 128.0f;

   // Compound
   vec_float4 x26_v = (vec_float4) { -2.561286432e10, FLT_MAX, -1.0e-999, 7.235672e-25 };
   vec_float4 r26_v = (vec_float4) { 34.0f, 128.0f, -HUGE_VALF, -81.0f };

   // Compound
   vec_float4 x27_v = (vec_float4) { 345.27533f, 7.0673903e37, -0.0f, -2.40e-310 };
   vec_float4 r27_v = (vec_float4) { 8.0f, 125.0f, -HUGE_VALF, -HUGE_VALF };

   // Compound
   vec_float4 x28_v = (vec_float4) { make_float(0x7FC00000), -824842.58421394f, -0.0f, -3678342.8765343f };
   vec_float4 r28_v = (vec_float4) { 128.0f, 19.0f, -HUGE_VALF, 21.0f };

   // Compound
   vec_float4 x29_v = (vec_float4) { HUGE_VALF, 1.0e-99, -5.53856231e-27, make_float(0xFFC00000) };
   vec_float4 r29_v = (vec_float4) { 128.0f, -HUGE_VALF, -88.0f, 128.0f };

   // Compound
   vec_float4 x30_v = (vec_float4) { 1.2e-57, -1.2e-19, 3.045784e-18, -HUGE_VALF } ;
   vec_float4 r30_v = (vec_float4) { -HUGE_VALF, -63.0f, -59.0f, 128.0f };

   vec_float4 x0_v = spu_splats(x0);
   vec_float4 r0_v = spu_splats(r0);

   vec_float4 x1_v = spu_splats(x1);
   vec_float4 r1_v = spu_splats(r1);

   vec_float4 x2_v = spu_splats(x2);
   vec_float4 r2_v = spu_splats(r2);

   vec_float4 x3_v = spu_splats(x3);
   vec_float4 r3_v = spu_splats(r3);

   vec_float4 x4_v = spu_splats(x4);
   vec_float4 r4_v = spu_splats(r4);

   vec_float4 x5_v = spu_splats(x5);
   vec_float4 r5_v = spu_splats(r5);

   vec_float4 x6_v = spu_splats(x6);
   vec_float4 r6_v = spu_splats(r6);

   vec_float4 x7_v = spu_splats(x7);
   vec_float4 r7_v = spu_splats(r7);

   vec_float4 x8_v = spu_splats(x8);
   vec_float4 r8_v = spu_splats(r8);

   vec_float4 x9_v = spu_splats(x9);
   vec_float4 r9_v = spu_splats(r9);

   vec_float4 x10_v = spu_splats(x10);
   vec_float4 r10_v = spu_splats(r10);

   vec_float4 x11_v = spu_splats(x11);
   vec_float4 r11_v = spu_splats(r11);

   vec_float4 x12_v = spu_splats(x12);
   vec_float4 r12_v = spu_splats(r12);

   vec_float4 x13_v = spu_splats(x13);
   vec_float4 r13_v = spu_splats(r13);

   vec_float4 x14_v = spu_splats(x14);
   vec_float4 r14_v = spu_splats(r14);

   vec_float4 x15_v = spu_splats(x15);
   vec_float4 r15_v = spu_splats(r15);

   vec_float4 x16_v = spu_splats(x16);
   vec_float4 r16_v = spu_splats(r16);

   vec_float4 x17_v = spu_splats(x17);
   vec_float4 r17_v = spu_splats(r17);

   vec_float4 x18_v = spu_splats(x18);
   vec_float4 r18_v = spu_splats(r18);

   vec_float4 x19_v = spu_splats(x19);
   vec_float4 r19_v = spu_splats(r19);

   vec_float4 x20_v = spu_splats(x20);
   vec_float4 r20_v = spu_splats(r20);

   vec_float4 x21_v = spu_splats(x21);
   vec_float4 r21_v = spu_splats(r21);

   vec_float4 x22_v = spu_splats(x22);
   vec_float4 r22_v = spu_splats(r22);

   vec_float4 x23_v = spu_splats(x23);
   vec_float4 r23_v = spu_splats(r23);

   vec_float4 x24_v = spu_splats(x24);
   vec_float4 r24_v = spu_splats(r24);

   vec_float4 x25_v = spu_splats(x25);
   vec_float4 r25_v = spu_splats(r25);
   
   vec_float4 res_v;

   TEST_START("logbf4");

   res_v = (vec_float4)logbf4(x0_v);
   TEST_CHECK("20060905000000AAN", allequal_float4( res_v, r0_v ), 0);
   res_v = (vec_float4)logbf4(x1_v);
   TEST_CHECK("20060905000001AAN", allequal_float4( res_v, r1_v ), 0);
   res_v = (vec_float4)logbf4(x2_v);
   TEST_CHECK("20060905000002AAN", allequal_float4( res_v, r2_v ), 0);
   res_v = (vec_float4)logbf4(x3_v);
   TEST_CHECK("20060905000003AAN", allequal_float4( res_v, r3_v ), 0);
   res_v = (vec_float4)logbf4(x4_v);
   TEST_CHECK("20060905000004AAN", allequal_float4( res_v, r4_v ), 0);
   res_v = (vec_float4)logbf4(x5_v);
   TEST_CHECK("20060905000005AAN", allequal_float4( res_v, r5_v ), 0);
   res_v = (vec_float4)logbf4(x6_v);
   TEST_CHECK("20060905000006AAN", allequal_float4( res_v, r6_v ), 0);
   res_v = (vec_float4)logbf4(x7_v);
   TEST_CHECK("20060905000007AAN", allequal_float4( res_v, r7_v ), 0);
   res_v = (vec_float4)logbf4(x8_v);
   TEST_CHECK("20060905000008AAN", allequal_float4( res_v, r8_v ), 0);
   res_v = (vec_float4)logbf4(x9_v);
   TEST_CHECK("20060905000009AAN", allequal_float4( res_v, r9_v ), 0);
   res_v = (vec_float4)logbf4(x10_v);
   TEST_CHECK("20060905000010AAN", allequal_float4( res_v, r10_v ), 0);
   res_v = (vec_float4)logbf4(x11_v);
   TEST_CHECK("20060905000011AAN", allequal_float4( res_v, r11_v ), 0);
   res_v = (vec_float4)logbf4(x12_v);
   TEST_CHECK("20060905000012AAN", allequal_float4( res_v, r12_v ), 0);
   res_v = (vec_float4)logbf4(x13_v);
   TEST_CHECK("20060905000013AAN", allequal_float4( res_v, r13_v ), 0);
   res_v = (vec_float4)logbf4(x14_v);
   TEST_CHECK("20060905000014AAN", allequal_float4( res_v, r14_v ), 0);
   res_v = (vec_float4)logbf4(x15_v);
   TEST_CHECK("20060905000015AAN", allequal_float4( res_v, r15_v ), 0);
   res_v = (vec_float4)logbf4(x16_v);
   TEST_CHECK("20060905000016AAN", allequal_float4( res_v, r16_v ), 0);
   res_v = (vec_float4)logbf4(x17_v);
   TEST_CHECK("20060905000017AAN", allequal_float4( res_v, r17_v ), 0);
   res_v = (vec_float4)logbf4(x18_v);
   TEST_CHECK("20060905000018AAN", allequal_float4( res_v, r18_v ), 0);
   res_v = (vec_float4)logbf4(x19_v);
   TEST_CHECK("20060905000019AAN", allequal_float4( res_v, r19_v ), 0);
   res_v = (vec_float4)logbf4(x20_v);
   TEST_CHECK("20060905000020AAN", allequal_float4( res_v, r20_v ), 0);
   res_v = (vec_float4)logbf4(x21_v);
   TEST_CHECK("20060905000021AAN", allequal_float4( res_v, r21_v ), 0);
   res_v = (vec_float4)logbf4(x22_v);
   TEST_CHECK("20060905000022AAN", allequal_float4( res_v, r22_v ), 0);
   res_v = (vec_float4)logbf4(x23_v);
   TEST_CHECK("20060905000023AAN", allequal_float4( res_v, r23_v ), 0);
   res_v = (vec_float4)logbf4(x24_v);
   TEST_CHECK("20060905000024AAN", allequal_float4( res_v, r24_v ), 0);
   res_v = (vec_float4)logbf4(x25_v);
   TEST_CHECK("20060905000025AAN", allequal_float4( res_v, r25_v ), 0);
   res_v = (vec_float4)logbf4(x26_v);
   TEST_CHECK("20060905000026AAN", allequal_float4( res_v, r26_v ), 0);
   res_v = (vec_float4)logbf4(x27_v);
   TEST_CHECK("20060905000027AAN", allequal_float4( res_v, r27_v ), 0);
   res_v = (vec_float4)logbf4(x28_v);
   TEST_CHECK("20060905000028AAN", allequal_float4( res_v, r28_v ), 0);
   res_v = (vec_float4)logbf4(x29_v);
   TEST_CHECK("20060905000029AAN", allequal_float4( res_v, r29_v ), 0);
   res_v = (vec_float4)logbf4(x30_v);
   TEST_CHECK("20060905000030AAN", allequal_float4( res_v, r30_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #21
0
int main()
{
   TEST_SET_START("20040928184342EJL","EJL", "fminf4_fmaxf4");
   
   float x0min = hide_float(1760.135f);
   float x0max = hide_float(19355.03f);

   float x1min = hide_float(-12351.9f);
   float x1max = hide_float(-139.035f);

   float x2min = hide_float(-1.0);
   float x2max = hide_float(0.0);

   vec_float4 x0min_v = spu_splats(x0min);
   vec_float4 x0max_v = spu_splats(x0max);

   vec_float4 x1min_v = spu_splats(x1min); 
   vec_float4 x1max_v = spu_splats(x1max); 

   vec_float4 x2min_v = spu_splats(x2min); 
   vec_float4 x2max_v = spu_splats(x2max); 

   float res;
   vec_float4 res_v;

   TEST_START("fminf4");
   res_v = fminf4(x0min_v, x0max_v);
   TEST_CHECK("20040928184345EJL", allequal_float4( res_v, x0min_v ), 0);
   res_v = fminf4(x0max_v, x0min_v);      
   TEST_CHECK("20040928184349EJL", allequal_float4( res_v, x0min_v ), 0);
   res_v = fminf4(x1min_v, x1max_v);
   TEST_CHECK("20040928184351EJL", allequal_float4( res_v, x1min_v ), 0);
   res_v = fminf4(x1max_v, x1min_v);      
   TEST_CHECK("20040928184353EJL", allequal_float4( res_v, x1min_v ), 0);
   res_v = fminf4(x2min_v, x2max_v);
   TEST_CHECK("20040928184354EJL", allequal_float4( res_v, x2min_v ), 0);
   res_v = fminf4(x2max_v, x2min_v);      
   TEST_CHECK("20040928184356EJL", allequal_float4( res_v, x2min_v ), 0);
   
   TEST_START("fminf");
   res = fminf(x0min, x0max);
   TEST_CHECK("20040928184358EJL", res == x0min, 0);
   res = fminf(x0max, x0min);
   TEST_CHECK("20040928184400EJL", res == x0min, 0);
   res = fminf(x1min, x1max);
   TEST_CHECK("20040928184401EJL", res == x1min, 0);
   res = fminf(x1max, x1min);
   TEST_CHECK("20040928184403EJL", res == x1min, 0);
   res = fminf(x2min, x2max);
   TEST_CHECK("20040928184405EJL", res == x2min, 0);
   res = fminf(x2max, x2min);
   TEST_CHECK("20040928184406EJL", res == x2min, 0);
   
   TEST_START("fmaxf4");
   res_v = fmaxf4(x0min_v, x0max_v);
   TEST_CHECK("20040928184411EJL", allequal_float4( res_v, x0max_v ), 0);
   res_v = fmaxf4(x0max_v, x0min_v);      
   TEST_CHECK("20040928184413EJL", allequal_float4( res_v, x0max_v ), 0);
   res_v = fmaxf4(x1min_v, x1max_v);
   TEST_CHECK("20040928184415EJL", allequal_float4( res_v, x1max_v ), 0);
   res_v = fmaxf4(x1max_v, x1min_v);      
   TEST_CHECK("20040928184416EJL", allequal_float4( res_v, x1max_v ), 0);
   res_v = fmaxf4(x2min_v, x2max_v);
   TEST_CHECK("20040928184417EJL", allequal_float4( res_v, x2max_v ), 0);
   res_v = fmaxf4(x2max_v, x2min_v);      
   TEST_CHECK("20040928184419EJL", allequal_float4( res_v, x2max_v ), 0);
   
   TEST_START("fmaxf");
   res = fmaxf(x0min, x0max);
   TEST_CHECK("20040928184420EJL", res == x0max, 0);
   res = fmaxf(x0max, x0min);
   TEST_CHECK("20040928184422EJL", res == x0max, 0);
   res = fmaxf(x1min, x1max);
   TEST_CHECK("20040928184423EJL", res == x1max, 0);
   res = fmaxf(x1max, x1min);
   TEST_CHECK("20040928184424EJL", res == x1max, 0);
   res = fmaxf(x2min, x2max);
   TEST_CHECK("20040928184426EJL", res == x2max, 0);
   res = fmaxf(x2max, x2min);
   TEST_CHECK("20040928184428EJL", res == x2max, 0);

   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #22
0
int main()
{
   TEST_SET_START("20060904200000MH","MH", "lldivu2");

   unsigned long long x0n = 0x0c0e84c75f216c43ull;
   unsigned long long x0d = 0x00000000000abcdeull;
   unsigned long long x0q = 0x0000011f71fb04cbull;
   unsigned long long x0r = 0x0000000000003039ull;
   unsigned long long x1n = 0x0c0e84c75f216c43ull;
   unsigned long long x1d = 0x0000011f71fb04cbull;
   unsigned long long x1q = 0x00000000000abcdeull;
   unsigned long long x1r = 0x0000000000003039ull;

   unsigned long long x2n = 0x08e732f9d4baf903ull;
   unsigned long long x2d = 0x0000000000976bb6ull;
   unsigned long long x2q = 0x0000000f0d55f4d9ull;
   unsigned long long x2r = 0x00000000004933bdull;
   unsigned long long x3n = 0x08e732f9d4baf903ull;
   unsigned long long x3d = 0x0000000f0d55f4d9ull;
   unsigned long long x3q = 0x0000000000976bb6ull;
   unsigned long long x3r = 0x00000000004933bdull;

   unsigned long long x4n = 0xffffffffffffffffull;
   unsigned long long x4d = 0xfffffffffffffffeull;
   unsigned long long x4q = 0x0000000000000001ull;
   unsigned long long x4r = 0x0000000000000001ull;
   unsigned long long x5n = 0xffffffffffffffffull;
   unsigned long long x5d = 0x0000000000000001ull;
   unsigned long long x5q = 0xffffffffffffffffull;
   unsigned long long x5r = 0x0000000000000000ull;

   unsigned long long x6n = 0xffffffffffffffffull;
   unsigned long long x6d = 0x0000000000000002ull;
   unsigned long long x6q = 0x7fffffffffffffffull;
   unsigned long long x6r = 0x0000000000000001ull;
   unsigned long long x7n = 0xffffffffffffffffull;
   unsigned long long x7d = 0x7fffffffffffffffull;
   unsigned long long x7q = 0x0000000000000002ull;
   unsigned long long x7r = 0x0000000000000001ull;

   unsigned long long x8n = 0xf8c0d45d0ff344f0ull;
   unsigned long long x8d = 0x000019aa3e41e0bdull;
   unsigned long long x8q = 0x000000000009b13bull;
   unsigned long long x8r = 0x000004c443bccc61ull;
   unsigned long long x9n = 0xf8c0d45d0ff344f0ull;
   unsigned long long x9d = 0x000000000009b13bull;
   unsigned long long x9q = 0x000019aa3ebfc739ull;
   unsigned long long x9r = 0x000000000000f1cdull;

   vec_ullong2 x0n_v = (vec_ullong2){ x0n, x1n };
   vec_ullong2 x0d_v = (vec_ullong2){ x0d, x1d };
   vec_ullong2 x0q_v = (vec_ullong2){ x0q, x1q };
   vec_ullong2 x0r_v = (vec_ullong2){ x0r, x1r };
   vec_ullong2 x1n_v = (vec_ullong2){ x2n, x3n };
   vec_ullong2 x1d_v = (vec_ullong2){ x2d, x3d };
   vec_ullong2 x1q_v = (vec_ullong2){ x2q, x3q };
   vec_ullong2 x1r_v = (vec_ullong2){ x2r, x3r };
   vec_ullong2 x2n_v = (vec_ullong2){ x4n, x5n };
   vec_ullong2 x2d_v = (vec_ullong2){ x4d, x5d };
   vec_ullong2 x2q_v = (vec_ullong2){ x4q, x5q };
   vec_ullong2 x2r_v = (vec_ullong2){ x4r, x5r };
   vec_ullong2 x3n_v = (vec_ullong2){ x6n, x7n };
   vec_ullong2 x3d_v = (vec_ullong2){ x6d, x7d };
   vec_ullong2 x3q_v = (vec_ullong2){ x6q, x7q };
   vec_ullong2 x3r_v = (vec_ullong2){ x6r, x7r };
   vec_ullong2 x4n_v = (vec_ullong2){ x8n, x9n };
   vec_ullong2 x4d_v = (vec_ullong2){ x8d, x9d };
   vec_ullong2 x4q_v = (vec_ullong2){ x8q, x9q };
   vec_ullong2 x4r_v = (vec_ullong2){ x8r, x9r };
   
   lldivu2_t res;

   TEST_START("lldivu2");
   res = lldivu2(x0n_v, x0d_v);
   TEST_CHECK("20060904200001MH", allequal_ullong2( res.quot, x0q_v ) && allequal_ullong2( res.rem,  x0r_v ), 0);
   res = lldivu2(x1n_v, x1d_v);
   TEST_CHECK("20060904200002MH", allequal_ullong2( res.quot, x1q_v ) && allequal_ullong2( res.rem,  x1r_v ), 0);
   res = lldivu2(x2n_v, x2d_v);
   TEST_CHECK("20060904200003MH", allequal_ullong2( res.quot, x2q_v ) && allequal_ullong2( res.rem,  x2r_v ), 0);
   res = lldivu2(x3n_v, x3d_v);
   TEST_CHECK("20060904200004MH", allequal_ullong2( res.quot, x3q_v ) && allequal_ullong2( res.rem,  x3r_v ), 0);
   res = lldivu2(x4n_v, x4d_v);
   TEST_CHECK("20060904200005MH", allequal_ullong2( res.quot, x4q_v ) && allequal_ullong2( res.rem,  x4r_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #23
0
int main()
{
   TEST_SET_START("20060901150000MH","MH", "divu4");

   unsigned int x0n = 0xffccb78d;
   unsigned int x0d = 0x0       ;
   unsigned int x0q = 0x0       ;
   unsigned int x0r = 0xffccb78d;
   unsigned int x1n = 0xff978333;
   unsigned int x1d = 0xff976bb6;
   unsigned int x1q = 0x1       ;
   unsigned int x1r = 0x177d    ;
   unsigned int x2n = 0x5e146   ;
   unsigned int x2d = 0xd14ebe0e;
   unsigned int x2q = 0x0       ;
   unsigned int x2r = 0x5e146   ;
   unsigned int x3n = 0xf0e91618;
   unsigned int x3d = 0xfddff7ac;
   unsigned int x3q = 0x0       ;
   unsigned int x3r = 0xf0e91618;
                       
   unsigned int x4n = 0xf2128d9d;
   unsigned int x4d = 0xe0f76   ;
   unsigned int x4q = 0x1137    ;
   unsigned int x4r = 0x66543   ;
   unsigned int x5n = 0xda1ba2ce;
   unsigned int x5d = 0x4c9     ;
   unsigned int x5q = 0x2d9482  ;
   unsigned int x5r = 0xbc      ;
   unsigned int x6n = 0xdd4426a6;
   unsigned int x6d = 0xf8d245cf;
   unsigned int x6q = 0x0       ;
   unsigned int x6r = 0xdd4426a6;
   unsigned int x7n = 0xd1d5ae9 ;
   unsigned int x7d = 0x333ab105;
   unsigned int x7q = 0x0       ;
   unsigned int x7r = 0xd1d5ae9 ;
                       
   unsigned int x8n = 0x3e0c6   ;
   unsigned int x8d = 0xfff24255;
   unsigned int x8q = 0x0       ;
   unsigned int x8r = 0x3e0c6   ;
   unsigned int x9n = 0xfd6fe27e;
   unsigned int x9d = 0xf32454  ;
   unsigned int x9q = 0x10a     ;
   unsigned int x9r = 0xcc2336  ;
   unsigned int x10n =0xfb150f79;
   unsigned int x10d =0xf521    ;
   unsigned int x10q =0x10637   ;
   unsigned int x10r =0x9f62    ;
   unsigned int x11n =0xfe88071f;
   unsigned int x11d =0xfff937c2;
   unsigned int x11q =0x0       ;
   unsigned int x11r =0xfe88071f;

   unsigned int x12n =0xc374fa4 ;
   unsigned int x12d =0x1234    ;
   unsigned int x12q =0xabcd    ;
   unsigned int x12r =0x0       ;
   unsigned int x13n =0xffffffff;
   unsigned int x13d =0x2       ;
   unsigned int x13q =0x7fffffff;
   unsigned int x13r =0x1       ;
   unsigned int x14n =0x0       ;
   unsigned int x14d =0x12345678;
   unsigned int x14q =0x0       ;
   unsigned int x14r =0x0       ;
   unsigned int x15n =0xffffffff;
   unsigned int x15d =0x1       ;
   unsigned int x15q =0xffffffff;
   unsigned int x15r =0x0       ;

   vec_uint4 x0n_v = (vec_uint4){ x0n, x1n, x2n, x3n };
   vec_uint4 x1n_v = (vec_uint4){ x4n, x5n, x6n, x7n };
   vec_uint4 x2n_v = (vec_uint4){ x8n, x9n, x10n, x11n };
   vec_uint4 x3n_v = (vec_uint4){ x12n, x13n, x14n, x15n };

   vec_uint4 x0d_v = (vec_uint4){ x0d, x1d, x2d, x3d };
   vec_uint4 x1d_v = (vec_uint4){ x4d, x5d, x6d, x7d };
   vec_uint4 x2d_v = (vec_uint4){ x8d, x9d, x10d, x11d };
   vec_uint4 x3d_v = (vec_uint4){ x12d, x13d, x14d, x15d };

   vec_uint4 x0q_v = (vec_uint4){ x0q, x1q, x2q, x3q };
   vec_uint4 x1q_v = (vec_uint4){ x4q, x5q, x6q, x7q };
   vec_uint4 x2q_v = (vec_uint4){ x8q, x9q, x10q, x11q };
   vec_uint4 x3q_v = (vec_uint4){ x12q, x13q, x14q, x15q };

   vec_uint4 x0r_v = (vec_uint4){ x0r, x1r, x2r, x3r };
   vec_uint4 x1r_v = (vec_uint4){ x4r, x5r, x6r, x7r };
   vec_uint4 x2r_v = (vec_uint4){ x8r, x9r, x10r, x11r };
   vec_uint4 x3r_v = (vec_uint4){ x12r, x13r, x14r, x15r };
   
   divu4_t res;

   TEST_START("divu4");
   res = divu4(x0n_v, x0d_v);
   TEST_CHECK("20060901150001MH", allequal_uint4( res.quot, x0q_v ) && allequal_uint4( res.rem,  x0r_v ), 0);
   res = divu4(x1n_v, x1d_v);
   TEST_CHECK("20060901150002MH", allequal_uint4( res.quot, x1q_v ) && allequal_uint4( res.rem,  x1r_v ), 0);
   res = divu4(x2n_v, x2d_v);
   TEST_CHECK("20060901150003MH", allequal_uint4( res.quot, x2q_v ) && allequal_uint4( res.rem,  x2r_v ), 0);
   res = divu4(x3n_v, x3d_v);
   TEST_CHECK("20060901150004MH", allequal_uint4( res.quot, x3q_v ) && allequal_uint4( res.rem,  x3r_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #24
0
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();
}
Beispiel #25
0
int main()
{
   TEST_SET_START("20040928105926EJL","EJL", "divf4");

   unsigned int i0n = 0x75013340;
   unsigned int i0d = 0x75e7753f;
   unsigned int i0r = 0x3e8ee64b;
   unsigned int i1n = 0x4c7fed5a;
   unsigned int i1d = 0x3a0731f0;
   unsigned int i1r = 0x51f24e86;
   unsigned int i2n = 0x5b08b303;
   unsigned int i2d = 0x562f5046;
   unsigned int i2r = 0x44479d24;
   unsigned int i3n = 0x748a9b87;
   unsigned int i3d = 0x6b014b46;
   unsigned int i3r = 0x49093864;
   unsigned int i4n = 0x35dcf9d8;
   unsigned int i4d = 0x6278d6e0;
   unsigned int i4r = 0x12e355b5;
   unsigned int i5n = 0x74d505fd;
   unsigned int i5d = 0x61ef565e;
   unsigned int i5r = 0x5263daa3;

   float x0n = hide_float(make_float(i0n));
   float x0d = hide_float(make_float(i0d));
   float x0r = hide_float(make_float(i0r));
                                       
   float x1n = hide_float(make_float(i1n));
   float x1d = hide_float(make_float(i1d));
   float x1r = hide_float(make_float(i1r));
                                       
   float x2n = hide_float(make_float(i2n));
   float x2d = hide_float(make_float(i2d));
   float x2r = hide_float(make_float(i2r));
                                       
   float x3n = hide_float(make_float(i3n));
   float x3d = hide_float(make_float(i3d));
   float x3r = hide_float(make_float(i3r));
                                       
   float x4n = hide_float(make_float(i4n));
   float x4d = hide_float(make_float(i4d));
   float x4r = hide_float(make_float(i4r));
                                       
   float x5n = hide_float(make_float(i5n));
   float x5d = hide_float(make_float(i5d));
   float x5r = hide_float(make_float(i5r));
   
   vec_float4 x0n_v = spu_splats(x0n);
   vec_float4 x0d_v = spu_splats(x0d);
   vec_float4 x0r_v = spu_splats(x0r);
                                   
   vec_float4 x1n_v = spu_splats(x1n);
   vec_float4 x1d_v = spu_splats(x1d);
   vec_float4 x1r_v = spu_splats(x1r);
                                   
   vec_float4 x2n_v = spu_splats(x2n);
   vec_float4 x2d_v = spu_splats(x2d);
   vec_float4 x2r_v = spu_splats(x2r);
                                   
   vec_float4 x3n_v = spu_splats(x3n);
   vec_float4 x3d_v = spu_splats(x3d);
   vec_float4 x3r_v = spu_splats(x3r);
                                   
   vec_float4 x4n_v = spu_splats(x4n);
   vec_float4 x4d_v = spu_splats(x4d);
   vec_float4 x4r_v = spu_splats(x4r);
                                   
   vec_float4 x5n_v = spu_splats(x5n);
   vec_float4 x5d_v = spu_splats(x5d);
   vec_float4 x5r_v = spu_splats(x5r);
   
   vec_float4 res_v;

   TEST_START("divf4");
   res_v = divf4(x0n_v, x0d_v);
   TEST_CHECK("20040928105932EJL", allequal_ulps_float4( res_v, x0r_v, 2 ), 0);
   res_v = divf4(x1n_v, x1d_v);
   TEST_CHECK("20040928105934EJL", allequal_ulps_float4( res_v, x1r_v, 2 ), 0);
   res_v = divf4(x2n_v, x2d_v);
   TEST_CHECK("20040928105936EJL", allequal_ulps_float4( res_v, x2r_v, 2 ), 0);
   res_v = divf4(x3n_v, x3d_v);
   TEST_CHECK("20040928105938EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
   res_v = divf4(x4n_v, x4d_v);
   TEST_CHECK("20040928105940EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
   res_v = divf4(x5n_v, x5d_v);
   TEST_CHECK("20040928105943EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #26
0
int main()
{
   TEST_SET_START("20040928191240EJL","EJL", "fmodf4");

   unsigned int i0n = 0x449edbc6;
   unsigned int i0d = 0x40cf799d;
   unsigned int i0r = 0x3daa7300;
   unsigned int i1n = 0x6bca107a;
   unsigned int i1d = 0x6c4a107a;
   unsigned int i1r = 0x6bca107a;
   unsigned int i2n = 0x1c123605;
   unsigned int i2d = 0x1c923602;
   unsigned int i2r = 0x1c123605;
   unsigned int i3n = 0x2b4c50fa;
   unsigned int i3d = 0x253a3ae3;
   unsigned int i3r = 0x25141df9;
   unsigned int i4n = 0x73addffc;
   unsigned int i4d = 0x742ddffc;
   unsigned int i4r = 0x73addffc;
   unsigned int i5n = 0x29d4d97c;
   unsigned int i5d = 0x2a546e77;
   unsigned int i5r = 0x29d4d97c;

   float x0n = hide_float(make_float(i0n));
   float x0d = hide_float(make_float(i0d));
   float x0r = hide_float(make_float(i0r));
                                       
   float x1n = hide_float(make_float(i1n));
   float x1d = hide_float(make_float(i1d));
   float x1r = hide_float(make_float(i1r));
                                       
   float x2n = hide_float(make_float(i2n));
   float x2d = hide_float(make_float(i2d));
   float x2r = hide_float(make_float(i2r));
                                       
   float x3n = hide_float(make_float(i3n));
   float x3d = hide_float(make_float(i3d));
   float x3r = hide_float(make_float(i3r));
                                       
   float x4n = hide_float(make_float(i4n));
   float x4d = hide_float(make_float(i4d));
   float x4r = hide_float(make_float(i4r));
                                       
   float x5n = hide_float(make_float(i5n));
   float x5d = hide_float(make_float(i5d));
   float x5r = hide_float(make_float(i5r));
   
   vec_float4 x0n_v = spu_splats(x0n);
   vec_float4 x0d_v = spu_splats(x0d);
   vec_float4 x0r_v = spu_splats(x0r);
                                   
   vec_float4 x1n_v = spu_splats(x1n);
   vec_float4 x1d_v = spu_splats(x1d);
   vec_float4 x1r_v = spu_splats(x1r);
                                   
   vec_float4 x2n_v = spu_splats(x2n);
   vec_float4 x2d_v = spu_splats(x2d);
   vec_float4 x2r_v = spu_splats(x2r);
                                   
   vec_float4 x3n_v = spu_splats(x3n);
   vec_float4 x3d_v = spu_splats(x3d);
   vec_float4 x3r_v = spu_splats(x3r);
                                   
   vec_float4 x4n_v = spu_splats(x4n);
   vec_float4 x4d_v = spu_splats(x4d);
   vec_float4 x4r_v = spu_splats(x4r);
                                   
   vec_float4 x5n_v = spu_splats(x5n);
   vec_float4 x5d_v = spu_splats(x5d);
   vec_float4 x5r_v = spu_splats(x5r);
   
   float res;
   vec_float4 res_v;

   TEST_START("fmodf4");
   res_v = fmodf4(x0n_v, x0d_v);
   TEST_CHECK("20040928191245EJL", allequal_ulps_float4( res_v, x0r_v, 1 ), 0);
   res_v = fmodf4(x1n_v, x1d_v);
   TEST_CHECK("20040928191247EJL", allequal_ulps_float4( res_v, x1r_v, 1 ), 0);
   res_v = fmodf4(x2n_v, x2d_v);
   TEST_CHECK("20040928191249EJL", allequal_ulps_float4( res_v, x2r_v, 1 ), 0);
   res_v = fmodf4(x3n_v, x3d_v);
   TEST_CHECK("20040928191251EJL", allequal_ulps_float4( res_v, x3r_v, 1 ), 0);
   res_v = fmodf4(x4n_v, x4d_v);
   TEST_CHECK("20040928191253EJL", allequal_ulps_float4( res_v, x4r_v, 1 ), 0);
   res_v = fmodf4(x5n_v, x5d_v);
   TEST_CHECK("20040928191255EJL", allequal_ulps_float4( res_v, x5r_v, 1 ), 0);
   
   TEST_START("fmodf");
   res = fmodf(x0n, x0d);
   TEST_CHECK("20040928191258EJL", ulpDiff_f( res, x0r ) <= 1, 0);
   res = fmodf(x1n, x1d);
   TEST_CHECK("20040928191300EJL", ulpDiff_f( res, x1r ) <= 1, 0);
   res = fmodf(x2n, x2d);
   TEST_CHECK("20040928191302EJL", ulpDiff_f( res, x2r ) <= 1, 0);
   res = fmodf(x3n, x3d);               
   TEST_CHECK("20040928191303EJL", ulpDiff_f( res, x3r ) <= 1, 0);
   res = fmodf(x4n, x4d);
   TEST_CHECK("20040928191305EJL", ulpDiff_f( res, x4r ) <= 1, 0);
   res = fmodf(x5n, x5d);
   TEST_CHECK("20040928191307EJL", ulpDiff_f( res, x5r ) <= 1, 0);

   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #27
0
int main()
{
   TEST_SET_START("20060817000000AAN","AAN", "isgreaterequalf4");
   
   float x0 = hide_float(-0.0f);
   float y0 = hide_float( 0.0f);
   unsigned int r0 = 0xffffffff;

   float x1 = hide_float(FLT_MAX);  //+Smax
   float y1 = hide_float(-FLT_MAX);  //-Smax
   unsigned int r1 = 0xffffffff;

   float x2 = hide_float(-0.0000000013152f);
   float y2 = hide_float(-234245.85323441f);
   unsigned int r2 = 0xffffffff;

   float x3 = hide_float(-168.97345223013f);
   float y3 = hide_float(-168.97345223013f);
   unsigned int r3 = 0xffffffff;

   float x4 = hide_float(-83532.96153153f);
   float y4 = hide_float(-FLT_MIN);  //-Smin
   unsigned int r4 = 0x00000000;

   float x5 = hide_float(-321.01234567f);
   float y5 = hide_float(876543.12345f);
   unsigned int r5 = 0x00000000;

   float x6 = hide_float(FLT_MIN);  // Smin
   float y6 = hide_float(0.0031529324f);
   unsigned int r6 = 0x00000000;

   float x7 = hide_float(5172.2845321f);
   float y7 = hide_float(5172.2845321f);
   unsigned int r7 = 0xffffffff;

   float x8 = hide_float(264.345643345f);
   float y8 = hide_float(2353705.31415f);
   unsigned int r8 = 0x00000000;

   float x9 = hide_float(FLT_MAX);  // Smax
   float y9 = hide_float(9.43574552184f);
   unsigned int r9 = 0xffffffff;

   vec_float4 x0_v = spu_splats(x0);
   vec_float4 y0_v = spu_splats(y0);
   vec_uint4  r0_v = spu_splats(r0);

   vec_float4 x1_v = spu_splats(x1);
   vec_float4 y1_v = spu_splats(y1);
   vec_uint4  r1_v = spu_splats(r1);

   vec_float4 x2_v = spu_splats(x2);
   vec_float4 y2_v = spu_splats(y2);
   vec_uint4  r2_v = spu_splats(r2);

   vec_float4 x3_v = spu_splats(x3);
   vec_float4 y3_v = spu_splats(y3);
   vec_uint4  r3_v = spu_splats(r3);

   vec_float4 x4_v = spu_splats(x4);
   vec_float4 y4_v = spu_splats(y4);
   vec_uint4  r4_v = spu_splats(r4);

   vec_float4 x5_v = spu_splats(x5);
   vec_float4 y5_v = spu_splats(y5);
   vec_uint4  r5_v = spu_splats(r5);

   vec_float4 x6_v = spu_splats(x6);
   vec_float4 y6_v = spu_splats(y6);
   vec_uint4  r6_v = spu_splats(r6);

   vec_float4 x7_v = spu_splats(x7);
   vec_float4 y7_v = spu_splats(y7);
   vec_uint4  r7_v = spu_splats(r7);

   vec_float4 x8_v = spu_splats(x8);
   vec_float4 y8_v = spu_splats(y8);
   vec_uint4  r8_v = spu_splats(r8);

   vec_float4 x9_v = spu_splats(x9);
   vec_float4 y9_v = spu_splats(y9);
   vec_uint4  r9_v = spu_splats(r9);
   
   vec_uint4 res_v;

   TEST_START("isgreaterequalf4");

   res_v = (vec_uint4)isgreaterequalf4(x0_v, y0_v);
   TEST_CHECK("20060817000000AAN", allequal_uint4( res_v, r0_v ), 0);
   res_v = (vec_uint4)isgreaterequalf4(x1_v, y1_v);
   TEST_CHECK("20060817000001AAN", allequal_uint4( res_v, r1_v ), 0);
   res_v = (vec_uint4)isgreaterequalf4(x2_v, y2_v);
   TEST_CHECK("20060817000002AAN", allequal_uint4( res_v, r2_v ), 0);
   res_v = (vec_uint4)isgreaterequalf4(x3_v, y3_v);
   TEST_CHECK("20060817000003AAN", allequal_uint4( res_v, r3_v ), 0);
   res_v = (vec_uint4)isgreaterequalf4(x4_v, y4_v);
   TEST_CHECK("20060817000004AAN", allequal_uint4( res_v, r4_v ), 0);
   res_v = (vec_uint4)isgreaterequalf4(x5_v, y5_v);
   TEST_CHECK("20060817000005AAN", allequal_uint4( res_v, r5_v ), 0);
   res_v = (vec_uint4)isgreaterequalf4(x6_v, y6_v);
   TEST_CHECK("20060817000006AAN", allequal_uint4( res_v, r6_v ), 0);
   res_v = (vec_uint4)isgreaterequalf4(x7_v, y7_v);
   TEST_CHECK("20060817000007AAN", allequal_uint4( res_v, r7_v ), 0);
   res_v = (vec_uint4)isgreaterequalf4(x8_v, y8_v);
   TEST_CHECK("20060817000008AAN", allequal_uint4( res_v, r8_v ), 0);
   res_v = (vec_uint4)isgreaterequalf4(x9_v, y9_v);
   TEST_CHECK("20060817000009AAN", allequal_uint4( res_v, r9_v ), 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #28
0
int main()
{
   TEST_SET_START("20060822000000AAN","AAN", "isnormalf4");
   
   float x0 = hide_float(-0.0f);
   unsigned int r0 = 0x00000000;

   float x1 = hide_float(-FLT_MAX);  //-Smax
   unsigned int r1 = 0xffffffff;

   float x2 = hide_float( 0.0f);
   unsigned int r2 = 0x00000000;

   float x3 = hide_float(-168.97345223013f);
   unsigned int r3 = 0xffffffff;

   float x4 = hide_float(-1e-999);  //-Smin
   unsigned int r4 = 0x00000000;

   float x5 = hide_float(876543.12345f);
   unsigned int r5 = 0xffffffff;

   float x6 = hide_float(1e-999);  // Smin
   unsigned int r6 = 0x00000000;

   float x7 = hide_float(5172.2845321f);
   unsigned int r7 = 0xffffffff;

   float x8 = hide_float(2353705.31415f);
   unsigned int r8 = 0xffffffff;

   float x9 = hide_float(FLT_MAX);  // Smax
   unsigned int r9 = 0xffffffff;
   
   vec_float4 x0_v = spu_splats(x0);
   vec_uint4  r0_v = spu_splats(r0);

   vec_float4 x1_v = spu_splats(x1);
   vec_uint4  r1_v = spu_splats(r1);

   vec_float4 x2_v = spu_splats(x2);
   vec_uint4  r2_v = spu_splats(r2);

   vec_float4 x3_v = spu_splats(x3);
   vec_uint4  r3_v = spu_splats(r3);

   vec_float4 x4_v = spu_splats(x4);
   vec_uint4  r4_v = spu_splats(r4);

   vec_float4 x5_v = spu_splats(x5);
   vec_uint4  r5_v = spu_splats(r5);

   vec_float4 x6_v = spu_splats(x6);
   vec_uint4  r6_v = spu_splats(r6);

   vec_float4 x7_v = spu_splats(x7);
   vec_uint4  r7_v = spu_splats(r7);

   vec_float4 x8_v = spu_splats(x8);
   vec_uint4  r8_v = spu_splats(r8);

   vec_float4 x9_v = spu_splats(x9);
   vec_uint4  r9_v = spu_splats(r9);
   
   vec_uint4 res_v;

   TEST_START("isnormalf4");
   
   res_v = (vec_uint4)isnormalf4(x0_v);
   TEST_CHECK("20060822000000AAN", allequal_uint4( res_v, r0_v ), 0);
   res_v = (vec_uint4)isnormalf4(x1_v);
   TEST_CHECK("20060822000001AAN", allequal_uint4( res_v, r1_v ), 0);
   res_v = (vec_uint4)isnormalf4(x2_v);
   TEST_CHECK("20060822000002AAN", allequal_uint4( res_v, r2_v ), 0);
   res_v = (vec_uint4)isnormalf4(x3_v);
   TEST_CHECK("20060822000003AAN", allequal_uint4( res_v, r3_v ), 0);
   res_v = (vec_uint4)isnormalf4(x4_v);
   TEST_CHECK("20060822000004AAN", allequal_uint4( res_v, r4_v ), 0);
   res_v = (vec_uint4)isnormalf4(x5_v);
   TEST_CHECK("20060822000005AAN", allequal_uint4( res_v, r5_v ), 0);
   res_v = (vec_uint4)isnormalf4(x6_v);
   TEST_CHECK("20060822000006AAN", allequal_uint4( res_v, r6_v ), 0);
   res_v = (vec_uint4)isnormalf4(x7_v);
   TEST_CHECK("20060822000007AAN", allequal_uint4( res_v, r7_v ), 0);
   res_v = (vec_uint4)isnormalf4(x8_v);
   TEST_CHECK("20060822000008AAN", allequal_uint4( res_v, r8_v ), 0);
   res_v = (vec_uint4)isnormalf4(x9_v);
   TEST_CHECK("20060822000009AAN", allequal_uint4( res_v, r9_v ), 0);
  
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #29
0
int main()
{
   TEST_SET_START("20040908022501EJL","EJL", "fabs");
   
   double x0n = hide_double(-0.0);
   double x0p = hide_double(0.0);
   double x1n = hide_double(-83532.96153153);
   double x1p = hide_double(83532.96153153);
   double x2n = hide_double(-0.0000000013152);
   double x2p = hide_double(0.0000000013152);
   double x3n = hide_double(-HUGE_VAL);
   double x3p = hide_double(HUGE_VAL);
   
   vec_double2 x0n_v = spu_splats(x0n);
   vec_double2 x0p_v = spu_splats(x0p);
   vec_double2 x1n_v = spu_splats(x1n);
   vec_double2 x1p_v = spu_splats(x1p);
   vec_double2 x2n_v = spu_splats(x2n);
   vec_double2 x2p_v = spu_splats(x2p);
   vec_double2 x3n_v = spu_splats(x3n);
   vec_double2 x3p_v = spu_splats(x3p);
   
   double res;
   vec_double2 res_v;

   TEST_START("fabsd2");
   res_v = fabsd2(x0n_v);
   TEST_CHECK("20040908022502EJL", allequal_double2( res_v, x0p_v ), 0);
   res_v = fabsd2(x0p_v);
   TEST_CHECK("20040908022503EJL", allequal_double2( res_v, x0p_v ), 0);
   res_v = fabsd2(x1n_v);
   TEST_CHECK("20040908022504EJL", allequal_double2( res_v, x1p_v ), 0);
   res_v = fabsd2(x1p_v);
   TEST_CHECK("20040908022505EJL", allequal_double2( res_v, x1p_v ), 0);
   res_v = fabsd2(x2n_v);
   TEST_CHECK("20040908022506EJL", allequal_double2( res_v, x2p_v ), 0);
   res_v = fabsd2(x2p_v);
   TEST_CHECK("20040908022507EJL", allequal_double2( res_v, x2p_v ), 0);
   res_v = fabsd2(x3n_v);
   TEST_CHECK("20040908022508EJL", allposinf_double2( res_v ), 0);
   res_v = fabsd2(x3p_v);
   TEST_CHECK("20040908022509EJL", allposinf_double2( res_v ), 0);
   
   TEST_START("fabs");
   res = fabs( x0n );
   TEST_CHECK("20040908022510EJL", res == x0p, 0);
   res = fabs( x0p );
   TEST_CHECK("20040908022511EJL", res == x0p, 0);
   res = fabs( x1n );
   TEST_CHECK("20040908022512EJL", res == x1p, 0);
   res = fabs( x1p );
   TEST_CHECK("20040908022513EJL", res == x1p, 0);
   res = fabs( x2n );
   TEST_CHECK("20040908022514EJL", res == x2p, 0);
   res = fabs( x2p );
   TEST_CHECK("20040908022515EJL", res == x2p, 0);
   res = fabs( x3n );
   TEST_CHECK("20040908022516EJL", isinf(res) == 1, 0);
   res = fabs( x3p );
   TEST_CHECK("20040908022517EJL", isinf(res) == 1, 0);
   
   TEST_SET_DONE();
   
   TEST_EXIT();
}
Beispiel #30
0
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();
}