1  /* { dg-do run } */
       2  /* { dg-options "-O3 -mpower8-vector -Wno-psabi" } */
       3  /* { dg-require-effective-target p8vector_hw } */
       4  
       5  #ifndef CHECK_H
       6  #define CHECK_H "sse2-check.h"
       7  #endif
       8  
       9  #include CHECK_H
      10  
      11  #ifndef TEST
      12  #define TEST sse2_test_sqrt_pd_1
      13  #endif
      14  
      15  #include <emmintrin.h>
      16  #include <math.h>
      17  
      18  static __m128d
      19  __attribute__((noinline, unused))
      20  test (__m128d s1)
      21  {
      22    return _mm_sqrt_pd (s1); 
      23  }
      24  
      25  static void
      26  TEST (void)
      27  {
      28    union128d u, s1;
      29    __m128d bogus = { 123.0, 456.0 };
      30    double e[2];
      31    int i;
      32     
      33    s1.x = _mm_set_pd (2134.3343,1234.635654);
      34    u.x = test (s1.x); 
      35  
      36    for (i = 0; i < 2; i++)
      37      {
      38        __m128d tmp = _mm_load_sd (&s1.a[i]);
      39        tmp = _mm_sqrt_sd (bogus, tmp);
      40        _mm_store_sd (&e[i], tmp);
      41      }
      42  
      43    if (check_union128d (u, e))
      44      {
      45  #if DEBUG
      46        printf ("sse2_test_sqrt_pd_1; check_union128d failed\n");
      47        printf ("\t [%f,%f] -> [%f,%f]\n", s1.a[0], s1.a[1], u.a[0], u.a[1]);
      48        printf ("\t expect [%f,%f]\n", e[0], e[1]);
      49  #endif
      50        abort ();
      51      }
      52  }