1 /* { dg-do assemble { target aarch64_asm_sve_ok } } */
2 /* { dg-options "-O3 --save-temps" } */
3 
4 #include <stdint.h>
5 
6 #define DO_IMMEDIATE_OPS(VALUE, TYPE, NAME)			\
7 void vsubr_arithimm_##NAME##_##TYPE (TYPE *dst, int count)	\
8 {								\
9   for (int i = 0; i < count; ++i)				\
10     dst[i] = VALUE - dst[i];					\
11 }
12 
13 #define DO_ARITH_OPS(TYPE)			\
14   DO_IMMEDIATE_OPS (0, TYPE, 0);		\
15   DO_IMMEDIATE_OPS (5, TYPE, 5);		\
16   DO_IMMEDIATE_OPS (255, TYPE, 255);		\
17   DO_IMMEDIATE_OPS (256, TYPE, 256);		\
18   DO_IMMEDIATE_OPS (257, TYPE, 257);		\
19   DO_IMMEDIATE_OPS (65280, TYPE, 65280);	\
20   DO_IMMEDIATE_OPS (65281, TYPE, 65281);	\
21   DO_IMMEDIATE_OPS (-1, TYPE, minus1);
22 
23 DO_ARITH_OPS (int8_t)
24 DO_ARITH_OPS (int16_t)
25 DO_ARITH_OPS (int32_t)
26 DO_ARITH_OPS (int64_t)
27 
28 /* { dg-final { scan-assembler-not {\tsub\tz[0-9]+\.b, z[0-9]+\.b, z[0-9]+\.b\n} } } */
29 /* { dg-final { scan-assembler-times {\tsub\tz[0-9]+\.h, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
30 /* { dg-final { scan-assembler-times {\tsub\tz[0-9]+\.s, z[0-9]+\.s, z[0-9]+\.s\n} 2 } } */
31 /* { dg-final { scan-assembler-times {\tsub\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */
32 
33 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.b, z[0-9]+\.b, #1\n} 2 } } */
34 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.b, z[0-9]+\.b, #5\n} 1 } } */
35 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.b, z[0-9]+\.b, #255\n} } } */
36 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.b, z[0-9]+\.b, #256\n} } } */
37 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.b, z[0-9]+\.b, #257\n} } } */
38 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.b, z[0-9]+\.b, #65280\n} } } */
39 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.b, z[0-9]+\.b, #65281\n} } } */
40 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.b, z[0-9]+\.b, #-1\n} } } */
41 
42 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.h, z[0-9]+\.h, #5\n} 1 } } */
43 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.h, z[0-9]+\.h, #255\n} 1 } } */
44 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.h, z[0-9]+\.h, #256\n} 1 } } */
45 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.h, z[0-9]+\.h, #257\n} } } */
46 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.h, z[0-9]+\.h, #65280\n} 1 } } */
47 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.h, z[0-9]+\.h, #65281\n} } } */
48 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.h, z[0-9]+\.h, #-1\n} } } */
49 
50 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.s, z[0-9]+\.s, #5\n} 1 } } */
51 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.s, z[0-9]+\.s, #255\n} 1 } } */
52 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.s, z[0-9]+\.s, #256\n} 1 } } */
53 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.s, z[0-9]+\.s, #257\n} } } */
54 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.s, z[0-9]+\.s, #65280\n} 1 } } */
55 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.s, z[0-9]+\.s, #65281\n} } } */
56 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.s, z[0-9]+\.s, #-1\n} } } */
57 
58 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.d, z[0-9]+\.d, #5\n} 1 } } */
59 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.d, z[0-9]+\.d, #255\n} 1 } } */
60 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.d, z[0-9]+\.d, #256\n} 1 } } */
61 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.d, z[0-9]+\.d, #257\n} } } */
62 /* { dg-final { scan-assembler-times {\tsubr\tz[0-9]+\.d, z[0-9]+\.d, #65280\n} 1 } } */
63 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.d, z[0-9]+\.d, #65281\n} } } */
64 /* { dg-final { scan-assembler-not   {\tsubr\tz[0-9]+\.d, z[0-9]+\.d, #-1\n} } } */
65