1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize -fno-inline --param aarch64-sve-compare-costs=0" } */
3 
4 #include <stdint.h>
5 
6 #define UNPACK(TYPED, TYPES)				\
7 void __attribute__ ((noinline, noclone))		\
8 unpack_##TYPED##_##TYPES (TYPED *d, TYPES *s, int size)	\
9 {							\
10   for (int i = 0; i < size; i++)			\
11     d[i] = (TYPES) (s[i] + 1);				\
12 }
13 
14 #define TEST_ALL(T)			\
15   T (int64_t, uint32_t)			\
16   T (int32_t, uint16_t)			\
17   T (int16_t, uint8_t)			\
18   T (uint64_t, uint32_t)		\
19   T (uint32_t, uint16_t)		\
20   T (uint16_t, uint8_t)
21 
22 TEST_ALL (UNPACK)
23 
24 /* { dg-final { scan-assembler-times {\tuunpkhi\tz[0-9]+\.d, z[0-9]+\.s\n} 2 } } */
25 /* { dg-final { scan-assembler-times {\tuunpkhi\tz[0-9]+\.s, z[0-9]+\.h\n} 2 } } */
26 /* { dg-final { scan-assembler-times {\tuunpkhi\tz[0-9]+\.h, z[0-9]+\.b\n} 2 } } */
27 
28 /* { dg-final { scan-assembler-times {\tuunpklo\tz[0-9]+\.d, z[0-9]+\.s\n} 2 } } */
29 /* { dg-final { scan-assembler-times {\tuunpklo\tz[0-9]+\.s, z[0-9]+\.h\n} 2 } } */
30 /* { dg-final { scan-assembler-times {\tuunpklo\tz[0-9]+\.h, z[0-9]+\.b\n} 2 } } */
31