2018-04-30 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr59597.c
blobdab16abe5223107b2d11528dc6ed0396f9fa2e98
1 /* { dg-do compile } */
2 /* { dg-options "-Ofast -fdump-tree-vrp1-details" } */
4 typedef unsigned short u16;
5 typedef unsigned char u8;
6 typedef unsigned int u32;
7 __extension__ typedef __INT32_TYPE__ i32;
9 long int random(int);
10 #define NNN 10
12 u32 f[NNN], t[NNN];
14 static u16
15 Calc_crc8 (u8 data, u16 crc)
17 u8 i=0,x16=0,carry=0;
18 for (i = 0; i < 8; i++)
20 x16 = (u8)((data & 1) ^ ((u8)crc & 1));
21 data >>= 1;
23 if (x16 == 1)
25 crc ^= 0x4002;
26 carry = 1;
28 else
29 carry = 0;
30 crc >>= 1;
31 if (carry)
32 crc |= 0x8000;
33 else
34 crc &= 0x7fff;
36 return crc;
39 int
40 main (int argc, char argv[])
42 int i; i32 j; u16 crc;
43 for (j = 0; j < 10000000; j++)
45 for (i = 0; i < NNN; i++)
47 f[i] = random(i);
48 t[i] = random(NNN - i - 1);
50 for (i=0; i<NNN; i++)
52 crc=Calc_crc8(f[i],(u16)argc);
53 crc=Calc_crc8(t[i],crc);
56 return crc;
59 /* { dg-final { scan-tree-dump-times "Registering jump thread" 3 "vrp1" } } */
60 /* { dg-final { scan-tree-dump-not "joiner" "vrp1" } } */
61 /* { dg-final { scan-tree-dump-times "Threaded jump" 3 "vrp1" } } */