1  /* { dg-do run } */
       2  /* { dg-options "-O2 -fno-strict-aliasing -msse2" } */
       3  /* { dg-additional-options "-mno-mmx" { target { ! ia32 } } } */
       4  
       5  #include "sse2-check.h"
       6  #include "mmx-vals.h"
       7  
       8  __attribute__((noinline, noclone))
       9  static void
      10  test_psrlq  (long long *ll1, long long *ll2, long long *r)
      11  {
      12    __m64 t1 = *(__m64 *) ll1;
      13    __m64 t2 = *(__m64 *) ll2;
      14    *(__m64 *) r = _m_psrlq (t1, t2);
      15  }
      16  
      17  /* Routine to manually compute the results */
      18  static void
      19  compute_correct_result (unsigned long long *dst,
      20  			unsigned long long *src,
      21  			unsigned long long *res)
      22  {
      23    if (src[0] > 63)
      24      res[0] = 0;
      25    else
      26      res[0] = dst[0] >> src[0];
      27  }
      28  
      29  static void
      30  sse2_test (void)
      31  {
      32    int i;
      33    long long r, ck;
      34    int fail = 0;
      35  
      36    /* Run the MMX tests */
      37    for (i = 0; i < MMX_num_ops; i += 2)
      38      {
      39        test_psrlq (&MMXops[i], &MMXops[i + 1], &r);
      40        compute_correct_result (&MMXops[i], &MMXops[i + 1], &ck);
      41        if (ck != r)
      42  	fail++;
      43      }
      44  
      45    if (fail != 0)
      46      abort ();
      47  }