Debian Codegraph @

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

raw
1 /* { dg-do compile } */
2 /* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */
3 /* { dg-options "-Ofast" } */
4 /* { dg-add-options arm_v8_2a_fp16_neon } */
5 /* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */
6
7 #pragma GCC target "+nosve"
8
9 /*
10 ** f1:
11 ** ...
12 ** fneg v[0-9]+.2d, v[0-9]+.2d
13 ** fadd v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s
14 ** ...
15 */
16 void f1 (float *restrict a, float *restrict b, float *res, int n)
17 {
18 for (int i = 0; i < (n & -4); i+=2)
19 {
20 res[i+0] = a[i+0] + b[i+0];
21 res[i+1] = a[i+1] - b[i+1];
22 }
23 }
24
25 /*
26 ** d1:
27 ** ...
28 ** fneg v[0-9]+.4s, v[0-9]+.4s
29 ** fadd v[0-9]+.8h, v[0-9]+.8h, v[0-9]+.8h
30 ** ...
31 */
32 void d1 (_Float16 *restrict a, _Float16 *restrict b, _Float16 *res, int n)
33 {
34 for (int i = 0; i < (n & -8); i+=2)
35 {
36 res[i+0] = a[i+0] + b[i+0];
37 res[i+1] = a[i+1] - b[i+1];
38 }
39 }
40
41 /*
42 ** e1:
43 ** ...
44 ** fadd v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d
45 ** fsub v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d
46 ** ins v[0-9]+.d\[1\], v[0-9]+.d\[1\]
47 ** ...
48 */
49 void e1 (double *restrict a, double *restrict b, double *res, int n)
50 {
51 for (int i = 0; i < (n & -4); i+=2)
52 {
53 res[i+0] = a[i+0] + b[i+0];
54 res[i+1] = a[i+1] - b[i+1];
55 }
56 }