PR c++/67273
[official-gcc.git] / gcc / testsuite / gcc.target / arm / bics_2.c
blobfae5eae5d5a13249a4f4c968210225d99de2a214
1 /* { dg-do run } */
2 /* { dg-options "-O2 --save-temps -fno-inline" } */
3 /* { dg-require-effective-target arm32 } */
5 extern void abort (void);
7 int
8 bics_si_test1 (int a, int b, int c)
10 int d = a & ~b;
12 /* { dg-final { scan-assembler-not "bics\tr\[0-9\]+, r\[0-9\]+, r\[0-9\]+" } } */
13 /* { dg-final { scan-assembler-times "bic\tr\[0-9\]+, r\[0-9\]+, r\[0-9\]+" 2 } } */
14 if (d <= 0)
15 return a + c;
16 else
17 return b + d + c;
20 int
21 bics_si_test2 (int a, int b, int c)
23 int d = a & ~(b << 3);
25 /* { dg-final { scan-assembler-not "bics\tr\[0-9\]+, r\[0-9\]+, r\[0-9\]+, .sl \#3" } } */
26 /* { dg-final { scan-assembler "bic\tr\[0-9\]+, r\[0-9\]+, r\[0-9\]+, .sl \#3" } } */
27 if (d <= 0)
28 return a + c;
29 else
30 return b + d + c;
33 int
34 main ()
36 int x;
38 x = bics_si_test1 (29, ~4, 5);
39 if (x != ((29 & 4) + ~4 + 5))
40 abort ();
42 x = bics_si_test1 (5, ~2, 20);
43 if (x != 25)
44 abort ();
46 x = bics_si_test2 (35, ~4, 5);
47 if (x != ((35 & ~(~4 << 3)) + ~4 + 5))
48 abort ();
50 x = bics_si_test2 (96, ~2, 20);
51 if (x != 116)
52 abort ();
54 return 0;