2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr51244-15.c
blob8b9d57bf8d3d9b9fbf6ff2c37c6260d61773e7e9
1 /* Check that the redundant test removal code in the *cbranch_t split works
2 as expected. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
6 /* { dg-final { scan-assembler-not "extu|exts|negc" } } */
7 /* { dg-final { scan-assembler-times "tst" 6 } } */
9 /* { dg-final { scan-assembler-times "movt" 6 { target { ! sh2a } } } } */
10 /* { dg-final { scan-assembler-times "xor" 3 { target { ! sh2a } } } } */
12 /* { dg-final { scan-assembler-times "movt" 3 { target { sh2a } } } } */
13 /* { dg-final { scan-assembler-times "movrt" 3 { target { sh2a } } } } */
15 typedef char bool;
17 int
18 test_0 (int a, int b, int c, int* d)
20 /* non SH2A: 1x tst, 1x movt, 1x xor
21 SH2A: 1x tst, 1x movrt */
22 bool x = a == 0;
23 d[2] = !x;
24 return x ? b : c;
27 int
28 test_1 (int a, int b, int c, int* d)
30 /* 1x tst, 1x movt */
31 bool x = a != 0;
32 d[2] = !x;
33 return x ? b : c;
36 int
37 test_2 (int a, int b, int c, char* d)
39 /* Check that there is no sign/zero-extension before the store.
40 non SH2A: 1x tst, 1x movt, 1x xor
41 SH2A: 1x tst, 1x movrt */
42 bool x = a == 0;
43 d[2] = !x;
44 return x ? b : c;
47 int
48 test_3 (int a, int b, int c, char* d)
50 /* Check that there is no sign/zero-extension before the store.
51 1x tst, 1x movt */
52 bool x = a != 0;
53 d[2] = !x;
54 return x ? b : c;
57 int
58 test_4 (int a, int b, int c, char* d)
60 /* 1x tst, 1x movt */
61 bool x = a != 0;
62 d[2] = !x;
63 return !x ? b : c;
66 int
67 test_5 (int a, int b, int c, char* d)
69 /* non SH2A: 1x tst, 1x movt, 1x xor
70 SH2A: 1x tst, 1x movrt */
71 bool x = a == 0;
72 d[2] = !x;
73 return !x ? b : c;