Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/simd/pr99195_4.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 MYOP(OT,IT,IMT,OP,IS,OS) \
11 OT \
12 foo_##OP##_##OS (IT a, IT b) \
13 { \
14 IMT zeros = vcreate_##OS (0); \
15 return vcombine_##OS (v##OP##_##IS (a, b), zeros); \
16 }
17
18 #define FUNC(OT,IT,IMT,IS,OS) \
19 MYOP (OT, IT, IMT, addhn, IS, OS) \
20 MYOP (OT, IT, IMT, subhn, IS, OS) \
21 MYOP (OT, IT, IMT, raddhn, IS, OS) \
22 MYOP (OT, IT, IMT, rsubhn, IS, OS)
23
24 FUNC (int8x16_t, int16x8_t, int8x8_t, s16, s8)
25 FUNC (int16x8_t, int32x4_t, int16x4_t, s32, s16)
26 FUNC (int32x4_t, int64x2_t, int32x2_t, s64, s32)
27
28 FUNC (uint8x16_t, uint16x8_t, uint8x8_t, u16, u8)
29 FUNC (uint16x8_t, uint32x4_t, uint16x4_t, u32, u16)
30 FUNC (uint32x4_t, uint64x2_t, uint32x2_t, u64, u32)
31
32 #undef MYOP
33 #define MYOP(OT,IT,IMT,OP,IS,OS) \
34 OT \
35 foo_##OP##_##OS (IT a) \
36 { \
37 IMT zeros = vcreate_##OS (0); \
38 return vcombine_##OS (v##OP##_##IS (a), zeros); \
39 }
40
41 #undef FUNC
42 #define FUNC(OP) \
43 MYOP (int8x16_t, int16x8_t, int8x8_t, OP, s16, s8) \
44 MYOP (int16x8_t, int32x4_t, int16x4_t, OP, s32, s16) \
45 MYOP (int32x4_t, int64x2_t, int32x2_t, OP, s64, s32) \
46 MYOP (uint8x16_t, uint16x8_t, uint8x8_t, OP, u16, u8) \
47 MYOP (uint16x8_t, uint32x4_t, uint16x4_t, OP, u32, u16) \
48 MYOP (uint32x4_t, uint64x2_t, uint32x2_t, OP, u64, u32) \
49
50 FUNC (movn)
51 FUNC (qmovn)
52
53 #undef FUNC
54 #define FUNC(OP) \
55 MYOP (int8x16_t, int8x8_t, int8x8_t, OP, s8, s8) \
56 MYOP (int16x8_t, int16x4_t, int16x4_t, OP, s16, s16) \
57 MYOP (int32x4_t, int32x2_t, int32x2_t, OP, s32, s32) \
58 MYOP (int64x2_t, int64x1_t, int64x1_t, OP, s64, s64) \
59
60 FUNC (qabs)
61 FUNC (qneg)
62
63 #undef FUNC
64 #define FUNC(OP) \
65 MYOP (uint8x16_t, int16x8_t, uint8x8_t, OP, s16, u8) \
66 MYOP (uint16x8_t, int32x4_t, uint16x4_t, OP, s32, u16) \
67 MYOP (uint32x4_t, int64x2_t, uint32x2_t, OP, s64, u32) \
68
69 FUNC (qmovun)
70
71 /* { dg-final { scan-assembler-not {\tfmov\t} } } */
72 /* { dg-final { scan-assembler-not {\tmov\t} } } */
73