Commit 35987ae9 by Richard Biener Committed by Richard Biener

configure.ac: Check whether the underlying type of int64_t is long or long long.

2014-06-04  Richard Biener  <rguenther@suse.de>

	* configure.ac: Check whether the underlying type of int64_t
	is long or long long.
	* configure: Regenerate.
	* config.in: Likewise.
	* hwint.h (HOST_WIDE_INT): Match the underlying type of int64_t.
	(HOST_WIDE_INT_PRINT_*): Define in terms of PRI*64.

From-SVN: r211228
parent 0ea48022
2014-06-04 Richard Biener <rguenther@suse.de> 2014-06-04 Richard Biener <rguenther@suse.de>
* configure.ac: Check whether the underlying type of int64_t
is long or long long.
* configure: Regenerate.
* config.in: Likewise.
* hwint.h (HOST_WIDE_INT): Match the underlying type of int64_t.
(HOST_WIDE_INT_PRINT_*): Define in terms of PRI*64.
2014-06-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/60098 PR tree-optimization/60098
* tree-ssa-dse.c (dse_possible_dead_store_p): Walk until * tree-ssa-dse.c (dse_possible_dead_store_p): Walk until
we hit a kill. we hit a kill.
......
...@@ -1680,6 +1680,12 @@ ...@@ -1680,6 +1680,12 @@
#endif #endif
/* Define if int64_t uses long as underlying type. */
#ifndef USED_FOR_TARGET
#undef INT64_T_IS_LONG
#endif
/* Define to the linker option to ignore unused dependencies. */ /* Define to the linker option to ignore unused dependencies. */
#ifndef USED_FOR_TARGET #ifndef USED_FOR_TARGET
#undef LD_AS_NEEDED_OPTION #undef LD_AS_NEEDED_OPTION
......
...@@ -6230,6 +6230,87 @@ if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then ...@@ -6230,6 +6230,87 @@ if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then
as_fn_error "uint64_t or int64_t not found" "$LINENO" 5 as_fn_error "uint64_t or int64_t not found" "$LINENO" 5
fi fi
# check what underlying integer type int64_t uses
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for int64_t underlying type" >&5
$as_echo_n "checking for int64_t underlying type... " >&6; }
if test "${ac_cv_int64_t_type+set}" = set; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
template <typename T> struct X { };
template <>
struct X<long> { typedef long t; };
int
main ()
{
X<int64_t>::t x;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_int64_t_type=long
else
ac_cv_int64_t_type="long long"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_int64_t_type" >&5
$as_echo "$ac_cv_int64_t_type" >&6; }
if test "$ac_cv_int64_t_type" = "long"; then
$as_echo "#define INT64_T_IS_LONG 1" >>confdefs.h
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
template <typename T> struct X { };
template <>
struct X<long long> { typedef long long t; };
int
main ()
{
X<int64_t>::t x;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
else
as_fn_error "error verifying int64_t uses long long" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
# --------------------- # ---------------------
# Warnings and checking # Warnings and checking
# --------------------- # ---------------------
...@@ -8746,7 +8827,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ...@@ -8746,7 +8827,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
for ac_header in unordered_map for ac_header in unordered_map
do : do :
ac_fn_cxx_check_header_preproc "$LINENO" "unordered_map" "ac_cv_header_unordered_map" ac_fn_cxx_check_header_preproc "$LINENO" "unordered_map" "ac_cv_header_unordered_map"
...@@ -9163,7 +9243,8 @@ LIBS="$save_LIBS" ...@@ -9163,7 +9243,8 @@ LIBS="$save_LIBS"
# Use <inttypes.h> only if it exists, # Use <inttypes.h> only if it exists,
# doesn't clash with <sys/types.h>, and declares intmax_t. # doesn't clash with <sys/types.h>, declares intmax_t and defines
# PRId64
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inttypes.h" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inttypes.h" >&5
$as_echo_n "checking for inttypes.h... " >&6; } $as_echo_n "checking for inttypes.h... " >&6; }
if test "${gcc_cv_header_inttypes_h+set}" = set; then : if test "${gcc_cv_header_inttypes_h+set}" = set; then :
...@@ -9171,12 +9252,16 @@ if test "${gcc_cv_header_inttypes_h+set}" = set; then : ...@@ -9171,12 +9252,16 @@ if test "${gcc_cv_header_inttypes_h+set}" = set; then :
else else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#define __STDC_FORMAT_MACROS
#include <sys/types.h> #include <sys/types.h>
#include <inttypes.h> #include <inttypes.h>
int int
main () main ()
{ {
intmax_t i = -1; intmax_t i = -1;
#ifndef PRId64
choke me
#endif
; ;
return 0; return 0;
} }
...@@ -17948,7 +18033,7 @@ else ...@@ -17948,7 +18033,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 17951 "configure" #line 18036 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -18054,7 +18139,7 @@ else ...@@ -18054,7 +18139,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 18057 "configure" #line 18142 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
......
...@@ -316,6 +316,35 @@ if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then ...@@ -316,6 +316,35 @@ if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then
AC_MSG_ERROR([uint64_t or int64_t not found]) AC_MSG_ERROR([uint64_t or int64_t not found])
fi fi
# check what underlying integer type int64_t uses
AC_LANG_PUSH(C++)
AC_CACHE_CHECK(for int64_t underlying type, ac_cv_int64_t_type, [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
template <typename T> struct X { };
template <>
struct X<long> { typedef long t; };
]], [[X<int64_t>::t x;]])],[ac_cv_int64_t_type=long],[ac_cv_int64_t_type="long long"])])
if test "$ac_cv_int64_t_type" = "long"; then
AC_DEFINE(INT64_T_IS_LONG, 1,
[Define if int64_t uses long as underlying type.])
else
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
template <typename T> struct X { };
template <>
struct X<long long> { typedef long long t; };
]], [[X<int64_t>::t x;]])],[],[AC_MSG_ERROR([error verifying int64_t uses long long])])
fi
AC_LANG_POP(C++)
# --------------------- # ---------------------
# Warnings and checking # Warnings and checking
# --------------------- # ---------------------
...@@ -1055,13 +1084,18 @@ LIBS="$save_LIBS" ...@@ -1055,13 +1084,18 @@ LIBS="$save_LIBS"
AC_SUBST(LDEXP_LIB) AC_SUBST(LDEXP_LIB)
# Use <inttypes.h> only if it exists, # Use <inttypes.h> only if it exists,
# doesn't clash with <sys/types.h>, and declares intmax_t. # doesn't clash with <sys/types.h>, declares intmax_t and defines
# PRId64
AC_MSG_CHECKING(for inttypes.h) AC_MSG_CHECKING(for inttypes.h)
AC_CACHE_VAL(gcc_cv_header_inttypes_h, AC_CACHE_VAL(gcc_cv_header_inttypes_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <sys/types.h> [[#define __STDC_FORMAT_MACROS
#include <sys/types.h>
#include <inttypes.h>]], #include <inttypes.h>]],
[[intmax_t i = -1;]])], [[intmax_t i = -1;
#ifndef PRId64
choke me
#endif]])],
[gcc_cv_header_inttypes_h=yes], [gcc_cv_header_inttypes_h=yes],
[gcc_cv_header_inttypes_h=no])]) [gcc_cv_header_inttypes_h=no])])
AC_MSG_RESULT($gcc_cv_header_inttypes_h) AC_MSG_RESULT($gcc_cv_header_inttypes_h)
......
...@@ -46,13 +46,11 @@ extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1]; ...@@ -46,13 +46,11 @@ extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1];
#endif #endif
/* Set HOST_WIDE_INT, this should be always 64 bits. /* Set HOST_WIDE_INT, this should be always 64 bits.
The underlying type is matched to that of int64_t and assumed
With a sane ABI, 'long' is the largest efficient host integer type. to be either long or long long. */
Thus, we use that unless we have to use 'long long'
because we're on a 32-bit host. */
#define HOST_BITS_PER_WIDE_INT 64 #define HOST_BITS_PER_WIDE_INT 64
#if HOST_BITS_PER_LONG == 64 #if INT64_T_IS_LONG
# define HOST_WIDE_INT long # define HOST_WIDE_INT long
# define HOST_WIDE_INT_C(X) X ## L # define HOST_WIDE_INT_C(X) X ## L
#else #else
...@@ -75,48 +73,45 @@ extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1]; ...@@ -75,48 +73,45 @@ extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1];
typedef before using the __asm_fprintf__ format attribute. */ typedef before using the __asm_fprintf__ format attribute. */
typedef HOST_WIDE_INT __gcc_host_wide_int__; typedef HOST_WIDE_INT __gcc_host_wide_int__;
/* Various printf format strings for HOST_WIDE_INT. */
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
# define HOST_WIDE_INT_PRINT HOST_LONG_FORMAT
# define HOST_WIDE_INT_PRINT_C "L"
/* HOST_BITS_PER_WIDE_INT is 64 bits. */
# define HOST_WIDE_INT_PRINT_DOUBLE_HEX \
"0x%" HOST_LONG_FORMAT "x%016" HOST_LONG_FORMAT "x"
# define HOST_WIDE_INT_PRINT_PADDED_HEX \
"%016" HOST_LONG_FORMAT "x"
#else
# define HOST_WIDE_INT_PRINT HOST_LONG_LONG_FORMAT
# define HOST_WIDE_INT_PRINT_C "LL"
/* HOST_BITS_PER_WIDE_INT is 64 bits. */
# define HOST_WIDE_INT_PRINT_DOUBLE_HEX \
"0x%" HOST_LONG_LONG_FORMAT "x%016" HOST_LONG_LONG_FORMAT "x"
# define HOST_WIDE_INT_PRINT_PADDED_HEX \
"%016" HOST_LONG_LONG_FORMAT "x"
#endif /* HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG */
#define HOST_WIDE_INT_PRINT_DEC "%" HOST_WIDE_INT_PRINT "d"
#define HOST_WIDE_INT_PRINT_DEC_C HOST_WIDE_INT_PRINT_DEC HOST_WIDE_INT_PRINT_C
#define HOST_WIDE_INT_PRINT_UNSIGNED "%" HOST_WIDE_INT_PRINT "u"
#define HOST_WIDE_INT_PRINT_HEX "%#" HOST_WIDE_INT_PRINT "x"
#define HOST_WIDE_INT_PRINT_HEX_PURE "%" HOST_WIDE_INT_PRINT "x"
/* Provide C99 <inttypes.h> style format definitions for 64bits. */ /* Provide C99 <inttypes.h> style format definitions for 64bits. */
#ifndef HAVE_INTTYPES_H #ifndef HAVE_INTTYPES_H
#if INT64_T_IS_LONG
# define GCC_PRI64 HOST_LONG_FORMAT
#else
# define GCC_PRI64 HOST_LONG_LONG_FORMAT
#endif
#undef PRId64 #undef PRId64
#define PRId64 HOST_WIDE_INT_PRINT "d" #define PRId64 GCC_PRI64 "d"
#undef PRIi64 #undef PRIi64
#define PRIi64 HOST_WIDE_INT_PRINT "i" #define PRIi64 GCC_PRI64 "i"
#undef PRIo64 #undef PRIo64
#define PRIo64 HOST_WIDE_INT_PRINT "o" #define PRIo64 GCC_PRI64 "o"
#undef PRIu64 #undef PRIu64
#define PRIu64 HOST_WIDE_INT_PRINT "u" #define PRIu64 GCC_PRI64 "u"
#undef PRIx64 #undef PRIx64
#define PRIx64 HOST_WIDE_INT_PRINT "x" #define PRIx64 GCC_PRI64 "x"
#undef PRIX64 #undef PRIX64
#define PRIX64 HOST_WIDE_INT_PRINT "X" #define PRIX64 GCC_PRI64 "X"
#endif #endif
/* Various printf format strings for HOST_WIDE_INT. */
#if INT64_T_IS_LONG
# define HOST_WIDE_INT_PRINT HOST_LONG_FORMAT
# define HOST_WIDE_INT_PRINT_C "L"
#else
# define HOST_WIDE_INT_PRINT HOST_LONG_LONG_FORMAT
# define HOST_WIDE_INT_PRINT_C "LL"
#endif
#define HOST_WIDE_INT_PRINT_DEC "%" PRId64
#define HOST_WIDE_INT_PRINT_DEC_C "%" PRId64 HOST_WIDE_INT_PRINT_C
#define HOST_WIDE_INT_PRINT_UNSIGNED "%" PRIu64
#define HOST_WIDE_INT_PRINT_HEX "%#" PRIx64
#define HOST_WIDE_INT_PRINT_HEX_PURE "%" PRIx64
#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%" PRIx64 "%016" PRIx64
#define HOST_WIDE_INT_PRINT_PADDED_HEX "%016" PRIx64
/* Define HOST_WIDEST_FAST_INT to the widest integer type supported /* Define HOST_WIDEST_FAST_INT to the widest integer type supported
efficiently in hardware. (That is, the widest integer type that fits efficiently in hardware. (That is, the widest integer type that fits
in a hardware register.) Normally this is "long" but on some hosts it in a hardware register.) Normally this is "long" but on some hosts it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment