Debian Codegraph @

gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xorsign.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize -mlasx" } */
3 /* { dg-final { scan-assembler "xvand\\.v" } } */
4 /* { dg-final { scan-assembler "xvxor\\.v" } } */
5 /* { dg-final { scan-assembler-not "xvfmul" } } */
6
7 double
8 my_xorsign (double *restrict a, double *restrict b, double *restrict c, int n)
9 {
10 for (int i = 0; i < n; i++)
11 a[i] = b[i] * __builtin_copysign (1.0d, c[i]);
12 }
13
14 float
15 my_xorsignf (float *restrict a, float *restrict b, float *restrict c, int n)
16 {
17 for (int i = 0; i < n; i++)
18 a[i] = b[i] * __builtin_copysignf (1.0f, c[i]);
19 }