(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
simd/
vrbit_1.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O2 --save-temps -fno-inline -fno-ipa-icf" } */
       3  
       4  #include <arm_neon.h>
       5  
       6  extern void abort (void);
       7  
       8  uint64_t in1 = 0x0123456789abcdefULL;
       9  uint64_t expected1 = 0x80c4a2e691d5b3f7ULL;
      10  
      11  #define TEST8(BASETYPE, SUFFIX)						\
      12  void test8_##SUFFIX ()							\
      13  {									\
      14    BASETYPE##8x8_t out = vrbit_##SUFFIX (vcreate_##SUFFIX (in1));	\
      15    uint64_t res = vget_lane_u64 (vreinterpret_u64_##SUFFIX (out), 0);	\
      16    if (res != expected1) abort ();					\
      17  }
      18  
      19  uint64_t in2 = 0xdeadbeefcafebabeULL;
      20  uint64_t expected2 = 0x7bb57df7537f5d7dULL;
      21  
      22  #define TEST16(BASETYPE, SUFFIX)					\
      23  void test16_##SUFFIX ()							\
      24  {									\
      25    BASETYPE##8x16_t in = vcombine_##SUFFIX (vcreate_##SUFFIX (in1),	\
      26  					   vcreate_##SUFFIX (in2));	\
      27    uint64x2_t res = vreinterpretq_u64_##SUFFIX (vrbitq_##SUFFIX (in));	\
      28    uint64_t res1 = vgetq_lane_u64 (res, 0);				\
      29    uint64_t res2 = vgetq_lane_u64 (res, 1);				\
      30    if (res1 != expected1 || res2 != expected2) abort ();			\
      31  }
      32  
      33  TEST8 (poly, p8);
      34  TEST8 (int, s8);
      35  TEST8 (uint, u8);
      36  
      37  TEST16 (poly, p8);
      38  TEST16 (int, s8);
      39  TEST16 (uint, u8);
      40  
      41  int
      42  main (int argc, char **argv)
      43  {
      44    test8_p8 ();
      45    test8_s8 ();
      46    test8_u8 ();
      47    test16_p8 ();
      48    test16_s8 ();
      49    test16_u8 ();
      50    return 0;
      51  }
      52  
      53  /* { dg-final { scan-assembler-times "rbit\[ \t\]+\[vV\]\[0-9\]+\.8\[bB\], ?\[vV\]\[0-9\]+\.8\[bB\]" 3 } } */
      54  /* { dg-final { scan-assembler-times "rbit\[ \t\]+\[vV\]\[0-9\]+\.16\[bB\], ?\[vV\]\[0-9\]+\.16\[bB\]" 3 } } */
      55