blob: 2caa1f532ead30a5aa9a4c7d123326631d6af848 [file] [log] [blame]
/* { dg-do compile } */
/* { dg-options "-Ofast -fdump-tree-vrp-thread1-details" } */
typedef unsigned short u16;
typedef unsigned char u8;
typedef unsigned int u32;
__extension__ typedef __INT32_TYPE__ i32;
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; i32 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;
}
/* Previously we had 3 jump threads, but one of them crossed loops.
The reason the old threader was allowing it, was because there was
an ASSERT_EXPR getting in the way. Without the ASSERT_EXPR, we
have an empty pre-header block as the final block in the thread,
which the threader will simply join with the next block which *is*
in a different loop. */
/* { dg-final { scan-tree-dump-times "Registering jump thread" 2 "vrp-thread1" } } */
/* { dg-final { scan-tree-dump-not "joiner" "vrp-thread1" } } */