Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/simd/pr99195_3.c

raw
1 /* PR target/99195. */
2 /* Check that we take advantage of 64-bit Advanced SIMD operations clearing
3 the top half of the vector register and no explicit zeroing instructions
4 are emitted. */
5 /* { dg-do compile } */
6 /* { dg-options "-O" } */
7
8 #include <arm_neon.h>
9
10 #define TERNARY(OT,IT,OP,S) \
11 OT \
12 foo_##OP##_##S (IT a, IT b, IT c) \
13 { \
14 IT zeros = vcreate_##S (0); \
15 return vcombine_##S (v##OP##_##S (a, b, c), zeros); \
16 }
17
18 #define FUNC(T,IS,OS,OP,S) TERNARY (T##x##OS##_t, T##x##IS##_t, OP, S)
19
20 #define OPTWO(T,IS,OS,S,OP1,OP2) \
21 FUNC (T, IS, OS, OP1, S) \
22 FUNC (T, IS, OS, OP2, S)
23
24 #define OPTHREE(T, IS, OS, S, OP1, OP2, OP3) \
25 FUNC (T, IS, OS, OP1, S) \
26 OPTWO (T, IS, OS, S, OP2, OP3)
27
28 #define OPFOUR(T,IS,OS,S,OP1,OP2,OP3,OP4) \
29 FUNC (T, IS, OS, OP1, S) \
30 OPTHREE (T, IS, OS, S, OP2, OP3, OP4)
31
32 OPTHREE (int8, 8, 16, s8, mla, mls, aba)
33 OPTHREE (int16, 4, 8, s16, mla, mls, aba)
34 OPTHREE (int32, 2, 4, s32, mla, mls, aba)
35
36 OPFOUR (uint8, 8, 16, u8, mla, mls, aba, bsl)
37 OPFOUR (uint16, 4, 8, u16, mla, mls, aba, bsl)
38 OPFOUR (uint32, 2, 4, u32, mla, mls, aba, bsl)
39
40 OPTHREE (float32, 2, 4, f32, mla, fma, fms)
41
42 #undef FUNC
43 #define TERNARY_LANE(OT,IT,OP,S) \
44 OT \
45 foo_##OP##_##S (IT a, IT b, IT c) \
46 { \
47 IT zeros = vcreate_##S (0); \
48 return vcombine_##S (v##OP##_##S (a, b, c, 0), zeros); \
49 } \
50 OT \
51 foo_##OP##_##S##_lane1 (IT a, IT b, IT c) \
52 { \
53 IT zeros = vcreate_##S (0); \
54 return vcombine_##S (v##OP##_##S (a, b, c, 1), zeros); \
55 }
56
57 #define FUNC(T,IS,OS,OP,S) TERNARY_LANE (T##x##OS##_t, T##x##IS##_t, OP, S)
58 OPTWO (int16, 4, 8, s16, mla_lane, mls_lane)
59 OPTWO (int32, 2, 4, s32, mla_lane, mls_lane)
60
61 OPTWO (uint16, 4, 8, u16, mla_lane, mls_lane)
62 OPTWO (uint32, 2, 4, u32, mla_lane, mls_lane)
63
64 OPTHREE (float32, 2, 4, f32, mla_lane, fma_lane, fms_lane)
65
66 /* { dg-final { scan-assembler-not {\tfmov\t} } } */
67 /* { dg-final { scan-assembler-not {\tmov\t} } } */
68