示例#1
0
NOMIPS16 int main()
{
  v2sf a, b, c, d, e, f;
  float f1, f2;

  f1 = 1.2;
  f2 = 3.4;
  a = init (f1, f2);
  b = (v2sf) {1.2, 3.4};
  if (!__builtin_mips_upper_c_eq_ps (a, b) ||
      !__builtin_mips_lower_c_eq_ps (a, b))
    abort ();

  a = (v2sf) {1.2, 2.3};
  b = (v2sf) {5.3, 6.1};
  b = move (a);

  if (!__builtin_mips_upper_c_eq_ps (a, b) ||
      !__builtin_mips_lower_c_eq_ps (a, b))
    abort ();

  a = (v2sf) {1.2, 2.3};
  b = (v2sf) {5.3, 6.1};
  c = add (a, b);
  d = (v2sf) {6.5, 8.4};
  if (!__builtin_mips_upper_c_eq_ps (c, d) ||
      !__builtin_mips_lower_c_eq_ps (c, d))
    abort ();

  a = (v2sf) {1, 12};
  b = (v2sf) {5, 6};
  c = sub (a, b);
  d = (v2sf) {-4, 6};
  if (!__builtin_mips_upper_c_eq_ps (c, d) ||
      !__builtin_mips_lower_c_eq_ps (c, d))
    abort ();

  a = (v2sf) {1, 12};
  b = (v2sf) {5, 6};
  c = mul (a, b);
  d = (v2sf) {5, 72};
  if (!__builtin_mips_upper_c_eq_ps (c, d) ||
      !__builtin_mips_lower_c_eq_ps (c, d))
    abort ();

  a = (v2sf) {1, 12};
  b = (v2sf) {5, 6};
  c = (v2sf) {5, 6};
  d = madd (a, b, c);
  e = (v2sf) {10, 78};
  if (!__builtin_mips_upper_c_eq_ps (d, e) ||
      !__builtin_mips_lower_c_eq_ps (d, e))
    abort ();

  a = (v2sf) {1, 12};
  b = (v2sf) {5, 6};
  c = (v2sf) {5, 6};
  d = msub (a, b, c);
  e = (v2sf) {0, 66};
  if (!__builtin_mips_upper_c_eq_ps (d, e) ||
      !__builtin_mips_lower_c_eq_ps (d, e))
    abort ();

  a = (v2sf) {1, 12};
  b = (v2sf) {5, 6};
  c = (v2sf) {5, 6};
  d = nmadd (a, b, c);
  e = (v2sf) {-10, -78};
  if (!__builtin_mips_upper_c_eq_ps (d, e) ||
      !__builtin_mips_lower_c_eq_ps (d, e))
    abort ();

  a = (v2sf) {1, 12};
  b = (v2sf) {5, 6};
  c = (v2sf) {5, 6};
  d = nmsub (a, b, c);
  e = (v2sf) {0, -66};
  if (!__builtin_mips_upper_c_eq_ps (d, e) ||
      !__builtin_mips_lower_c_eq_ps (d, e))
    abort ();

  a = (v2sf) {98, 12};
  b = neg (a);
  c = (v2sf) {-98, -12};
  if (!__builtin_mips_upper_c_eq_ps (b, c) ||
      !__builtin_mips_lower_c_eq_ps (b, c))
    abort ();

  a = (v2sf) {1, 12};
  b = (v2sf) {5, 6};
  c = cond_move1 (a, b, 1000);
  if (!__builtin_mips_upper_c_eq_ps (c, a) ||
      !__builtin_mips_lower_c_eq_ps (c, a))
    abort ();

  a = (v2sf) {1, 12};
  b = (v2sf) {5, 6};
  c = cond_move2 (a, b, -1000);
  if (!__builtin_mips_upper_c_eq_ps (c, b) ||
      !__builtin_mips_lower_c_eq_ps (c, b))
    abort ();

  a = (v2sf) {1, 12};
  b = (v2sf) {5, 6};
  c = cond_move3 (a, b, 9.0);
  if (!__builtin_mips_upper_c_eq_ps (c, a) ||
      !__builtin_mips_lower_c_eq_ps (c, a))
    abort ();

  a = (v2sf) {1, 12};
  b = (v2sf) {5, 6};
  c = cond_move4 (a, b, -10.0);
  if (!__builtin_mips_upper_c_eq_ps (c, b) ||
      !__builtin_mips_lower_c_eq_ps (c, b))
    abort ();

  a = (v2sf) {5, 12};
  b = (v2sf) {5, 6};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = __builtin_mips_movt_c_eq_ps (a, b, c, d);
  f = (v2sf) {8, 123};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  a = (v2sf) {5, 12};
  b = (v2sf) {5, 6};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = __builtin_mips_movf_c_eq_ps (a, b, c, d);
  f = (v2sf) {33, 78};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  a = load();
  b = (v2sf) {100, 200};
  if (!__builtin_mips_upper_c_eq_ps (a, b) ||
      !__builtin_mips_lower_c_eq_ps (a, b))
    abort ();

  a = (v2sf) {123, 321};
  store (a);
  b = load();
  if (!__builtin_mips_upper_c_eq_ps (a, b) ||
      !__builtin_mips_lower_c_eq_ps (a, b))
    abort ();

  printf ("Test Passes\n");
  exit (0);
}
示例#2
0
NOMIPS16 int test4 (v2sf a, v2sf b)
{
  return __builtin_mips_upper_c_eq_ps (a, b);
}
NOMIPS16 int main ()
{
  int little_endian;
  v2sf a, b, c, d;
  float e,f;
  int i;

  union { long long ll; int i[2]; } endianness_test;
  endianness_test.ll = 1;
  little_endian = endianness_test.i[0];

  /* pll.ps */
  a = (v2sf) {1, 2};
  b = (v2sf) {3, 4};
  c = __builtin_mips_pll_ps (a, b);
  if (little_endian) // little endian
    d = (v2sf) {3, 1};
  else // big endian
    d = (v2sf) {2, 4};

  if (!__builtin_mips_upper_c_eq_ps (c, d) ||
      !__builtin_mips_lower_c_eq_ps (c, d))
    abort ();

  /* pul.ps */
  a = (v2sf) {1, 2};
  b = (v2sf) {3, 4};
  c = __builtin_mips_pul_ps (a, b);
  if (little_endian) // little endian
    d = (v2sf) {3, 2};
  else // big endian
    d = (v2sf) {1, 4};
  if (!__builtin_mips_upper_c_eq_ps (c, d) ||
      !__builtin_mips_lower_c_eq_ps (c, d))
    abort ();

  /* plu.ps */
  a = (v2sf) {1, 2};
  b = (v2sf) {3, 4};
  c = __builtin_mips_plu_ps (a, b);
  if (little_endian) // little endian
    d = (v2sf) {4, 1};
  else // big endian
    d = (v2sf) {2, 3};
  if (!__builtin_mips_upper_c_eq_ps (c, d) ||
      !__builtin_mips_lower_c_eq_ps (c, d))
    abort ();

  /* puu.ps */
  a = (v2sf) {1, 2};
  b = (v2sf) {3, 4};
  c = __builtin_mips_puu_ps (a, b);
  if (little_endian) // little endian
    d = (v2sf) {4, 2};
  else // big endian
    d = (v2sf) {1, 3};
  if (!__builtin_mips_upper_c_eq_ps (c, d) ||
      !__builtin_mips_lower_c_eq_ps (c, d))
    abort ();

  /* cvt.ps.s */
  e = 3.4;
  f = 4.5; 
  a = __builtin_mips_cvt_ps_s (e, f);
  if (little_endian) // little endian
    b = (v2sf) {4.5, 3.4};
  else // big endian
    b = (v2sf) {3.4, 4.5};
  if (!__builtin_mips_upper_c_eq_ps (a, b) ||
      !__builtin_mips_lower_c_eq_ps (a, b))
    abort ();

  /* cvt.s.pl */
  a = (v2sf) {35.1, 120.2};
  e = __builtin_mips_cvt_s_pl (a);
  if (little_endian) // little endian
    f = 35.1; 
  else // big endian
    f = 120.2;
  if (e != f)
    abort ();

  /* cvt.s.pu */
  a = (v2sf) {30.0, 100.0};
  e = __builtin_mips_cvt_s_pu (a);
  if (little_endian) // little endian
    f = 100.0;
  else // big endian
    f = 30.0; 
  if (e != f)
    abort ();

  /* abs.ps */
  a = (v2sf) {-3.4, -5.8};
  b = __builtin_mips_abs_ps (a);
  c = (v2sf) {3.4, 5.8};
  if (!__builtin_mips_upper_c_eq_ps (b, c) ||
      !__builtin_mips_lower_c_eq_ps (b, c))
    abort ();

  /* alnv.ps with rs = 4*/
  a = (v2sf) {1, 2};
  b = (v2sf) {3, 4};
  i = 4;
  c = __builtin_mips_alnv_ps (a, b, i);
  d = (v2sf) {2, 3};

  if (!__builtin_mips_upper_c_eq_ps (c, d) ||
      !__builtin_mips_lower_c_eq_ps (c, d))
    abort ();

  /* alnv.ps with rs = 0 */
  a = (v2sf) {5, 6};
  b = (v2sf) {7, 8};
  i = 0;
  c = __builtin_mips_alnv_ps (a, b, i);
  d = (v2sf) {5, 6};

  if (!__builtin_mips_upper_c_eq_ps (c, d) ||
      !__builtin_mips_lower_c_eq_ps (c, d))
    abort ();

  printf ("Test Passes\n");
  exit (0);
}
示例#4
0
NOMIPS16 int main()
{
  union { long long ll; int i[2]; } endianness_test;
  int little_endian;
  v2sf a, b;
  int i, j;

  endianness_test.ll = 1;
  little_endian = endianness_test.i[0];

  /* Case 1 {diff, diff} */
  a = (v2sf) {1, 2};
  b = (v2sf) {3, 4};
  i = __builtin_mips_upper_c_eq_ps (a, b);
  j = __builtin_mips_lower_c_eq_ps (a, b);
  if (i != 0 || j != 0)
    abort ();

  /* Case 2 {same, diff} */
  a = (v2sf) {1.0, 2.0};
  b = (v2sf) {1.0, 4.0};
  i = __builtin_mips_upper_c_eq_ps (a, b);
  j = __builtin_mips_lower_c_eq_ps (a, b);
  if (little_endian)
    {
      if (i != 0 || j != 1)
        abort ();
    }
  else
    {
      if (i != 1 || j != 0)
        abort ();
    }

  /* Case 3 {diff, same} */
  a = (v2sf) {1, 2};
  b = (v2sf) {3, 2};
  i = __builtin_mips_upper_c_eq_ps (a, b);
  j = __builtin_mips_lower_c_eq_ps (a, b);
  if (little_endian)
    {
      if (i != 1 || j != 0)
        abort ();
    }
  else
    {
      if (i != 0 || j != 1)
        abort ();
    }

  /* Case 4 {same, same} */
  a = (v2sf) {1, 2};
  b = (v2sf) {1, 2};
  i = __builtin_mips_upper_c_eq_ps (a, b);
  j = __builtin_mips_lower_c_eq_ps (a, b);
  if (i != 1 || j != 1)
    abort ();

  /* Test upper/lower with 16 operators */
  if (little_endian)
   {
     a = (v2sf) {1984.0, 10.58};
     b = (v2sf) {1984.0, 567.345};
   }
  else
   {
     a = (v2sf) {10.58, 1984.0};
     b = (v2sf) {567.345, 1984.0};
   }

  i = test0 (a, b);
  if (i != 0)
    abort ();
  i = test1 (a, b);
  if (i != 0)
    abort ();
  i = test2 (a, b);
  if (i != 0)
    abort ();
  i = test3 (a, b);
  if (i != 0)
    abort ();
  i = test4 (a, b);
  if (i != 0)
    abort ();
  i = test5 (a, b);
  if (i != 1)
    abort ();
  i = test6 (a, b);
  if (i != 0)
    abort ();
  i = test7 (a, b);
  if (i != 1)
    abort ();
  i = test8 (a, b);
  if (i != 1)
    abort ();
  i = test9 (a, b);
  if (i != 0)
    abort ();
  i = test10 (a, b);
  if (i != 1)
    abort ();
  i = test11 (a, b);
  if (i != 0)
    abort ();
  i = test12 (a, b);
  if (i != 1)
    abort ();
  i = test13 (a, b);
  if (i != 1)
    abort ();
  i = test14 (a, b);
  if (i != 1)
    abort ();
  i = test15 (a, b);
  if (i != 1)
    abort ();
  i = test16 (a, b);
  if (i != 0)
    abort ();
  i = test17 (a, b);
  if (i != 0)
    abort ();
  i = test18 (a, b);
  if (i != 0)
    abort ();
  i = test19 (a, b);
  if (i != 0)
    abort ();
  i = test20 (a, b);
  if (i != 0)
    abort ();
  i = test21 (a, b);
  if (i != 1)
    abort ();
  i = test22 (a, b);
  if (i != 0)
    abort ();
  i = test23 (a, b);
  if (i != 1)
    abort ();
  i = test24 (a, b);
  if (i != 1)
    abort ();
  i = test25 (a, b);
  if (i != 0)
    abort ();
  i = test26 (a, b);
  if (i != 1)
    abort ();
  i = test27 (a, b);
  if (i != 0)
    abort ();
  i = test28 (a, b);
  if (i != 1)
    abort ();
  i = test29 (a, b);
  if (i != 1)
    abort ();
  i = test30 (a, b);
  if (i != 1)
    abort ();
  i = test31 (a, b);
  if (i != 1)
    abort ();

  /* Reverse arguments */
  i = test0 (b, a);
  if (i != 0)
    abort ();
  i = test1 (b, a);
  if (i != 0)
    abort ();
  i = test2 (b, a);
  if (i != 0)
    abort ();
  i = test3 (b, a);
  if (i != 0)
    abort ();
  i = test4 (b, a);
  if (i != 0)
    abort ();
  i = test5 (b, a);
  if (i != 1)
    abort ();
  i = test6 (b, a);
  if (i != 0)
    abort ();
  i = test7 (b, a);
  if (i != 1)
    abort ();
  i = test8 (b, a);
  if (i != 0)
    abort ();
  i = test9 (b, a);
  if (i != 0)
    abort ();
  i = test10 (b, a);
  if (i != 0)
    abort ();
  i = test11 (b, a);
  if (i != 0)
    abort ();
  i = test12 (b, a);
  if (i != 0)
    abort ();
  i = test13 (b, a);
  if (i != 1)
    abort ();
  i = test14 (b, a);
  if (i != 0)
    abort ();
  i = test15 (b, a);
  if (i != 1)
    abort ();
  i = test16 (b, a);
  if (i != 0)
    abort ();
  i = test17 (b, a);
  if (i != 0)
    abort ();
  i = test18 (b, a);
  if (i != 0)
    abort ();
  i = test19 (b, a);
  if (i != 0)
    abort ();
  i = test20 (b, a);
  if (i != 0)
    abort ();
  i = test21 (b, a);
  if (i != 1)
    abort ();
  i = test22 (b, a);
  if (i != 0)
    abort ();
  i = test23 (b, a);
  if (i != 1)
    abort ();
  i = test24 (b, a);
  if (i != 0)
    abort ();
  i = test25 (b, a);
  if (i != 0)
    abort ();
  i = test26 (b, a);
  if (i != 0)
    abort ();
  i = test27 (b, a);
  if (i != 0)
    abort ();
  i = test28 (b, a);
  if (i != 0)
    abort ();
  i = test29 (b, a);
  if (i != 1)
    abort ();
  i = test30 (b, a);
  if (i != 0)
    abort ();
  i = test31 (b, a);
  if (i != 1)
    abort ();

#ifndef __FAST_MATH__
  /* Test upper/lower with 16 operators */
  if (little_endian)
   {
     a = (v2sf) {qnan, qnan};
     b = (v2sf) {1984.0, 567.345};
   }
  else
   {
     a = (v2sf) {qnan, qnan};
     b = (v2sf) {567.345, 1984.0};
   }

  i = test0 (a, b);
  if (i != 0)
    abort ();
  i = test1 (a, b);
  if (i != 0)
    abort ();
  i = test2 (a, b);
  if (i != 1)
    abort ();
  i = test3 (a, b);
  if (i != 1)
    abort ();
  i = test4 (a, b);
  if (i != 0)
    abort ();
  i = test5 (a, b);
  if (i != 0)
    abort ();
  i = test6 (a, b);
  if (i != 1)
    abort ();
  i = test7 (a, b);
  if (i != 1)
    abort ();
  i = test8 (a, b);
  if (i != 0)
    abort ();
  i = test9 (a, b);
  if (i != 0)
    abort ();
  i = test10 (a, b);
  if (i != 1)
    abort ();
  i = test11 (a, b);
  if (i != 1)
    abort ();
  i = test12 (a, b);
  if (i != 0)
    abort ();
  i = test13 (a, b);
  if (i != 0)
    abort ();
  i = test14 (a, b);
  if (i != 1)
    abort ();
  i = test15 (a, b);
  if (i != 1)
    abort ();
  i = test16 (a, b);
  if (i != 0)
    abort ();
  i = test17 (a, b);
  if (i != 0)
    abort ();
  i = test18 (a, b);
  if (i != 1)
    abort ();
  i = test19 (a, b);
  if (i != 1)
    abort ();
  i = test20 (a, b);
  if (i != 0)
    abort ();
  i = test21 (a, b);
  if (i != 0)
    abort ();
  i = test22 (a, b);
  if (i != 1)
    abort ();
  i = test23 (a, b);
  if (i != 1)
    abort ();
  i = test24 (a, b);
  if (i != 0)
    abort ();
  i = test25 (a, b);
  if (i != 0)
    abort ();
  i = test26 (a, b);
  if (i != 1)
    abort ();
  i = test27 (a, b);
  if (i != 1)
    abort ();
  i = test28 (a, b);
  if (i != 0)
    abort ();
  i = test29 (a, b);
  if (i != 0)
    abort ();
  i = test30 (a, b);
  if (i != 1)
    abort ();
  i = test31 (a, b);
  if (i != 1)
    abort ();
#endif

  printf ("Test Passes\n");
  exit (0);
}
NOMIPS16 int main ()
{
  float f1;
  v2sf a, b, c, d, e, f;

  /* Case 1 {diff, diff} */
  /* movt.ps */
  a = (v2sf) {5, 12};
  b = (v2sf) {9, 6};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = __builtin_mips_movt_c_eq_ps (a, b, c, d);
  f = (v2sf) {33, 123};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* movf.ps */
  e = __builtin_mips_movf_c_eq_ps (a, b, c, d);
  f = (v2sf) {8, 78};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* Case 2 {same, diff} */
  /* movt.ps */
  a = (v2sf) {5, 12};
  b = (v2sf) {5, 6};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = __builtin_mips_movt_c_eq_ps (a, b, c, d);
  f = (v2sf) {8, 123};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* movf.ps */
  e = __builtin_mips_movf_c_eq_ps (a, b, c, d);
  f = (v2sf) {33, 78};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* Case 3 {diff, same} */
  /* movt.ps */
  a = (v2sf) {5, 12};
  b = (v2sf) {9, 12};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = __builtin_mips_movt_c_eq_ps (a, b, c, d);
  f = (v2sf) {33, 78};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* movf.ps */
  e = __builtin_mips_movf_c_eq_ps (a, b, c, d);
  f = (v2sf) {8, 123};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* Case 4 {same, same} */
  /* movt.ps */
  a = (v2sf) {5, 12};
  b = (v2sf) {5, 12};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = __builtin_mips_movt_c_eq_ps (a, b, c, d);
  f = (v2sf) {8, 78};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* movf.ps */
  e = __builtin_mips_movf_c_eq_ps (a, b, c, d);
  f = (v2sf) {33, 123};
  if (!__builtin_mips_upper_c_eq_ps (e, f) ||
      !__builtin_mips_lower_c_eq_ps (e, f))
    abort ();

  /* Test all 16 operators */
  a = (v2sf) {123, 123};
  b = (v2sf) {1000, 1000};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = test0 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test1 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test2 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test3 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test4 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test5 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test6 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test7 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test8 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test9 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test10 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test11 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test12 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test13 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test14 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test15 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test16 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test17 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test18 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test19 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test20 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test21 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test22 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test23 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test24 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test25 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test26 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test27 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test28 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test29 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test30 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test31 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  /* Test all 16 operators with (b, a) */
  a = (v2sf) {123, 123};
  b = (v2sf) {1000, 1000};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = test0 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test1 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test2 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test3 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test4 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test5 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test6 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test7 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test8 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test9 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test10 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test11 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test12 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test13 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test14 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test15 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test16 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test17 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test18 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test19 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test20 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test21 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test22 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test23 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test24 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test25 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test26 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test27 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test28 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test29 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test30 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test31 (b, a, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

#ifndef __FAST_MATH__
  /* Test with NaN */
  a = (v2sf) {qnan, qnan};
  b = (v2sf) {1000, 1000};
  c = (v2sf) {33, 123};
  d = (v2sf) {8, 78};
  e = test0 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test1 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test2 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test3 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test4 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test5 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test6 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test7 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test8 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test9 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test10 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test11 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test12 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test13 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test14 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test15 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test16 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test17 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test18 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test19 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test20 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test21 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test22 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test23 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test24 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test25 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test26 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test27 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();

  e = test28 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
  e = test29 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();

  e = test30 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, d) || 
      !__builtin_mips_lower_c_eq_ps (e, d))
    abort ();
  e = test31 (a, b, c, d);
  if (!__builtin_mips_upper_c_eq_ps (e, c) || 
      !__builtin_mips_lower_c_eq_ps (e, c))
    abort ();
#endif

  printf ("Test Passes\n");
  exit (0);
}