Debian Codegraph @

gcc/testsuite/gcc.target/s390/combine-shift-rotate-add-mod.c

raw
1 /* Check shift via address-style displacement. There should not be any
2 and operations that the instructions perform implicitly anyway.*/
3
4 /* { dg-options "-O1 -m64" } */
5
6 /* { dg-final { scan-assembler-not "risbg\t%r.+,.*63" } } */
7 /* { dg-final { scan-assembler "rllg\t%r.+,3.%r.+" } } */
8 /* { dg-final { scan-assembler "sllg\t%r.+,2.%r.+" } } */
9
10 unsigned long rotlmodp (unsigned long in, unsigned long sh)
11 {
12 sh = (sh + 3) % 64;
13 return (in << sh) | (in >> (64 - sh));
14 }
15
16 unsigned long shiftmodp (unsigned long in, unsigned long sh)
17 {
18 sh = (sh + 2) % 64;
19 return (in << sh);
20 }
21
22 /* We expect a displacement of 1 here since combine simplifies
23 modulo 255 when substituting into a QImode subreg. */
24 /* { dg-final { scan-assembler "sllg\t%r.+,1.%r.+" } } */
25 unsigned long shiftp (unsigned long in, unsigned long sh)
26 {
27 sh = sh + 4097;
28 return (in << sh);
29 }