New tests.
From-SVN: r43111
This commit is contained in:
parent
ee92cb46db
commit
07a96c1b40
@ -1,3 +1,9 @@
|
||||
2001-06-09 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* gcc.c-torture/execute/ashrdi-1.c: New.
|
||||
* gcc.c-torture/execute/ashldi-1.c: New.
|
||||
* gcc.c-torture/execute/lshrdi-1.c: New.
|
||||
|
||||
2001-06-09 Ovidiu Predescu <ovidiu@cup.hp.com>
|
||||
|
||||
* objc/execute/load-3.m: Added. Check sending +load to categories,
|
||||
|
221
gcc/testsuite/gcc.c-torture/execute/ashldi-1.c
Normal file
221
gcc/testsuite/gcc.c-torture/execute/ashldi-1.c
Normal file
@ -0,0 +1,221 @@
|
||||
#include <limits.h>
|
||||
|
||||
extern void abort(void);
|
||||
extern void exit(int);
|
||||
|
||||
#if __LONG_LONG_MAX__ == 9223372036854775807LL
|
||||
#define BITS 64
|
||||
|
||||
static unsigned long long const data[64] = {
|
||||
0x123456789abcdefULL,
|
||||
0x2468acf13579bdeULL,
|
||||
0x48d159e26af37bcULL,
|
||||
0x91a2b3c4d5e6f78ULL,
|
||||
0x123456789abcdef0ULL,
|
||||
0x2468acf13579bde0ULL,
|
||||
0x48d159e26af37bc0ULL,
|
||||
0x91a2b3c4d5e6f780ULL,
|
||||
0x23456789abcdef00ULL,
|
||||
0x468acf13579bde00ULL,
|
||||
0x8d159e26af37bc00ULL,
|
||||
0x1a2b3c4d5e6f7800ULL,
|
||||
0x3456789abcdef000ULL,
|
||||
0x68acf13579bde000ULL,
|
||||
0xd159e26af37bc000ULL,
|
||||
0xa2b3c4d5e6f78000ULL,
|
||||
0x456789abcdef0000ULL,
|
||||
0x8acf13579bde0000ULL,
|
||||
0x159e26af37bc0000ULL,
|
||||
0x2b3c4d5e6f780000ULL,
|
||||
0x56789abcdef00000ULL,
|
||||
0xacf13579bde00000ULL,
|
||||
0x59e26af37bc00000ULL,
|
||||
0xb3c4d5e6f7800000ULL,
|
||||
0x6789abcdef000000ULL,
|
||||
0xcf13579bde000000ULL,
|
||||
0x9e26af37bc000000ULL,
|
||||
0x3c4d5e6f78000000ULL,
|
||||
0x789abcdef0000000ULL,
|
||||
0xf13579bde0000000ULL,
|
||||
0xe26af37bc0000000ULL,
|
||||
0xc4d5e6f780000000ULL,
|
||||
0x89abcdef00000000ULL,
|
||||
0x13579bde00000000ULL,
|
||||
0x26af37bc00000000ULL,
|
||||
0x4d5e6f7800000000ULL,
|
||||
0x9abcdef000000000ULL,
|
||||
0x3579bde000000000ULL,
|
||||
0x6af37bc000000000ULL,
|
||||
0xd5e6f78000000000ULL,
|
||||
0xabcdef0000000000ULL,
|
||||
0x579bde0000000000ULL,
|
||||
0xaf37bc0000000000ULL,
|
||||
0x5e6f780000000000ULL,
|
||||
0xbcdef00000000000ULL,
|
||||
0x79bde00000000000ULL,
|
||||
0xf37bc00000000000ULL,
|
||||
0xe6f7800000000000ULL,
|
||||
0xcdef000000000000ULL,
|
||||
0x9bde000000000000ULL,
|
||||
0x37bc000000000000ULL,
|
||||
0x6f78000000000000ULL,
|
||||
0xdef0000000000000ULL,
|
||||
0xbde0000000000000ULL,
|
||||
0x7bc0000000000000ULL,
|
||||
0xf780000000000000ULL,
|
||||
0xef00000000000000ULL,
|
||||
0xde00000000000000ULL,
|
||||
0xbc00000000000000ULL,
|
||||
0x7800000000000000ULL,
|
||||
0xf000000000000000ULL,
|
||||
0xe000000000000000ULL,
|
||||
0xc000000000000000ULL,
|
||||
0x8000000000000000ULL
|
||||
};
|
||||
|
||||
#elif __LONG_LONG_MAX__ == 2147483647LL
|
||||
#define BITS 32
|
||||
|
||||
static unsigned long long const data[32] = {
|
||||
0x1234567fULL,
|
||||
0x2468acfeULL,
|
||||
0x48d159fcULL,
|
||||
0x91a2b3f8ULL,
|
||||
0x234567f0ULL,
|
||||
0x468acfe0ULL,
|
||||
0x8d159fc0ULL,
|
||||
0x1a2b3f80ULL,
|
||||
0x34567f00ULL,
|
||||
0x68acfe00ULL,
|
||||
0xd159fc00ULL,
|
||||
0xa2b3f800ULL,
|
||||
0x4567f000ULL,
|
||||
0x8acfe000ULL,
|
||||
0x159fc000ULL,
|
||||
0x2b3f8000ULL,
|
||||
0x567f0000ULL,
|
||||
0xacfe0000ULL,
|
||||
0x59fc0000ULL,
|
||||
0xb3f80000ULL,
|
||||
0x67f00000ULL,
|
||||
0xcfe00000ULL,
|
||||
0x9fc00000ULL,
|
||||
0x3f800000ULL,
|
||||
0x7f000000ULL,
|
||||
0xfe000000ULL,
|
||||
0xfc000000ULL,
|
||||
0xf8000000ULL,
|
||||
0xf0000000ULL,
|
||||
0xe0000000ULL,
|
||||
0xc0000000ULL,
|
||||
0x80000000ULL
|
||||
};
|
||||
|
||||
#else
|
||||
#error "Update the test case."
|
||||
#endif
|
||||
|
||||
static unsigned long long
|
||||
variable_shift(unsigned long long x, int i)
|
||||
{
|
||||
return x << i;
|
||||
}
|
||||
|
||||
static unsigned long long
|
||||
constant_shift(unsigned long long x, int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: x = x << 0; break;
|
||||
case 1: x = x << 1; break;
|
||||
case 2: x = x << 2; break;
|
||||
case 3: x = x << 3; break;
|
||||
case 4: x = x << 4; break;
|
||||
case 5: x = x << 5; break;
|
||||
case 6: x = x << 6; break;
|
||||
case 7: x = x << 7; break;
|
||||
case 8: x = x << 8; break;
|
||||
case 9: x = x << 9; break;
|
||||
case 10: x = x << 10; break;
|
||||
case 11: x = x << 11; break;
|
||||
case 12: x = x << 12; break;
|
||||
case 13: x = x << 13; break;
|
||||
case 14: x = x << 14; break;
|
||||
case 15: x = x << 15; break;
|
||||
case 16: x = x << 16; break;
|
||||
case 17: x = x << 17; break;
|
||||
case 18: x = x << 18; break;
|
||||
case 19: x = x << 19; break;
|
||||
case 20: x = x << 20; break;
|
||||
case 21: x = x << 21; break;
|
||||
case 22: x = x << 22; break;
|
||||
case 23: x = x << 23; break;
|
||||
case 24: x = x << 24; break;
|
||||
case 25: x = x << 25; break;
|
||||
case 26: x = x << 26; break;
|
||||
case 27: x = x << 27; break;
|
||||
case 28: x = x << 28; break;
|
||||
case 29: x = x << 29; break;
|
||||
case 30: x = x << 30; break;
|
||||
case 31: x = x << 31; break;
|
||||
#if BITS > 32
|
||||
case 32: x = x << 32; break;
|
||||
case 33: x = x << 33; break;
|
||||
case 34: x = x << 34; break;
|
||||
case 35: x = x << 35; break;
|
||||
case 36: x = x << 36; break;
|
||||
case 37: x = x << 37; break;
|
||||
case 38: x = x << 38; break;
|
||||
case 39: x = x << 39; break;
|
||||
case 40: x = x << 40; break;
|
||||
case 41: x = x << 41; break;
|
||||
case 42: x = x << 42; break;
|
||||
case 43: x = x << 43; break;
|
||||
case 44: x = x << 44; break;
|
||||
case 45: x = x << 45; break;
|
||||
case 46: x = x << 46; break;
|
||||
case 47: x = x << 47; break;
|
||||
case 48: x = x << 48; break;
|
||||
case 49: x = x << 49; break;
|
||||
case 50: x = x << 50; break;
|
||||
case 51: x = x << 51; break;
|
||||
case 52: x = x << 52; break;
|
||||
case 53: x = x << 53; break;
|
||||
case 54: x = x << 54; break;
|
||||
case 55: x = x << 55; break;
|
||||
case 56: x = x << 56; break;
|
||||
case 57: x = x << 57; break;
|
||||
case 58: x = x << 58; break;
|
||||
case 59: x = x << 59; break;
|
||||
case 60: x = x << 60; break;
|
||||
case 61: x = x << 61; break;
|
||||
case 62: x = x << 62; break;
|
||||
case 63: x = x << 63; break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < BITS; ++i)
|
||||
{
|
||||
unsigned long long y = variable_shift (data[0], i);
|
||||
if (y != data[i])
|
||||
abort ();
|
||||
}
|
||||
for (i = 0; i < BITS; ++i)
|
||||
{
|
||||
unsigned long long y = constant_shift (data[0], i);
|
||||
if (y != data[i])
|
||||
abort ();
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
335
gcc/testsuite/gcc.c-torture/execute/ashrdi-1.c
Normal file
335
gcc/testsuite/gcc.c-torture/execute/ashrdi-1.c
Normal file
@ -0,0 +1,335 @@
|
||||
#include <limits.h>
|
||||
|
||||
extern void abort(void);
|
||||
extern void exit(int);
|
||||
|
||||
#if __LONG_LONG_MAX__ == 9223372036854775807LL
|
||||
#define BITS 64
|
||||
|
||||
static long long const zext[64] = {
|
||||
0x7654321fedcba980LL,
|
||||
0x3b2a190ff6e5d4c0LL,
|
||||
0x1d950c87fb72ea60LL,
|
||||
0xeca8643fdb97530LL,
|
||||
0x7654321fedcba98LL,
|
||||
0x3b2a190ff6e5d4cLL,
|
||||
0x1d950c87fb72ea6LL,
|
||||
0xeca8643fdb9753LL,
|
||||
0x7654321fedcba9LL,
|
||||
0x3b2a190ff6e5d4LL,
|
||||
0x1d950c87fb72eaLL,
|
||||
0xeca8643fdb975LL,
|
||||
0x7654321fedcbaLL,
|
||||
0x3b2a190ff6e5dLL,
|
||||
0x1d950c87fb72eLL,
|
||||
0xeca8643fdb97LL,
|
||||
0x7654321fedcbLL,
|
||||
0x3b2a190ff6e5LL,
|
||||
0x1d950c87fb72LL,
|
||||
0xeca8643fdb9LL,
|
||||
0x7654321fedcLL,
|
||||
0x3b2a190ff6eLL,
|
||||
0x1d950c87fb7LL,
|
||||
0xeca8643fdbLL,
|
||||
0x7654321fedLL,
|
||||
0x3b2a190ff6LL,
|
||||
0x1d950c87fbLL,
|
||||
0xeca8643fdLL,
|
||||
0x7654321feLL,
|
||||
0x3b2a190ffLL,
|
||||
0x1d950c87fLL,
|
||||
0xeca8643fLL,
|
||||
0x7654321fLL,
|
||||
0x3b2a190fLL,
|
||||
0x1d950c87LL,
|
||||
0xeca8643LL,
|
||||
0x7654321LL,
|
||||
0x3b2a190LL,
|
||||
0x1d950c8LL,
|
||||
0xeca864LL,
|
||||
0x765432LL,
|
||||
0x3b2a19LL,
|
||||
0x1d950cLL,
|
||||
0xeca86LL,
|
||||
0x76543LL,
|
||||
0x3b2a1LL,
|
||||
0x1d950LL,
|
||||
0xeca8LL,
|
||||
0x7654LL,
|
||||
0x3b2aLL,
|
||||
0x1d95LL,
|
||||
0xecaLL,
|
||||
0x765LL,
|
||||
0x3b2LL,
|
||||
0x1d9LL,
|
||||
0xecLL,
|
||||
0x76LL,
|
||||
0x3bLL,
|
||||
0x1dLL,
|
||||
0xeLL,
|
||||
0x7LL,
|
||||
0x3LL,
|
||||
0x1LL,
|
||||
0LL
|
||||
};
|
||||
|
||||
static long long const sext[64] = {
|
||||
0x8edcba9f76543210LL,
|
||||
0xc76e5d4fbb2a1908LL,
|
||||
0xe3b72ea7dd950c84LL,
|
||||
0xf1db9753eeca8642LL,
|
||||
0xf8edcba9f7654321LL,
|
||||
0xfc76e5d4fbb2a190LL,
|
||||
0xfe3b72ea7dd950c8LL,
|
||||
0xff1db9753eeca864LL,
|
||||
0xff8edcba9f765432LL,
|
||||
0xffc76e5d4fbb2a19LL,
|
||||
0xffe3b72ea7dd950cLL,
|
||||
0xfff1db9753eeca86LL,
|
||||
0xfff8edcba9f76543LL,
|
||||
0xfffc76e5d4fbb2a1LL,
|
||||
0xfffe3b72ea7dd950LL,
|
||||
0xffff1db9753eeca8LL,
|
||||
0xffff8edcba9f7654LL,
|
||||
0xffffc76e5d4fbb2aLL,
|
||||
0xffffe3b72ea7dd95LL,
|
||||
0xfffff1db9753eecaLL,
|
||||
0xfffff8edcba9f765LL,
|
||||
0xfffffc76e5d4fbb2LL,
|
||||
0xfffffe3b72ea7dd9LL,
|
||||
0xffffff1db9753eecLL,
|
||||
0xffffff8edcba9f76LL,
|
||||
0xffffffc76e5d4fbbLL,
|
||||
0xffffffe3b72ea7ddLL,
|
||||
0xfffffff1db9753eeLL,
|
||||
0xfffffff8edcba9f7LL,
|
||||
0xfffffffc76e5d4fbLL,
|
||||
0xfffffffe3b72ea7dLL,
|
||||
0xffffffff1db9753eLL,
|
||||
0xffffffff8edcba9fLL,
|
||||
0xffffffffc76e5d4fLL,
|
||||
0xffffffffe3b72ea7LL,
|
||||
0xfffffffff1db9753LL,
|
||||
0xfffffffff8edcba9LL,
|
||||
0xfffffffffc76e5d4LL,
|
||||
0xfffffffffe3b72eaLL,
|
||||
0xffffffffff1db975LL,
|
||||
0xffffffffff8edcbaLL,
|
||||
0xffffffffffc76e5dLL,
|
||||
0xffffffffffe3b72eLL,
|
||||
0xfffffffffff1db97LL,
|
||||
0xfffffffffff8edcbLL,
|
||||
0xfffffffffffc76e5LL,
|
||||
0xfffffffffffe3b72LL,
|
||||
0xffffffffffff1db9LL,
|
||||
0xffffffffffff8edcLL,
|
||||
0xffffffffffffc76eLL,
|
||||
0xffffffffffffe3b7LL,
|
||||
0xfffffffffffff1dbLL,
|
||||
0xfffffffffffff8edLL,
|
||||
0xfffffffffffffc76LL,
|
||||
0xfffffffffffffe3bLL,
|
||||
0xffffffffffffff1dLL,
|
||||
0xffffffffffffff8eLL,
|
||||
0xffffffffffffffc7LL,
|
||||
0xffffffffffffffe3LL,
|
||||
0xfffffffffffffff1LL,
|
||||
0xfffffffffffffff8LL,
|
||||
0xfffffffffffffffcLL,
|
||||
0xfffffffffffffffeLL,
|
||||
0xffffffffffffffffLL
|
||||
};
|
||||
|
||||
#elif __LONG_LONG_MAX__ == 2147483647LL
|
||||
#define BITS 32
|
||||
|
||||
static long long const zext[32] = {
|
||||
0x76543218LL,
|
||||
0x3b2a190cLL,
|
||||
0x1d950c86LL,
|
||||
0xeca8643LL,
|
||||
0x7654321LL,
|
||||
0x3b2a190LL,
|
||||
0x1d950c8LL,
|
||||
0xeca864LL,
|
||||
0x765432LL,
|
||||
0x3b2a19LL,
|
||||
0x1d950cLL,
|
||||
0xeca86LL,
|
||||
0x76543LL,
|
||||
0x3b2a1LL,
|
||||
0x1d950LL,
|
||||
0xeca8LL,
|
||||
0x7654LL,
|
||||
0x3b2aLL,
|
||||
0x1d95LL,
|
||||
0xecaLL,
|
||||
0x765LL,
|
||||
0x3b2LL,
|
||||
0x1d9LL,
|
||||
0xecLL,
|
||||
0x76LL,
|
||||
0x3bLL,
|
||||
0x1dLL,
|
||||
0xeLL,
|
||||
0x7LL,
|
||||
0x3LL,
|
||||
0x1LL,
|
||||
0LL
|
||||
};
|
||||
|
||||
static long long const sext[64] = {
|
||||
0x87654321LL,
|
||||
0xc3b2a190LL,
|
||||
0xe1d950c8LL,
|
||||
0xf0eca864LL,
|
||||
0xf8765432LL,
|
||||
0xfc3b2a19LL,
|
||||
0xfe1d950cLL,
|
||||
0xff0eca86LL,
|
||||
0xff876543LL,
|
||||
0xffc3b2a1LL,
|
||||
0xffe1d950LL,
|
||||
0xfff0eca8LL,
|
||||
0xfff87654LL,
|
||||
0xfffc3b2aLL,
|
||||
0xfffe1d95LL,
|
||||
0xffff0ecaLL,
|
||||
0xffff8765LL,
|
||||
0xffffc3b2LL,
|
||||
0xffffe1d9LL,
|
||||
0xfffff0ecLL,
|
||||
0xfffff876LL,
|
||||
0xfffffc3bLL,
|
||||
0xfffffe1dLL,
|
||||
0xffffff0eLL,
|
||||
0xffffff87LL,
|
||||
0xffffffc3LL,
|
||||
0xffffffe1LL,
|
||||
0xfffffff0LL,
|
||||
0xfffffff8LL,
|
||||
0xfffffffcLL,
|
||||
0xfffffffeLL,
|
||||
0xffffffffLL
|
||||
};
|
||||
|
||||
#else
|
||||
#error "Update the test case."
|
||||
#endif
|
||||
|
||||
static long long
|
||||
variable_shift(long long x, int i)
|
||||
{
|
||||
return x >> i;
|
||||
}
|
||||
|
||||
static long long
|
||||
constant_shift(long long x, int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: x = x >> 0; break;
|
||||
case 1: x = x >> 1; break;
|
||||
case 2: x = x >> 2; break;
|
||||
case 3: x = x >> 3; break;
|
||||
case 4: x = x >> 4; break;
|
||||
case 5: x = x >> 5; break;
|
||||
case 6: x = x >> 6; break;
|
||||
case 7: x = x >> 7; break;
|
||||
case 8: x = x >> 8; break;
|
||||
case 9: x = x >> 9; break;
|
||||
case 10: x = x >> 10; break;
|
||||
case 11: x = x >> 11; break;
|
||||
case 12: x = x >> 12; break;
|
||||
case 13: x = x >> 13; break;
|
||||
case 14: x = x >> 14; break;
|
||||
case 15: x = x >> 15; break;
|
||||
case 16: x = x >> 16; break;
|
||||
case 17: x = x >> 17; break;
|
||||
case 18: x = x >> 18; break;
|
||||
case 19: x = x >> 19; break;
|
||||
case 20: x = x >> 20; break;
|
||||
case 21: x = x >> 21; break;
|
||||
case 22: x = x >> 22; break;
|
||||
case 23: x = x >> 23; break;
|
||||
case 24: x = x >> 24; break;
|
||||
case 25: x = x >> 25; break;
|
||||
case 26: x = x >> 26; break;
|
||||
case 27: x = x >> 27; break;
|
||||
case 28: x = x >> 28; break;
|
||||
case 29: x = x >> 29; break;
|
||||
case 30: x = x >> 30; break;
|
||||
case 31: x = x >> 31; break;
|
||||
#if BITS > 32
|
||||
case 32: x = x >> 32; break;
|
||||
case 33: x = x >> 33; break;
|
||||
case 34: x = x >> 34; break;
|
||||
case 35: x = x >> 35; break;
|
||||
case 36: x = x >> 36; break;
|
||||
case 37: x = x >> 37; break;
|
||||
case 38: x = x >> 38; break;
|
||||
case 39: x = x >> 39; break;
|
||||
case 40: x = x >> 40; break;
|
||||
case 41: x = x >> 41; break;
|
||||
case 42: x = x >> 42; break;
|
||||
case 43: x = x >> 43; break;
|
||||
case 44: x = x >> 44; break;
|
||||
case 45: x = x >> 45; break;
|
||||
case 46: x = x >> 46; break;
|
||||
case 47: x = x >> 47; break;
|
||||
case 48: x = x >> 48; break;
|
||||
case 49: x = x >> 49; break;
|
||||
case 50: x = x >> 50; break;
|
||||
case 51: x = x >> 51; break;
|
||||
case 52: x = x >> 52; break;
|
||||
case 53: x = x >> 53; break;
|
||||
case 54: x = x >> 54; break;
|
||||
case 55: x = x >> 55; break;
|
||||
case 56: x = x >> 56; break;
|
||||
case 57: x = x >> 57; break;
|
||||
case 58: x = x >> 58; break;
|
||||
case 59: x = x >> 59; break;
|
||||
case 60: x = x >> 60; break;
|
||||
case 61: x = x >> 61; break;
|
||||
case 62: x = x >> 62; break;
|
||||
case 63: x = x >> 63; break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < BITS; ++i)
|
||||
{
|
||||
long long y = variable_shift (zext[0], i);
|
||||
if (y != zext[i])
|
||||
abort ();
|
||||
}
|
||||
for (i = 0; i < BITS; ++i)
|
||||
{
|
||||
long long y = variable_shift (sext[0], i);
|
||||
if (y != sext[i])
|
||||
abort ();
|
||||
}
|
||||
for (i = 0; i < BITS; ++i)
|
||||
{
|
||||
long long y = constant_shift (zext[0], i);
|
||||
if (y != zext[i])
|
||||
abort ();
|
||||
}
|
||||
for (i = 0; i < BITS; ++i)
|
||||
{
|
||||
long long y = constant_shift (sext[0], i);
|
||||
if (y != sext[i])
|
||||
abort ();
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
221
gcc/testsuite/gcc.c-torture/execute/lshrdi-1.c
Normal file
221
gcc/testsuite/gcc.c-torture/execute/lshrdi-1.c
Normal file
@ -0,0 +1,221 @@
|
||||
#include <limits.h>
|
||||
|
||||
extern void abort(void);
|
||||
extern void exit(int);
|
||||
|
||||
#if __LONG_LONG_MAX__ == 9223372036854775807LL
|
||||
#define BITS 64
|
||||
|
||||
static unsigned long long const zext[64] = {
|
||||
0x87654321fedcba90ULL,
|
||||
0x43b2a190ff6e5d48ULL,
|
||||
0x21d950c87fb72ea4ULL,
|
||||
0x10eca8643fdb9752ULL,
|
||||
0x87654321fedcba9ULL,
|
||||
0x43b2a190ff6e5d4ULL,
|
||||
0x21d950c87fb72eaULL,
|
||||
0x10eca8643fdb975ULL,
|
||||
0x87654321fedcbaULL,
|
||||
0x43b2a190ff6e5dULL,
|
||||
0x21d950c87fb72eULL,
|
||||
0x10eca8643fdb97ULL,
|
||||
0x87654321fedcbULL,
|
||||
0x43b2a190ff6e5ULL,
|
||||
0x21d950c87fb72ULL,
|
||||
0x10eca8643fdb9ULL,
|
||||
0x87654321fedcULL,
|
||||
0x43b2a190ff6eULL,
|
||||
0x21d950c87fb7ULL,
|
||||
0x10eca8643fdbULL,
|
||||
0x87654321fedULL,
|
||||
0x43b2a190ff6ULL,
|
||||
0x21d950c87fbULL,
|
||||
0x10eca8643fdULL,
|
||||
0x87654321feULL,
|
||||
0x43b2a190ffULL,
|
||||
0x21d950c87fULL,
|
||||
0x10eca8643fULL,
|
||||
0x87654321fULL,
|
||||
0x43b2a190fULL,
|
||||
0x21d950c87ULL,
|
||||
0x10eca8643ULL,
|
||||
0x87654321ULL,
|
||||
0x43b2a190ULL,
|
||||
0x21d950c8ULL,
|
||||
0x10eca864ULL,
|
||||
0x8765432ULL,
|
||||
0x43b2a19ULL,
|
||||
0x21d950cULL,
|
||||
0x10eca86ULL,
|
||||
0x876543ULL,
|
||||
0x43b2a1ULL,
|
||||
0x21d950ULL,
|
||||
0x10eca8ULL,
|
||||
0x87654ULL,
|
||||
0x43b2aULL,
|
||||
0x21d95ULL,
|
||||
0x10ecaULL,
|
||||
0x8765ULL,
|
||||
0x43b2ULL,
|
||||
0x21d9ULL,
|
||||
0x10ecULL,
|
||||
0x876ULL,
|
||||
0x43bULL,
|
||||
0x21dULL,
|
||||
0x10eULL,
|
||||
0x87ULL,
|
||||
0x43ULL,
|
||||
0x21ULL,
|
||||
0x10ULL,
|
||||
0x8ULL,
|
||||
0x4ULL,
|
||||
0x2ULL,
|
||||
0x1ULL
|
||||
};
|
||||
|
||||
#elif __LONG_LONG_MAX__ == 2147483647LL
|
||||
#define BITS 32
|
||||
|
||||
static unsigned long long const zext[32] = {
|
||||
0x87654321ULL,
|
||||
0x43b2a190ULL,
|
||||
0x21d950c8ULL,
|
||||
0x10eca864ULL,
|
||||
0x8765432ULL,
|
||||
0x43b2a19ULL,
|
||||
0x21d950cULL,
|
||||
0x10eca86ULL,
|
||||
0x876543ULL,
|
||||
0x43b2a1ULL,
|
||||
0x21d950ULL,
|
||||
0x10eca8ULL,
|
||||
0x87654ULL,
|
||||
0x43b2aULL,
|
||||
0x21d95ULL,
|
||||
0x10ecaULL,
|
||||
0x8765ULL,
|
||||
0x43b2ULL,
|
||||
0x21d9ULL,
|
||||
0x10ecULL,
|
||||
0x876ULL,
|
||||
0x43bULL,
|
||||
0x21dULL,
|
||||
0x10eULL,
|
||||
0x87ULL,
|
||||
0x43ULL,
|
||||
0x21ULL,
|
||||
0x10ULL,
|
||||
0x8ULL,
|
||||
0x4ULL,
|
||||
0x2ULL,
|
||||
0x1ULL,
|
||||
};
|
||||
|
||||
#else
|
||||
#error "Update the test case."
|
||||
#endif
|
||||
|
||||
static unsigned long long
|
||||
variable_shift(unsigned long long x, int i)
|
||||
{
|
||||
return x >> i;
|
||||
}
|
||||
|
||||
static unsigned long long
|
||||
constant_shift(unsigned long long x, int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: x = x >> 0; break;
|
||||
case 1: x = x >> 1; break;
|
||||
case 2: x = x >> 2; break;
|
||||
case 3: x = x >> 3; break;
|
||||
case 4: x = x >> 4; break;
|
||||
case 5: x = x >> 5; break;
|
||||
case 6: x = x >> 6; break;
|
||||
case 7: x = x >> 7; break;
|
||||
case 8: x = x >> 8; break;
|
||||
case 9: x = x >> 9; break;
|
||||
case 10: x = x >> 10; break;
|
||||
case 11: x = x >> 11; break;
|
||||
case 12: x = x >> 12; break;
|
||||
case 13: x = x >> 13; break;
|
||||
case 14: x = x >> 14; break;
|
||||
case 15: x = x >> 15; break;
|
||||
case 16: x = x >> 16; break;
|
||||
case 17: x = x >> 17; break;
|
||||
case 18: x = x >> 18; break;
|
||||
case 19: x = x >> 19; break;
|
||||
case 20: x = x >> 20; break;
|
||||
case 21: x = x >> 21; break;
|
||||
case 22: x = x >> 22; break;
|
||||
case 23: x = x >> 23; break;
|
||||
case 24: x = x >> 24; break;
|
||||
case 25: x = x >> 25; break;
|
||||
case 26: x = x >> 26; break;
|
||||
case 27: x = x >> 27; break;
|
||||
case 28: x = x >> 28; break;
|
||||
case 29: x = x >> 29; break;
|
||||
case 30: x = x >> 30; break;
|
||||
case 31: x = x >> 31; break;
|
||||
#if BITS > 32
|
||||
case 32: x = x >> 32; break;
|
||||
case 33: x = x >> 33; break;
|
||||
case 34: x = x >> 34; break;
|
||||
case 35: x = x >> 35; break;
|
||||
case 36: x = x >> 36; break;
|
||||
case 37: x = x >> 37; break;
|
||||
case 38: x = x >> 38; break;
|
||||
case 39: x = x >> 39; break;
|
||||
case 40: x = x >> 40; break;
|
||||
case 41: x = x >> 41; break;
|
||||
case 42: x = x >> 42; break;
|
||||
case 43: x = x >> 43; break;
|
||||
case 44: x = x >> 44; break;
|
||||
case 45: x = x >> 45; break;
|
||||
case 46: x = x >> 46; break;
|
||||
case 47: x = x >> 47; break;
|
||||
case 48: x = x >> 48; break;
|
||||
case 49: x = x >> 49; break;
|
||||
case 50: x = x >> 50; break;
|
||||
case 51: x = x >> 51; break;
|
||||
case 52: x = x >> 52; break;
|
||||
case 53: x = x >> 53; break;
|
||||
case 54: x = x >> 54; break;
|
||||
case 55: x = x >> 55; break;
|
||||
case 56: x = x >> 56; break;
|
||||
case 57: x = x >> 57; break;
|
||||
case 58: x = x >> 58; break;
|
||||
case 59: x = x >> 59; break;
|
||||
case 60: x = x >> 60; break;
|
||||
case 61: x = x >> 61; break;
|
||||
case 62: x = x >> 62; break;
|
||||
case 63: x = x >> 63; break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < BITS; ++i)
|
||||
{
|
||||
unsigned long long y = variable_shift (zext[0], i);
|
||||
if (y != zext[i])
|
||||
abort ();
|
||||
}
|
||||
for (i = 0; i < BITS; ++i)
|
||||
{
|
||||
unsigned long long y = constant_shift (zext[0], i);
|
||||
if (y != zext[i])
|
||||
abort ();
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user