(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
sve/
vcond_6.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -ftree-vectorize" } */
       3  
       4  #include <stdint.h>
       5  
       6  #define b_and(A, B) ((A) & (B))
       7  #define b_orr(A, B) ((A) | (B))
       8  #define b_eor(A, B) ((A) ^ (B))
       9  #define b_nand(A, B) (!((A) & (B)))
      10  #define b_nor(A, B) (!((A) | (B)))
      11  #define b_bic(A, B) ((A) & !(B))
      12  #define b_orn(A, B) ((A) | !(B))
      13  
      14  #define LOOP(TYPE, BINOP)						\
      15    void __attribute__ ((noinline, noclone))				\
      16    test_##TYPE##_##BINOP (TYPE *restrict dest, TYPE *restrict src,	\
      17  			 TYPE *restrict a, TYPE *restrict b,		\
      18  			 TYPE *restrict c, TYPE *restrict d,		\
      19  			 TYPE fallback, int count)			\
      20    {									\
      21      for (int i = 0; i < count; ++i)					\
      22        {									\
      23  	TYPE srcv = src[i];						\
      24  	dest[i] = (BINOP (__builtin_isunordered (a[i], b[i]),		\
      25  			  __builtin_isunordered (c[i], d[i]))		\
      26  		   ? srcv : fallback);					\
      27        }									\
      28    }
      29  
      30  #define TEST_BINOP(T, BINOP) \
      31    T (_Float16, BINOP) \
      32    T (float, BINOP) \
      33    T (double, BINOP)
      34  
      35  #define TEST_ALL(T) \
      36    TEST_BINOP (T, b_and) \
      37    TEST_BINOP (T, b_orr) \
      38    TEST_BINOP (T, b_eor) \
      39    TEST_BINOP (T, b_nand) \
      40    TEST_BINOP (T, b_nor) \
      41    TEST_BINOP (T, b_bic) \
      42    TEST_BINOP (T, b_orn)
      43  
      44  TEST_ALL (LOOP)
      45  
      46  /* ??? We predicate one of the comparisons on the result of the other,
      47     but whether that's a win or a loss will depend on the schedule.  */
      48  /* { dg-final { scan-assembler-not {\tand\t} } } */
      49  /* { dg-final { scan-assembler-times {\torr\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b, p[0-9]+\.b} 3 } } */
      50  /* { dg-final { scan-assembler-times {\teor\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b, p[0-9]+\.b} 3 } } */
      51  /* { dg-final { scan-assembler-times {\tnand\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b, p[0-9]+\.b} 3 } } */
      52  /* { dg-final { scan-assembler-times {\tnor\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b, p[0-9]+\.b} 3 } } */
      53  /* Currently we predicate one of the comparisons on the result of the other
      54     and then use NOT, but the original BIC sequence is better.  It's a fairly
      55     niche failure though.  We'd handle most other types of comparison by
      56     using the inverse operation instead of a separate NOT.  */
      57  /* { dg-final { scan-assembler-times {\tbic\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b, p[0-9]+\.b} 3 { xfail *-*-* } } } */
      58  /* { dg-final { scan-assembler-times {\torn\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b, p[0-9]+\.b} 3 } } */