Debian Codegraph @

gcc/testsuite/gcc.target/loongarch/rotl-with-vrotr-w.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mlsx -fno-vect-cost-model" } */
3 /* { dg-final { scan-assembler-times "vrotr\\.w" 2 } } */
4 /* { dg-final { scan-assembler-times "vneg\\.w" 1 } } */
5
6 #ifndef VLEN
7 #define VLEN 16
8 #endif
9
10 #ifndef TYPE
11 #define TYPE int
12 #endif
13
14 typedef unsigned TYPE V __attribute__ ((vector_size (VLEN)));
15 V a, b, c;
16
17 void
18 test (int x)
19 {
20 b = a << x | a >> ((int)sizeof (TYPE) * __CHAR_BIT__ - x);
21 }
22
23 void
24 test2 (void)
25 {
26 for (int i = 0; i < VLEN / sizeof (TYPE); i++)
27 c[i] = a[i] << b[i] | a[i] >> ((int)sizeof (TYPE) * __CHAR_BIT__ - b[i]);
28 }