(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
pragma_power8.c
       1  /* { dg-do compile } */
       2  /* { dg-require-effective-target lp64 } */
       3  /* { dg-require-effective-target powerpc_p8vector_ok } */
       4  /* { dg-options "-mdejagnu-cpu=power6 -maltivec -O2" } */
       5  
       6  #include <altivec.h>
       7  
       8  #pragma GCC target ("cpu=power6,altivec")
       9  #ifdef _ARCH_PWR6
      10  vector int
      11  test1 (vector int a, vector int b)
      12  {
      13    return vec_add (a, b);
      14  }
      15  #else
      16  #error failed power6 pragma target
      17  #endif
      18  
      19  #pragma GCC target ("cpu=power7")
      20  /* Force a re-read of altivec.h with new cpu target. */
      21  #undef _ALTIVEC_H
      22  #undef _RS6000_VECDEFINES_H
      23  #include <altivec.h>
      24  #ifdef _ARCH_PWR7
      25  vector signed int
      26  test2 (vector signed int a, vector signed int b)
      27  {
      28    return vec_sldw (a, b, 3);
      29  }
      30  #else
      31  #error failed to set power7 pragma target
      32  #endif
      33  
      34  #pragma GCC target ("cpu=power8")
      35  /* Force a re-read of altivec.h with new cpu target. */
      36  #undef _ALTIVEC_H
      37  #undef _RS6000_VECDEFINES_H
      38  #include <altivec.h>
      39  #ifdef _ARCH_PWR8
      40  vector int
      41  test3 (vector int a, vector int b)
      42  {
      43    return vec_mergee (a, b);
      44  }
      45  typedef __attribute__((altivec(vector__))) long vec_t;
      46  int
      47  test3b (vec_t a, vec_t b)
      48  {
      49    return __builtin_vec_vcmpeq_p (2, a, b);
      50  }
      51  #else
      52  #error failed to set power8 pragma target.
      53  #endif
      54