Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sve/xorsign_1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize -ffast-math -fdump-tree-vect-details --save-temps" } */
3
4 void
5 xorsign_half (_Float16 * restrict a, _Float16 * restrict b,
6 _Float16 * restrict r, int n)
7 {
8 for (int i = 0; i < n; i++)
9 {
10 r[i] = a[i] * __builtin_copysignf16 (1.0f16, b[i]);
11 }
12 }
13
14 void
15 xorsign_float (float *restrict a, float *restrict b, float *restrict r, int n)
16 {
17 for (int i = 0; i < n; i++)
18 {
19 r[i] = a[i] * __builtin_copysignf (1.0f, b[i]);
20 }
21 }
22
23 void
24 xorsign_double (double *restrict a, double *restrict b, double *restrict r,
25 int n)
26 {
27 for (int i = 0; i < n; i++)
28 {
29 r[i] = a[i] * __builtin_copysign (1.0d, b[i]);
30 }
31 }
32
33 /* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 3 "vect" } } */
34 /* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.h, z[0-9]+\.h, #0x8000\n} 1 } } */
35 /* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.s, z[0-9]+\.s, #0x80000000\n} 1 } } */
36 /* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, #0x8000000000000000\n} 1 } } */
37 /* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 3 } } */