Update ChangeLog and version files for release
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / bics_2.c
blobe33c748ff6b3614ab4b6398024c3a43b2738a248
1 /* { dg-do run } */
2 /* { dg-options "-O2 --save-temps -fno-inline" } */
4 extern void abort (void);
6 int
7 bics_si_test1 (int a, int b, int c)
9 int d = a & ~b;
11 /* { dg-final { scan-assembler-not "bics\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" } } */
12 /* { dg-final { scan-assembler-times "bic\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" 2 } } */
13 if (d <= 0)
14 return a + c;
15 else
16 return b + d + c;
19 int
20 bics_si_test2 (int a, int b, int c)
22 int d = a & ~(b << 3);
24 /* { dg-final { scan-assembler-not "bics\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" } } */
25 /* { dg-final { scan-assembler "bic\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" } } */
26 if (d <= 0)
27 return a + c;
28 else
29 return b + d + c;
32 typedef long long s64;
34 s64
35 bics_di_test1 (s64 a, s64 b, s64 c)
37 s64 d = a & ~b;
39 /* { dg-final { scan-assembler-not "bics\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" } } */
40 /* { dg-final { scan-assembler-times "bic\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" 2 } } */
41 if (d <= 0)
42 return a + c;
43 else
44 return b + d + c;
47 s64
48 bics_di_test2 (s64 a, s64 b, s64 c)
50 s64 d = a & ~(b << 3);
52 /* { dg-final { scan-assembler-not "bics\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, lsl 3" } } */
53 /* { dg-final { scan-assembler "bic\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, lsl 3" } } */
54 if (d <= 0)
55 return a + c;
56 else
57 return b + d + c;
60 int
61 main ()
63 int x;
64 s64 y;
66 x = bics_si_test1 (29, ~4, 5);
67 if (x != ((29 & 4) + ~4 + 5))
68 abort ();
70 x = bics_si_test1 (5, ~2, 20);
71 if (x != 25)
72 abort ();
74 x = bics_si_test2 (35, ~4, 5);
75 if (x != ((35 & ~(~4 << 3)) + ~4 + 5))
76 abort ();
78 x = bics_si_test2 (96, ~2, 20);
79 if (x != 116)
80 abort ();
82 y = bics_di_test1 (0x130000029ll,
83 ~0x320000004ll,
84 0x505050505ll);
86 if (y != ((0x130000029ll & 0x320000004ll) + ~0x320000004ll + 0x505050505ll))
87 abort ();
89 y = bics_di_test1 (0x5000500050005ll,
90 ~0x2111211121112ll,
91 0x0000000002020ll);
92 if (y != 0x5000500052025ll)
93 abort ();
95 y = bics_di_test2 (0x130000029ll,
96 ~0x064000008ll,
97 0x505050505ll);
98 if (y != ((0x130000029ll & ~(~0x064000008ll << 3))
99 + ~0x064000008ll + 0x505050505ll))
100 abort ();
102 y = bics_di_test2 (0x130002900ll,
103 ~0x088000008ll,
104 0x505050505ll);
105 if (y != (0x130002900ll + 0x505050505ll))
106 abort ();
108 return 0;
111 /* { dg-final { cleanup-saved-temps } } */