re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / scev-cast.c
1 /* A test for various conversions of chrecs. */
2
3 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
4 /* { dg-options "-O2 -fdump-tree-optimized" } */
5
6 void blas (char xxx);
7 void blau (unsigned char xxx);
8
9 void tst(void)
10 {
11 unsigned i;
12
13 for (i = 0; i < 128; i++) /* This cast to char has to be preserved. */
14 blas ((char) i);
15 for (i = 0; i < 127; i++) /* And this one does not. */
16 blas ((char) i);
17 for (i = 0; i < 255; i++) /* This cast is not necessary. */
18 blau ((unsigned char) i);
19 for (i = 0; i < 256; i++)
20 blau ((unsigned char) i); /* This one is necessary. */
21 }
22
23 /* { dg-final { scan-tree-dump-times "\\(int\\) \\(unsigned char\\)" 1 "optimized" } } */
24 /* { dg-final { scan-tree-dump-times "\\(int\\) \\(char\\)" 1 "optimized" } } */
25
26 /* { dg-final { cleanup-tree-dump "optimized" } } */