Debian Codegraph @

gcc/testsuite/gcc.dg/pr106243.c

raw
1 /* PR tree-optimization/106243 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -Wno-psabi -fdump-tree-optimized" } */
4
5 #define vector __attribute__((vector_size(4*sizeof(int))))
6
7 /* Test from PR. */
8 __attribute__((noipa)) int foo (int x) {
9 return -x & 1;
10 }
11
12 /* Other test from PR. */
13 __attribute__((noipa)) int bar (int x) {
14 return (0 - x) & 1;
15 }
16
17 /* Forward propogation. */
18 __attribute__((noipa)) int baz (int x) {
19 x = -x;
20 return x & 1;
21 }
22
23 /* Commutative property. */
24 __attribute__((noipa)) int qux (int x) {
25 return 1 & -x;
26 }
27
28 /* Vector test case. */
29 __attribute__((noipa)) vector int waldo (vector int x) {
30 return -x & 1;
31 }
32
33 /* Should not simplify. */
34 __attribute__((noipa)) int thud (int x) {
35 return -x & 2;
36 }
37
38 /* Should not simplify. */
39 __attribute__((noipa)) int corge (int x) {
40 return -x & -1;
41 }
42
43 /* { dg-final {scan-tree-dump-times "-" 2 "optimized" } } */