Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/vmul_high_cost.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O3" } */
3
4 #include <arm_neon.h>
5
6 #define TEST_MULL_VEC(name, rettype, intype, ts, rs) \
7 rettype test_ ## name ## _ ## ts (intype a, intype b, intype c) \
8 { \
9 rettype t0 = name ## _ ## ts (vget_high_ ## ts (a), \
10 vget_high_ ## ts (c)); \
11 rettype t1 = name ## _ ## ts (vget_high_ ## ts (b), \
12 vget_high_ ## ts (c)); \
13 return vqaddq ## _ ## rs (t0, t1); \
14 }
15
16 TEST_MULL_VEC (vmull, int16x8_t, int8x16_t, s8, s16)
17 TEST_MULL_VEC (vmull, uint16x8_t, uint8x16_t, u8, u16)
18 TEST_MULL_VEC (vmull, int32x4_t, int16x8_t, s16, s32)
19 TEST_MULL_VEC (vmull, uint32x4_t, uint16x8_t, u16, u32)
20 TEST_MULL_VEC (vmull, int64x2_t, int32x4_t, s32, s64)
21 TEST_MULL_VEC (vmull, uint64x2_t, uint32x4_t, u32, u64)
22
23 TEST_MULL_VEC (vqdmull, int32x4_t, int16x8_t, s16, s32)
24 TEST_MULL_VEC (vqdmull, int64x2_t, int32x4_t, s32, s64)
25
26 #define TEST_MULL_N(name, rettype, intype, ts, rs) \
27 rettype test_ ## name ## _ ## ts (intype a, intype b, intype c) \
28 { \
29 rettype t0 = name ## _ ## ts (vget_high_ ## ts (a), b[1]); \
30 rettype t1 = name ## _ ## ts (vget_high_ ## ts (a), c[1]); \
31 return vqaddq ## _ ## rs (t0, t1); \
32 }
33
34 TEST_MULL_N (vmull_n, int32x4_t, int16x8_t, s16, s32)
35 TEST_MULL_N (vmull_n, uint32x4_t, uint16x8_t, u16, u32)
36 TEST_MULL_N (vmull_n, int64x2_t, int32x4_t, s32, s64)
37 TEST_MULL_N (vmull_n, uint64x2_t, uint32x4_t, u32, u64)
38
39 TEST_MULL_N (vqdmull_n, int32x4_t, int16x8_t, s16, s32)
40 TEST_MULL_N (vqdmull_n, int64x2_t, int32x4_t, s32, s64)
41
42 #define TEST_MLXL_VEC(name, rettype, intype, ts) \
43 rettype test_ ## name ## _ ## ts (rettype acc, intype a, intype b, \
44 intype c) \
45 { \
46 acc = name ## _ ## ts (acc, vget_high_ ## ts (a), \
47 vget_high_ ## ts (b)); \
48 return name ## _ ## ts (acc, vget_high_ ## ts (a), \
49 vget_high_ ## ts (c)); \
50 }
51
52 TEST_MLXL_VEC (vmlal, int16x8_t, int8x16_t, s8)
53 TEST_MLXL_VEC (vmlal, uint16x8_t, uint8x16_t, u8)
54 TEST_MLXL_VEC (vmlal, int32x4_t, int16x8_t, s16)
55 TEST_MLXL_VEC (vmlal, uint32x4_t, uint16x8_t, u16)
56
57 TEST_MLXL_VEC (vmlsl, int16x8_t, int8x16_t, s8)
58 TEST_MLXL_VEC (vmlsl, uint16x8_t, uint8x16_t, u8)
59 TEST_MLXL_VEC (vmlsl, int32x4_t, int16x8_t, s16)
60 TEST_MLXL_VEC (vmlsl, uint32x4_t, uint16x8_t, u16)
61
62 #define TEST_MLXL_N(name, rettype, intype, ts) \
63 rettype test_ ## name ## _ ## ts (rettype acc, intype a, intype b) \
64 { \
65 acc = name ## _ ## ts (acc, vget_high_ ## ts (a), b[1]); \
66 return name ## _ ## ts (acc, vget_high_ ## ts (a), b[1]); \
67 }
68
69 TEST_MLXL_N (vmlal_n, int32x4_t, int16x8_t, s16)
70 TEST_MLXL_N (vmlal_n, uint32x4_t, uint16x8_t, u16)
71 TEST_MLXL_N (vmlal_n, int64x2_t, int32x4_t, s32)
72 TEST_MLXL_N (vmlal_n, uint64x2_t, uint32x4_t, u32)
73
74 TEST_MLXL_N (vmlsl_n, int32x4_t, int16x8_t, s16)
75 TEST_MLXL_N (vmlsl_n, uint32x4_t, uint16x8_t, u16)
76 TEST_MLXL_N (vmlsl_n, int64x2_t, int32x4_t, s32)
77 TEST_MLXL_N (vmlsl_n, uint64x2_t, uint32x4_t, u32)
78
79 TEST_MLXL_N (vqdmlal_n, int32x4_t, int16x8_t, s16)
80 TEST_MLXL_N (vqdmlal_n, int64x2_t, int32x4_t, s32)
81
82 TEST_MLXL_N (vqdmlsl_n, int32x4_t, int16x8_t, s16)
83 TEST_MLXL_N (vqdmlsl_n, int64x2_t, int32x4_t, s32)
84
85 /* { dg-final { scan-assembler-not "dup\\t" } } */