PR testsuite/52641
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / vrp77.c
blobc0a8a865388da3310bcd71fdd118e3be795856f5
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 #ifdef __SIZEOF_INT128__
5 #define T __int128
6 #else
7 #define T long long
8 #endif
10 extern void impossible (void);
12 void f(T x)
14 unsigned T y;
15 unsigned T z;
16 if (x < -7)
17 return;
18 if (x > 2)
19 return;
20 y = x;
21 z = y * y;
22 if (z == 666)
23 impossible ();
26 void g(unsigned T x)
28 unsigned T y;
29 unsigned T z;
30 unsigned T m = -1;
31 m = m / 2;
32 if (x < m-2)
33 return;
34 if (x > m-1)
35 return;
36 y = x;
37 z = y * y;
38 /* The product (ignoring it is a square) has only 3 possible values:
39 4, 9 and 2^127+6. At least one of the values 7, 666 and -666 is
40 known to be impossible. 7 is the most logical in the current
41 implementation. */
42 if (z == 7)
43 impossible ();
46 /* { dg-final { scan-tree-dump-not "impossible" "optimized" } } */
47 /* { dg-final { cleanup-tree-dump "optimized" } } */