From fe435e3dd4d03524a5387cd7e872350a314c3d92 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 23 Mar 2015 14:50:39 -0500 Subject: [svn-r26543] Description: Remove the LLONG_TO_LDOUBLE_CORRECT macro/define, it's working around bugs in very old SGI/FreeBSD/Windows compilers. Tested on: MacOSX/64 10.10.2 (amazon) w/serial & parallel (h5committest not needed on this branch) --- config/cmake/ConfigureChecks.cmake | 8 ----- config/cmake/ConversionTests.c | 43 ------------------------- config/cmake/H5pubconf.h.in | 4 --- configure.ac | 65 -------------------------------------- src/H5T.c | 4 --- src/H5Tconv.c | 4 --- src/H5Tpkg.h | 15 --------- test/dt_arith.c | 24 -------------- 8 files changed, 167 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 0aa4f1c..0b0d878 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -271,14 +271,6 @@ H5ConversionTests (H5_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts # H5ConversionTests (H5_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can convert (unsigned) long to long double values with special algorithm") # ---------------------------------------------------------------------- -# Set the flag to indicate that the machine can accurately convert -# '(unsigned) long long' to 'long double' values. (This flag should be set for -# all machines, except for Mac OS 10.4, when the bit sequences are 003fff..., -# 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice -# as big as they should be. -# -H5ConversionTests (H5_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values") -# ---------------------------------------------------------------------- # Set the flag to indicate that the machine generates bad code # for the H5VM_log2_gen() routine in src/H5VMprivate.h # (This flag should be set to no for all machines, except for SGI IRIX64, diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index beba01d..cd2e8bb 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -116,49 +116,6 @@ done: #endif -#ifdef H5_LLONG_TO_LDOUBLE_CORRECT_TEST -int main(void) -{ - long double ld; - long long ll; - unsigned long long ull; - unsigned char s[16]; - int flag=0, ret=0; - - /*Determine if long double has 16 byte in size, 11 bit exponent, and - *the bias is 0x3ff */ - if(sizeof(long double) == 16) { - ld = 1.0L; - memcpy(s, &ld, 16); - if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) - flag = 1; - } - - if(flag==1 && sizeof(long long)==8) { - ll = 0x01ffffffffffffffLL; - ld = (long double)ll; - memcpy(s, &ld, 16); - /*Check if the bit sequence is as supposed to be*/ - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || - s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || - s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) - ret = 1; - } - if(flag==1 && sizeof(unsigned long long)==8) { - ull = 0x01ffffffffffffffULL; - ld = (long double)ull; - memcpy(s, &ld, 16); - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || - s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || - s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) - ret = 1; - } -done: - exit(ret); -} -#endif - #ifdef H5_NO_ALIGNMENT_RESTRICTIONS_TEST #include diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index aee2f2e..84fe073 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -440,10 +440,6 @@ special algorithm. */ #cmakedefine H5_LDOUBLE_TO_LONG_SPECIAL @H5_LDOUBLE_TO_LONG_SPECIAL@ -/* Define if your system can convert (unsigned) long long to long double - values correctly. */ -#cmakedefine H5_LLONG_TO_LDOUBLE_CORRECT @H5_LLONG_TO_LDOUBLE_CORRECT@ - /* Define if your system can convert (unsigned) long to long double values with special algorithm. */ #cmakedefine H5_LONG_TO_LDOUBLE_SPECIAL @H5_LONG_TO_LDOUBLE_SPECIAL@ diff --git a/configure.ac b/configure.ac index 51e8158..1069b60 100644 --- a/configure.ac +++ b/configure.ac @@ -2570,71 +2570,6 @@ else fi ## ---------------------------------------------------------------------- -## Set the flag to indicate that the machine can accurately convert -## '(unsigned) long long' to 'long double' values. (This flag should be set for -## all machines, except for Mac OS 10.4, when the bit sequences are 003fff..., -## 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice -## as big as they should be. -## -AC_MSG_CHECKING([if correctly converting (unsigned) long long to long double values]) - -if test ${ac_cv_sizeof_long_double} = 0; then - hdf5_cv_llong_to_ldouble_correct=${hdf5_cv_llong_to_ldouble_correct=no} -else - AC_CACHE_VAL([hdf5_cv_llong_to_ldouble_correct], - [AC_TRY_RUN([ - int main(void) - { - long double ld; - long long ll; - unsigned long long ull; - unsigned char s[16]; - int flag=0, ret=0; - - /*Determine if long double has 16 byte in size, 11 bit exponent, and - *the bias is 0x3ff */ - if(sizeof(long double) == 16) { - ld = 1.0L; - memcpy(s, &ld, 16); - if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) - flag = 1; - } - - if(flag==1 && sizeof(long long)==8) { - ll = 0x01ffffffffffffffLL; - ld = (long double)ll; - memcpy(s, &ld, 16); - /*Check if the bit sequence is as supposed to be*/ - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || - s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || - s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) - ret = 1; - } - if(flag==1 && sizeof(unsigned long long)==8) { - ull = 0x01ffffffffffffffULL; - ld = (long double)ull; - memcpy(s, &ld, 16); - if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || - s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || - s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) - ret = 1; - } - done: - exit(ret); - } - ], [hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],)]) -fi - -if test ${hdf5_cv_llong_to_ldouble_correct} = "yes"; then - AC_DEFINE([LLONG_TO_LDOUBLE_CORRECT], [1], - [Define if your system can convert (unsigned) long long to long double values correctly.]) - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi - -## ---------------------------------------------------------------------- ## Set the flag to indicate that the machine generates bad code ## for the H5VM_log2_gen() routine in src/H5VMprivate.h ## (This flag should be set to no for all machines, except for SGI IRIX64, diff --git a/src/H5T.c b/src/H5T.c index 4e87f4f..f2329cb 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1225,16 +1225,12 @@ H5T_init_interface(void) /* From long long to floats */ status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_dxpl_id, FALSE); -#ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_dxpl_id, FALSE); -#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ /* From unsigned long long to floats */ status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_dxpl_id, FALSE); -#ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_dxpl_id, FALSE); -#endif /* H5T_CONV_INTERNAL_ULLONG_LDOUBLE */ /* From floats to char */ status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_dxpl_id, FALSE); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index b074932..df85553 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -7901,7 +7901,6 @@ H5T__conv_llong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_LLONG_LDOUBLE herr_t H5T__conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, @@ -7910,7 +7909,6 @@ H5T__conv_llong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { H5T_CONV_xF(LLONG, LDOUBLE, long long, long double, -, -); } -#endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ /*------------------------------------------------------------------------- @@ -7978,7 +7976,6 @@ H5T__conv_ullong_double (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * *------------------------------------------------------------------------- */ -#if H5T_CONV_INTERNAL_ULLONG_LDOUBLE herr_t H5T__conv_ullong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, @@ -7987,7 +7984,6 @@ H5T__conv_ullong_ldouble (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, { H5T_CONV_xF(ULLONG, LDOUBLE, unsigned long long, long double, -, -); } -#endif /*H5T_CONV_INTERNAL_ULLONG_LDOUBLE*/ /*------------------------------------------------------------------------- diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index e27d2c8..4697bfc 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -111,21 +111,6 @@ /* (_not_ setting H5T_VISIT_SIMPLE and setting either H5T_VISIT_COMPLEX_FIRST or H5T_VISIT_COMPLEX_LAST will mean visiting all nodes _except_ "simple" "leafs" in the "tree" */ -/* Define an internal macro for converting long long to long double. Mac OS 10.4 gives some - * incorrect conversions. */ -#if (H5_WANT_DATA_ACCURACY && defined(H5_LLONG_TO_LDOUBLE_CORRECT)) || (!H5_WANT_DATA_ACCURACY) -#define H5T_CONV_INTERNAL_LLONG_LDOUBLE 1 -#endif - -/* Define an internal macro for converting unsigned long long to long double. SGI compilers give - * some incorect conversion. 64-bit Solaris does different rounding. Windows Visual Studio 6 does - * not support unsigned long long. For FreeBSD(sleipnir), the last 2 bytes of mantissa are lost when - * compiler tries to do the conversion. For Cygwin, compiler doesn't do rounding correctly. - * Mac OS 10.4 gives some incorrect result. */ -#if (H5_WANT_DATA_ACCURACY && defined(H5_LLONG_TO_LDOUBLE_CORRECT)) || (!H5_WANT_DATA_ACCURACY) -#define H5T_CONV_INTERNAL_ULLONG_LDOUBLE 1 -#endif - /* Statistics about a conversion function */ struct H5T_stats_t { unsigned ncalls; /*num calls to conversion function */ diff --git a/test/dt_arith.c b/test/dt_arith.c index c8db431..5848864 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -5032,32 +5032,8 @@ run_int_fp_conv(const char *name) #endif #endif /* H5_SIZEOF_LONG!=H5_SIZEOF_INT */ #if H5_SIZEOF_LONG_LONG!=H5_SIZEOF_LONG -#if H5_LLONG_TO_LDOUBLE_CORRECT nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE); -#else /* H5_LLONG_TO_LDOUBLE_CORRECT */ - { - char str[256]; /*hello string */ - - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, "long long", "long double"); - printf("%-70s", str); - SKIPPED(); - HDputs(" Test skipped due to compiler error in handling conversion."); - } -#endif /* H5_LLONG_TO_LDOUBLE_CORRECT */ -#if H5_LLONG_TO_LDOUBLE_CORRECT nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE); -#else /* H5_LLONG_TO_LDOUBLE_CORRECT */ - { - char str[256]; /*hello string */ - - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, "unsigned long long", "long double"); - printf("%-70s", str); - SKIPPED(); - HDputs(" Test skipped due to compiler not handling conversion."); - } -#endif /* H5_LLONG_TO_LDOUBLE_CORRECT */ #endif #endif -- cgit v0.12