1 /* { dg-do assemble { target aarch64_asm_sve_ok } } */
2 /* { dg-options "-O2 -ftree-vectorize --save-temps" } */
3 
4 #include <stdint.h>
5 
6 #define TEST_LOOP(DATA_TYPE, OTHER_TYPE)				\
7   void __attribute__ ((noinline, noclone))				\
8   f_##DATA_TYPE##_##BITS (DATA_TYPE *restrict dest,			\
9 			  DATA_TYPE *restrict src,			\
10 			  OTHER_TYPE *restrict other,			\
11 			  OTHER_TYPE mask,				\
12 			  int stride, int n)				\
13   {									\
14     for (int i = 0; i < n; ++i)						\
15       dest[i] = src[i * stride] + (OTHER_TYPE) (other[i] | mask);	\
16   }
17 
18 #define TEST_ALL(T)				\
19   T (int32_t, int16_t)				\
20   T (uint32_t, int16_t)				\
21   T (float, int16_t)				\
22   T (int64_t, int32_t)				\
23   T (uint64_t, int32_t)				\
24   T (double, int32_t)
25 
26 TEST_ALL (TEST_LOOP)
27 
28 /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.h, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 1\]\n} 3 } } */
29 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.s, p[0-7]/z, \[x[0-9]+, z[0-9]+.s, sxtw 2\]\n} 6 } } */
30 
31 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.s, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 2\]\n} 3 } } */
32 /* { dg-final { scan-assembler-times {\tld1d\tz[0-9]+\.d, p[0-7]/z, \[x[0-9]+, z[0-9]+.d, lsl 3\]\n} 6 } } */
33