Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/svlast.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -msve-vector-bits=256" } */
3
4 #include <stdint.h>
5 #include "arm_sve.h"
6
7 #define NAME(name, size, pat, sign, ab) \
8 name ## _ ## size ## _ ## pat ## _ ## sign ## _ ## ab
9
10 #define NAMEF(name, size, pat, sign, ab) \
11 name ## _ ## size ## _ ## pat ## _ ## sign ## _ ## ab ## _false
12
13 #define SVTYPE(size, sign) \
14 sv ## sign ## int ## size ## _t
15
16 #define STYPE(size, sign) sign ## int ## size ##_t
17
18 #define SVELAST_DEF(size, pat, sign, ab, su) \
19 STYPE (size, sign) __attribute__((noinline)) \
20 NAME (foo, size, pat, sign, ab) (SVTYPE (size, sign) x) \
21 { \
22 return svlast ## ab (svptrue_pat_b ## size (pat), x); \
23 } \
24 STYPE (size, sign) __attribute__((noinline)) \
25 NAMEF (foo, size, pat, sign, ab) (SVTYPE (size, sign) x) \
26 { \
27 return svlast ## ab (svpfalse (), x); \
28 }
29
30 #define ALL_PATS(SIZE, SIGN, AB, SU) \
31 SVELAST_DEF (SIZE, SV_VL1, SIGN, AB, SU) \
32 SVELAST_DEF (SIZE, SV_VL2, SIGN, AB, SU) \
33 SVELAST_DEF (SIZE, SV_VL3, SIGN, AB, SU) \
34 SVELAST_DEF (SIZE, SV_VL4, SIGN, AB, SU) \
35 SVELAST_DEF (SIZE, SV_VL5, SIGN, AB, SU) \
36 SVELAST_DEF (SIZE, SV_VL6, SIGN, AB, SU) \
37 SVELAST_DEF (SIZE, SV_VL7, SIGN, AB, SU) \
38 SVELAST_DEF (SIZE, SV_VL8, SIGN, AB, SU) \
39 SVELAST_DEF (SIZE, SV_VL16, SIGN, AB, SU)
40
41 #define ALL_SIGN(SIZE, AB) \
42 ALL_PATS (SIZE, , AB, s) \
43 ALL_PATS (SIZE, u, AB, u)
44
45 #define ALL_SIZE(AB) \
46 ALL_SIGN (8, AB) \
47 ALL_SIGN (16, AB) \
48 ALL_SIGN (32, AB) \
49 ALL_SIGN (64, AB)
50
51 #define ALL_POS() \
52 ALL_SIZE (a) \
53 ALL_SIZE (b)
54
55
56 ALL_POS()
57
58 /* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.b} 52 } } */
59 /* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.h} 50 } } */
60 /* { dg-final { scan-assembler-times {\tumov\tw[0-9]+, v[0-9]+\.s} 12 } } */
61 /* { dg-final { scan-assembler-times {\tfmov\tw0, s0} 24 } } */
62 /* { dg-final { scan-assembler-times {\tumov\tx[0-9]+, v[0-9]+\.d} 4 } } */
63 /* { dg-final { scan-assembler-times {\tfmov\tx0, d0} 32 } } */