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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
/* PR tree-optimization/51581 */
/* { dg-require-effective-target int32plus } */
extern void abort (void);
#define N 4096
int a[N], c[N];
unsigned int b[N], d[N];
__attribute__((noinline, noclone)) void
f1 (void)
{
int i;
for (i = 0; i < N; i++)
c[i] = a[i] / 3;
}
__attribute__((noinline, noclone)) void
f2 (void)
{
int i;
for (i = 0; i < N; i++)
d[i] = b[i] / 3;
}
__attribute__((noinline, noclone)) void
f3 (void)
{
int i;
for (i = 0; i < N; i++)
c[i] = a[i] / 18;
}
__attribute__((noinline, noclone)) void
f4 (void)
{
int i;
for (i = 0; i < N; i++)
d[i] = b[i] / 18;
}
__attribute__((noinline, noclone)) void
f5 (void)
{
int i;
for (i = 0; i < N; i++)
c[i] = a[i] / 19;
}
__attribute__((noinline, noclone)) void
f6 (void)
{
int i;
for (i = 0; i < N; i++)
d[i] = b[i] / 19;
}
#if __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ == 8
__attribute__((noinline, noclone)) void
f7 (void)
{
int i;
for (i = 0; i < N; i++)
c[i] = (int) ((unsigned long long) (a[i] * 0x55555556LL) >> 32) - (a[i] >> 31);
}
__attribute__((noinline, noclone)) void
f8 (void)
{
int i;
for (i = 0; i < N; i++)
d[i] = ((unsigned int) ((b[i] * 0xaaaaaaabULL) >> 32) >> 1);
}
__attribute__((noinline, noclone)) void
f9 (void)
{
int i;
for (i = 0; i < N; i++)
c[i] = (((int) ((unsigned long long) (a[i] * 0x38e38e39LL) >> 32)) >> 2) - (a[i] >> 31);
}
__attribute__((noinline, noclone)) void
f10 (void)
{
int i;
for (i = 0; i < N; i++)
d[i] = (unsigned int) ((b[i] * 0x38e38e39ULL) >> 32) >> 2;
}
__attribute__((noinline, noclone)) void
f11 (void)
{
int i;
for (i = 0; i < N; i++)
c[i] = (((int) ((unsigned long long) (a[i] * 0x6bca1af3LL) >> 32)) >> 3) - (a[i] >> 31);
}
__attribute__((noinline, noclone)) void
f12 (void)
{
int i;
for (i = 0; i < N; i++)
{
unsigned int tmp = (b[i] * 0xaf286bcbULL) >> 32;
d[i] = (((b[i] - tmp) >> 1) + tmp) >> 4;
}
}
#endif
int
main ()
{
int i;
for (i = 0; i < N; i++)
{
asm ("");
a[i] = i - N / 2;
b[i] = i;
}
a[0] = -__INT_MAX__ - 1;
a[1] = -__INT_MAX__;
a[N - 1] = __INT_MAX__;
b[N - 1] = ~0;
f1 ();
f2 ();
for (i = 0; i < N; i++)
if (c[i] != a[i] / 3 || d[i] != b[i] / 3)
abort ();
f3 ();
f4 ();
for (i = 0; i < N; i++)
if (c[i] != a[i] / 18 || d[i] != b[i] / 18)
abort ();
f5 ();
f6 ();
for (i = 0; i < N; i++)
if (c[i] != a[i] / 19 || d[i] != b[i] / 19)
abort ();
#if __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ == 8
f7 ();
f8 ();
for (i = 0; i < N; i++)
if (c[i] != a[i] / 3 || d[i] != b[i] / 3)
abort ();
f9 ();
f10 ();
for (i = 0; i < N; i++)
if (c[i] != a[i] / 18 || d[i] != b[i] / 18)
abort ();
f11 ();
f12 ();
for (i = 0; i < N; i++)
if (c[i] != a[i] / 19 || d[i] != b[i] / 19)
abort ();
#endif
return 0;
}
|