[AArch64] SVE tests
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / narrow_high-intrinsics.c
blob8b8a6302692f47cf7601f45e5209c8cd5049ca86
1 /* { dg-do compile } */
2 /* { dg-options "-O3" } */
4 #include "arm_neon.h"
6 #define TWO(name, rettype, rmwtype, intype, fs) \
7 rettype test_ ## name ## _ ## fs \
8 (rmwtype a, intype b, intype c) \
9 { \
10 return name ## _ ## fs (a, b, c); \
13 TWO (vsubhn_high, int8x16_t, int8x8_t, int16x8_t, s16)
14 TWO (vsubhn_high, int16x8_t, int16x4_t, int32x4_t, s32)
15 TWO (vsubhn_high, int32x4_t, int32x2_t, int64x2_t, s64)
16 TWO (vsubhn_high, uint8x16_t, uint8x8_t, uint16x8_t, u16)
17 TWO (vsubhn_high, uint16x8_t, uint16x4_t, uint32x4_t, u32)
18 TWO (vsubhn_high, uint32x4_t, uint32x2_t, uint64x2_t, u64)
20 TWO (vaddhn_high, int8x16_t, int8x8_t, int16x8_t, s16)
21 TWO (vaddhn_high, int16x8_t, int16x4_t, int32x4_t, s32)
22 TWO (vaddhn_high, int32x4_t, int32x2_t, int64x2_t, s64)
23 TWO (vaddhn_high, uint8x16_t, uint8x8_t, uint16x8_t, u16)
24 TWO (vaddhn_high, uint16x8_t, uint16x4_t, uint32x4_t, u32)
25 TWO (vaddhn_high, uint32x4_t, uint32x2_t, uint64x2_t, u64)
27 TWO (vrsubhn_high, int8x16_t, int8x8_t, int16x8_t, s16)
28 TWO (vrsubhn_high, int16x8_t, int16x4_t, int32x4_t, s32)
29 TWO (vrsubhn_high, int32x4_t, int32x2_t, int64x2_t, s64)
30 TWO (vrsubhn_high, uint8x16_t, uint8x8_t, uint16x8_t, u16)
31 TWO (vrsubhn_high, uint16x8_t, uint16x4_t, uint32x4_t, u32)
32 TWO (vrsubhn_high, uint32x4_t, uint32x2_t, uint64x2_t, u64)
34 TWO (vraddhn_high, int8x16_t, int8x8_t, int16x8_t, s16)
35 TWO (vraddhn_high, int16x8_t, int16x4_t, int32x4_t, s32)
36 TWO (vraddhn_high, int32x4_t, int32x2_t, int64x2_t, s64)
37 TWO (vraddhn_high, uint8x16_t, uint8x8_t, uint16x8_t, u16)
38 TWO (vraddhn_high, uint16x8_t, uint16x4_t, uint32x4_t, u32)
39 TWO (vraddhn_high, uint32x4_t, uint32x2_t, uint64x2_t, u64)
41 #define TWOn(name, rettype, rmwtype, intype, fs) \
42 rettype test_ ## name ## _ ## fs \
43 (rmwtype a, intype b) \
44 { \
45 return name ## _ ## fs (a, b, 4); \
48 TWOn (vrshrn_high_n, int8x16_t, int8x8_t, int16x8_t, s16)
49 TWOn (vrshrn_high_n, int16x8_t, int16x4_t, int32x4_t, s32)
50 TWOn (vrshrn_high_n, int32x4_t, int32x2_t, int64x2_t, s64)
51 TWOn (vrshrn_high_n, uint8x16_t, uint8x8_t, uint16x8_t, u16)
52 TWOn (vrshrn_high_n, uint16x8_t, uint16x4_t, uint32x4_t, u32)
53 TWOn (vrshrn_high_n, uint32x4_t, uint32x2_t, uint64x2_t, u64)
55 TWOn (vshrn_high_n, int8x16_t, int8x8_t, int16x8_t, s16)
56 TWOn (vshrn_high_n, int16x8_t, int16x4_t, int32x4_t, s32)
57 TWOn (vshrn_high_n, int32x4_t, int32x2_t, int64x2_t, s64)
58 TWOn (vshrn_high_n, uint8x16_t, uint8x8_t, uint16x8_t, u16)
59 TWOn (vshrn_high_n, uint16x8_t, uint16x4_t, uint32x4_t, u32)
60 TWOn (vshrn_high_n, uint32x4_t, uint32x2_t, uint64x2_t, u64)
62 TWOn (vqshrun_high_n, uint8x16_t, uint8x8_t, int16x8_t, s16)
63 TWOn (vqshrun_high_n, uint16x8_t, uint16x4_t, int32x4_t, s32)
64 TWOn (vqshrun_high_n, uint32x4_t, uint32x2_t, int64x2_t, s64)
66 TWOn (vqrshrun_high_n, uint8x16_t, uint8x8_t, int16x8_t, s16)
67 TWOn (vqrshrun_high_n, uint16x8_t, uint16x4_t, int32x4_t, s32)
68 TWOn (vqrshrun_high_n, uint32x4_t, uint32x2_t, int64x2_t, s64)
70 TWOn (vqshrn_high_n, int8x16_t, int8x8_t, int16x8_t, s16)
71 TWOn (vqshrn_high_n, int16x8_t, int16x4_t, int32x4_t, s32)
72 TWOn (vqshrn_high_n, int32x4_t, int32x2_t, int64x2_t, s64)
73 TWOn (vqshrn_high_n, uint8x16_t, uint8x8_t, uint16x8_t, u16)
74 TWOn (vqshrn_high_n, uint16x8_t, uint16x4_t, uint32x4_t, u32)
75 TWOn (vqshrn_high_n, uint32x4_t, uint32x2_t, uint64x2_t, u64)
77 TWOn (vqrshrn_high_n, int8x16_t, int8x8_t, int16x8_t, s16)
78 TWOn (vqrshrn_high_n, int16x8_t, int16x4_t, int32x4_t, s32)
79 TWOn (vqrshrn_high_n, int32x4_t, int32x2_t, int64x2_t, s64)
80 TWOn (vqrshrn_high_n, uint8x16_t, uint8x8_t, uint16x8_t, u16)
81 TWOn (vqrshrn_high_n, uint16x8_t, uint16x4_t, uint32x4_t, u32)
82 TWOn (vqrshrn_high_n, uint32x4_t, uint32x2_t, uint64x2_t, u64)
84 #define ONE(name, rettype, rmwtype, intype, fs) \
85 rettype test_ ## name ## _ ## fs \
86 (rmwtype a, intype b) \
87 { \
88 return name ## _ ## fs (a, b); \
91 ONE (vqmovn_high, int8x16_t, int8x8_t, int16x8_t, s16)
92 ONE (vqmovn_high, int16x8_t, int16x4_t, int32x4_t, s32)
93 ONE (vqmovn_high, int32x4_t, int32x2_t, int64x2_t, s64)
94 ONE (vqmovn_high, uint8x16_t, uint8x8_t, uint16x8_t, u16)
95 ONE (vqmovn_high, uint16x8_t, uint16x4_t, uint32x4_t, u32)
96 ONE (vqmovn_high, uint32x4_t, uint32x2_t, uint64x2_t, u64)
98 ONE (vqmovun_high, uint8x16_t, uint8x8_t, int16x8_t, s16)
99 ONE (vqmovun_high, uint16x8_t, uint16x4_t, int32x4_t, s32)
100 ONE (vqmovun_high, uint32x4_t, uint32x2_t, int64x2_t, s64)
102 ONE (vmovn_high, int8x16_t, int8x8_t, int16x8_t, s16)
103 ONE (vmovn_high, int16x8_t, int16x4_t, int32x4_t, s32)
104 ONE (vmovn_high, int32x4_t, int32x2_t, int64x2_t, s64)
105 ONE (vmovn_high, uint8x16_t, uint8x8_t, uint16x8_t, u16)
106 ONE (vmovn_high, uint16x8_t, uint16x4_t, uint32x4_t, u32)
107 ONE (vmovn_high, uint32x4_t, uint32x2_t, uint64x2_t, u64)
110 /* { dg-final { scan-assembler-times "\\tsubhn2\\tv" 6} } */
111 /* { dg-final { scan-assembler-times "\\taddhn2\\tv" 6} } */
112 /* { dg-final { scan-assembler-times "rsubhn2\\tv" 6} } */
113 /* { dg-final { scan-assembler-times "raddhn2\\tv" 6} } */
114 /* { dg-final { scan-assembler-times "\\trshrn2 v" 6} } */
115 /* { dg-final { scan-assembler-times "\\tshrn2 v" 6} } */
116 /* { dg-final { scan-assembler-times "sqshrun2 v" 3} } */
117 /* { dg-final { scan-assembler-times "sqrshrun2 v" 3} } */
118 /* { dg-final { scan-assembler-times "sqshrn2 v" 3} } */
119 /* { dg-final { scan-assembler-times "uqshrn2 v" 3} } */
120 /* { dg-final { scan-assembler-times "sqrshrn2 v" 3} } */
121 /* { dg-final { scan-assembler-times "uqrshrn2 v" 3} } */
122 /* { dg-final { scan-assembler-times "uqxtn2 v" 3} } */
123 /* { dg-final { scan-assembler-times "sqxtn2 v" 3} } */
124 /* { dg-final { scan-assembler-times "sqxtun2 v" 3} } */
125 /* { dg-final { scan-assembler-times "\\txtn2 v" 6} } */