PR c++/67273
[official-gcc.git] / gcc / testsuite / gcc.target / arm / shiftable.c
blobf3080620a9e152d420636d2d9a1c0827c61e8ce8
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3 /* { dg-require-effective-target arm32 } */
5 /* ARM has shift-and-alu insns. Depending on the ALU op GCC represents some
6 of these as a left shift, others as a multiply. Check that we match the
7 right one. */
9 int
10 plus (int a, int b)
12 return (a * 64) + b;
15 /* { dg-final { scan-assembler "add.*\[al]sl #6" } } */
17 int
18 minus (int a, int b)
20 return a - (b * 64);
23 /* { dg-final { scan-assembler "sub.*\[al]sl #6" } } */
25 int
26 ior (int a, int b)
28 return (a * 64) | b;
31 /* { dg-final { scan-assembler "orr.*\[al]sl #6" } } */
33 int
34 xor (int a, int b)
36 return (a * 64) ^ b;
39 /* { dg-final { scan-assembler "eor.*\[al]sl #6" } } */
41 int
42 and (int a, int b)
44 return (a * 64) & b;
47 /* { dg-final { scan-assembler "and.*\[al]sl #6" } } */
49 int
50 rsb (int a, int b)
52 return (a * 64) - b;
55 /* { dg-final { scan-assembler "rsb.*\[al]sl #6" } } */
57 int
58 mvn (int a, int b)
60 return ~(a * 64);
63 /* { dg-final { scan-assembler "mvn.*\[al]sl #6" } } */