This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] builtin-bitops-1.x: Disable on H8.
Hi Richard,
> Er, do you not support a 32-bit long long? Or do you leave long
> long set for 64-bit and just hork?
What about something like the patch below? This patch along with
http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00592.html
settles all the issues with bitops on H8.
Tested on h8300 port.
Kazu Hirata
2003-02-08 Kazu Hirata <kazu@cs.umass.edu>
* gcc.c-torture/execute/builtin-bitops-1.c: If int is 16-bit
wide, test bitops using 16-bit constants.
Likewise, if long long is 32-bit wide, test bitops using
32-bit constants.
Index: builtin-bitops-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.c-torture/execute/builtin-bitops-1.c,v
retrieving revision 1.1
diff -c -r1.1 builtin-bitops-1.c
*** builtin-bitops-1.c 1 Feb 2003 19:00:02 -0000 1.1
--- builtin-bitops-1.c 8 Feb 2003 13:32:44 -0000
***************
*** 1,6 ****
--- 1,22 ----
#include <limits.h>
#include <assert.h>
+ #if __INT_MAX__ >= 2147483647L
+ #define TARGET_INT32 1
+ #else
+ #define TARGET_INT32 0
+ #endif
+
+ #if __LONG_MAX__ > 2147483647L
+ #if __LONG_MAX__ >= 9223372036854775807L
+ #define TARGET_64BIT 1
+ #else
+ #define TARGET_64BIT 0
+ #endif
+ #else
+ #define TARGET_64BIT 0
+ #endif
+
#define MAKE_FUNS(suffix, type) \
int my_ffs##suffix(type x) { \
int i; \
***************
*** 53,73 ****
extern void abort (void);
extern void exit (int);
#define NUMS32 \
{ \
! 0x00000000U, \
! 0x00000001U, \
! 0x80000000U, \
! 0x00000002U, \
! 0x40000000U, \
! 0x00010000U, \
! 0x00008000U, \
! 0xa5a5a5a5U, \
! 0x5a5a5a5aU, \
! 0xcafe0000U, \
! 0x00cafe00U, \
! 0x0000cafeU, \
! 0xffffffffU \
}
#define NUMS64 \
--- 69,104 ----
extern void abort (void);
extern void exit (int);
+ #define NUMS16 \
+ { \
+ 0x0000U, \
+ 0x0001U, \
+ 0x8000U, \
+ 0x0002U, \
+ 0x4000U, \
+ 0x0100U, \
+ 0x0080U, \
+ 0xa5a5U, \
+ 0x5a5aU, \
+ 0xcafeU, \
+ 0xffffU \
+ }
+
#define NUMS32 \
{ \
! 0x00000000UL, \
! 0x00000001UL, \
! 0x80000000UL, \
! 0x00000002UL, \
! 0x40000000UL, \
! 0x00010000UL, \
! 0x00008000UL, \
! 0xa5a5a5a5UL, \
! 0x5a5a5a5aUL, \
! 0xcafe0000UL, \
! 0x00cafe00UL, \
! 0x0000cafeUL, \
! 0xffffffffUL \
}
#define NUMS64 \
***************
*** 87,102 ****
0xffffffffffffffffULL \
}
! unsigned int ints[] = NUMS32;
unsigned long longs[] =
! #if __LONG_MAX__ >= 9223372036854775807L
NUMS64;
#else
NUMS32;
#endif
! unsigned long long longlongs[] = NUMS64;
#define N(table) (sizeof (table) / sizeof (table[0]))
--- 118,143 ----
0xffffffffffffffffULL \
}
! unsigned int ints[] =
! #if TARGET_INT32
! NUMS32;
! #else
! NUMS16;
! #endif
unsigned long longs[] =
! #if TARGET_64BIT
NUMS64;
#else
NUMS32;
#endif
! unsigned long long longlongs[] =
! #if TARGET_64BIT
! NUMS64;
! #else
! NUMS32;
! #endif
#define N(table) (sizeof (table) / sizeof (table[0]))
***************
*** 167,172 ****
--- 208,214 ----
if (__builtin_parity##suffix (x) != my_parity##suffix (x)) \
abort ();
+ #if TARGET_INT32
TEST(0x00000000UL,);
TEST(0x00000001UL,);
TEST(0x80000000UL,);
***************
*** 179,185 ****
--- 221,229 ----
TEST(0x00cafe00UL,);
TEST(0x0000cafeUL,);
TEST(0xffffffffUL,);
+ #endif
+ #if TARGET_64BIT
TEST(0x0000000000000000ULL, ll);
TEST(0x0000000000000001ULL, ll);
TEST(0x8000000000000000ULL, ll);
***************
*** 193,198 ****
--- 237,243 ----
TEST(0x0000cafecafe0000ULL, ll);
TEST(0x00000000cafecafeULL, ll);
TEST(0xffffffffffffffffULL, ll);
+ #endif
exit (0);
}