1 /* { dg-do compile } */
2 /* { dg-options "-O3" } */
3
4 #include <arm_neon.h>
5
6 #define TEST_MUL_UNIFORM(name, q, vectype, ts) \
7 vectype test_ ## name ## q ## _ ## ts (vectype a, vectype b, vectype c) \
8 { \
9 vectype t0 = name ## q ## _n_ ## ts (a, c[1]); \
10 vectype t1 = name ## q ## _n_ ## ts (b, c[1]); \
11 return vmul ## q ## _ ## ts (t0, t1); \
12 }
13
14 TEST_MUL_UNIFORM (vmul, , int16x4_t, s16)
15 TEST_MUL_UNIFORM (vmul, , uint16x4_t, u16)
16 TEST_MUL_UNIFORM (vmul, , int32x2_t, s32)
17 TEST_MUL_UNIFORM (vmul, , uint32x2_t, u32)
18 TEST_MUL_UNIFORM (vmul, , float32x2_t, f32)
19 TEST_MUL_UNIFORM (vmul, q, int16x8_t, s16)
20 TEST_MUL_UNIFORM (vmul, q, uint16x8_t, u16)
21 TEST_MUL_UNIFORM (vmul, q, int32x4_t, s32)
22 TEST_MUL_UNIFORM (vmul, q, uint32x4_t, u32)
23 TEST_MUL_UNIFORM (vmul, q, float32x4_t, f32)
24 TEST_MUL_UNIFORM (vmul, q, float64x2_t, f64)
25
26 #define TEST_MLX_UNIFORM(name, q, vectype, ts) \
27 vectype test_ ## name ## q ## _ ## ts (vectype acc, vectype a, vectype b) \
28 { \
29 acc = name ## q ## _n_ ## ts (acc, a, b[1]); \
30 return name ## q ## _n_ ## ts (acc, a, b[1]); \
31 }
32
33 TEST_MLX_UNIFORM (vmla, , int16x4_t, s16)
34 TEST_MLX_UNIFORM (vmla, , uint16x4_t, u16)
35 TEST_MLX_UNIFORM (vmla, , int32x2_t, s32)
36 TEST_MLX_UNIFORM (vmla, , uint32x2_t, u32)
37 TEST_MLX_UNIFORM (vmla, , float32x2_t, f32)
38 TEST_MLX_UNIFORM (vmla, q, int16x8_t, s16)
39 TEST_MLX_UNIFORM (vmla, q, uint16x8_t, u16)
40 TEST_MLX_UNIFORM (vmla, q, int32x4_t, s32)
41 TEST_MLX_UNIFORM (vmla, q, uint32x4_t, u32)
42 TEST_MLX_UNIFORM (vmla, q, float32x4_t, f32)
43
44 TEST_MLX_UNIFORM (vmls, , int16x4_t, s16)
45 TEST_MLX_UNIFORM (vmls, , uint16x4_t, u16)
46 TEST_MLX_UNIFORM (vmls, , int32x2_t, s32)
47 TEST_MLX_UNIFORM (vmls, , uint32x2_t, u32)
48 TEST_MLX_UNIFORM (vmls, , float32x2_t, f32)
49 TEST_MLX_UNIFORM (vmls, q, int16x8_t, s16)
50 TEST_MLX_UNIFORM (vmls, q, uint16x8_t, u16)
51 TEST_MLX_UNIFORM (vmls, q, int32x4_t, s32)
52 TEST_MLX_UNIFORM (vmls, q, uint32x4_t, u32)
53 TEST_MLX_UNIFORM (vmls, q, float32x4_t, f32)
54
55 #define TEST_MUL_LONG(name, rettype, intype, ts, rs) \
56 rettype test_ ## name ## ts (intype a, intype b, intype c) \
57 { \
58 rettype t0 = name ## ts (a, c[1]); \
59 rettype t1 = name ## ts (b, c[1]); \
60 return vqaddq ## _ ## rs (t0, t1); \
61 }
62
63 TEST_MUL_LONG (vmull_n_, int32x4_t, int16x4_t, s16, s32)
64 TEST_MUL_LONG (vmull_n_, uint32x4_t, uint16x4_t, u16, u32)
65 TEST_MUL_LONG (vmull_n_, int64x2_t, int32x2_t, s32, s64)
66 TEST_MUL_LONG (vmull_n_, uint64x2_t, uint32x2_t, u32, u64)
67
68 TEST_MUL_LONG (vqdmull_n_, int32x4_t, int16x4_t, s16, s32)
69 TEST_MUL_LONG (vqdmull_n_, int64x2_t, int32x2_t, s32, s64)
70
71 #define TEST_MLX_LONG(name, rettype, intype, ts, rs) \
72 rettype test_ ## name ## _ ## ts (rettype acc, intype a, intype b) \
73 { \
74 acc = name ## ts (acc, a, b[1]); \
75 return name ## ts (acc, a, b[1]); \
76 }
77
78 TEST_MLX_LONG (vmlal_n_, int32x4_t, int16x4_t, s16, s32)
79 TEST_MLX_LONG (vmlal_n_, uint32x4_t, uint16x4_t, u16, u32)
80 TEST_MLX_LONG (vmlal_n_, int64x2_t, int32x2_t, s32, s64)
81 TEST_MLX_LONG (vmlal_n_, uint64x2_t, uint32x2_t, u32, u64)
82
83 TEST_MLX_LONG (vmlsl_n_, int32x4_t, int16x4_t, s16, s32)
84 TEST_MLX_LONG (vmlsl_n_, uint32x4_t, uint16x4_t, u16, u32)
85 TEST_MLX_LONG (vmlsl_n_, int64x2_t, int32x2_t, s32, s64)
86 TEST_MLX_LONG (vmlsl_n_, uint64x2_t, uint32x2_t, u32, u64)
87
88 TEST_MLX_LONG (vqdmlal_n_, int32x4_t, int16x4_t, s16, s32)
89 TEST_MLX_LONG (vqdmlal_n_, int64x2_t, int32x2_t, s32, s64)
90
91 TEST_MLX_LONG (vqdmlsl_n_, int32x4_t, int16x4_t, s16, s32)
92 TEST_MLX_LONG (vqdmlsl_n_, int64x2_t, int32x2_t, s32, s64)
93
94 /* { dg-final { scan-assembler-not "dup\\t" } } */