summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr59597.c
blob: 4ac12c8c15cf47f1bb61e57835f02c7bd3dd41f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* { dg-do compile } */
/* { dg-options "-Ofast -fdump-tree-vrp1-details" } */

typedef unsigned short u16;
typedef unsigned char u8;
typedef unsigned int u32;
long int random(int);
#define NNN 10

u32 f[NNN], t[NNN];

static u16
Calc_crc8 (u8 data, u16 crc)
{
  u8 i=0,x16=0,carry=0;
  for (i = 0; i < 8; i++)
    {
      x16 = (u8)((data & 1) ^ ((u8)crc & 1));
      data >>= 1;
 
      if (x16 == 1)
	{
	  crc ^= 0x4002;
	  carry = 1;
	}
      else
	carry = 0;
      crc >>= 1;
      if (carry)
	crc |= 0x8000;
      else
	crc &= 0x7fff;
    }
  return crc;
}

int
main (int argc, char argv[])
{
  int i, j; u16 crc;
  for (j = 0; j < 10000000; j++)
    {
      for (i = 0; i < NNN; i++)
	{
	  f[i] = random(i);
	  t[i] = random(NNN - i - 1);
	}
      for (i=0; i<NNN; i++) 
	{
	  crc=Calc_crc8(f[i],(u16)argc);
	  crc=Calc_crc8(t[i],crc);
	}
    }
  return crc;
}

/* { dg-final { scan-tree-dump-times "Registering jump thread" 3 "vrp1" } } */
/* { dg-final { scan-tree-dump-not "joiner" "vrp1" } } */
/* { dg-final { scan-tree-dump-times "Threaded jump" 3 "vrp1" } } */