This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libstdc++v3] target-specific cpu_limits.h for mingw32 -Take 2.


 Attached patch puts mingw32-specific cpu_limits.h file in
config/os/mingw32, over-riding the the default i386 version.

The handling of qNaN, sNaN, Inf and denorm_min is based on that in the
STLPort library.  I have left out long double support for now, since
mingw's C run-time math library treats long doubles as doubles anyway, and
the FPU is set to 64-bits precision at CRT startup.

I have put the helper class __iec559_consts in global namespace.
Perhaps they should be in namespace std. 

Tested on i586-pc-mingw32, with GCC 3.2 bootstrapped as: 

Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as
--host=mingw32 --target=mingw32 --prefix=/mingw --enable-sjlj-exceptions
--enable-threads --disable-nls --enable-languages=f77,c++
--disable-win32-registry --disable-shared
Thread model: win32
gcc version 3.2 20020401 (experimental).

Diff and new file attached.  

OK for mainline?  If not, what needs to be fixed?

Danny

ChangeLog

2002-04-3  Danny Smith  <dannysmith@users.sourceforge.net>

	* libstdc++-v3/configure.target (CPULIMITSH): Set to
	config/os/mingw32 for i?86-*-mingw32*.
	* libstdc++-v3/config/os/mingw32/bits/cpu_limits.h:
	New file.




http://www.sold.com.au - SOLD.com.au Auctions
- 1,000s of Bargains!
Index: gcc/libstdc++-v3/configure.target
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/configure.target,v
retrieving revision 1.38
diff -u -p -r1.38 configure.target
--- configure.target	2002/01/17 16:14:08	1.38
+++ configure.target	2002/04/02 21:27:24
@@ -154,6 +154,9 @@ case "${target}" in
    ia64-*-*)
      CPULIMITSH=config/cpu/ia64
      ;;
+   i?86-*-mingw32*)
+     CPULIMITSH=config/os/mingw32
+     ;;
    i?86-*-*)
      CPULIMITSH=config/cpu/i386
      ;;

// Copyright (C) 2001 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING.  If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.

// As a special exception, you may use this file as part of a free software
// library without restriction.  Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License.  This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

#ifndef _GLIBCPP_CPU_LIMITS
#define _GLIBCPP_CPU_LIMITS 1

// At CRT startup the FPU is set to 64-bit (53 bit-mantissa) precision
#define __glibcpp_long_double_bits 64

// These constants are selected to be consistent with native
// (msvcrt.dll) stdio representation of NaNs: 	

#define __FLOAT_INF_REP { 0, 0x7f80 }
#define __FLOAT_QNAN_REP { 0, 0xffc0 }  // { 0, 0x7fc0 }
#define __FLOAT_SNAN_REP { 0, 0xff80 }  // { 1, 0x7f80 }
#define __FLOAT_DENORM_REP {1,0}

#define __DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 }
#define __DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 }  // { 0, 0, 0, 0x7ff8 }
#define __DOUBLE_SNAN_REP { 0, 0, 0, 0xfff0 }  // { 1, 0, 0, 0x7ff0 }
#define __DOUBLE_DENORM_REP {1, 0, 0, 0}



template <class __dummy>
class __iec559_consts
{
  public:
    union _rep
    {
      unsigned short word[4];
      float float_val;
      double double_val;	
    } ;
  static const union _rep _S_QNaNF; 
  static const union _rep _S_SNaNF; 
  static const union _rep _S_InfF; 
  static const union _rep _S_DenormF; 
  static const union _rep _S_QNaN;
  static const union _rep _S_SNaN;
  static const union _rep _S_Inf;
  static const union _rep _S_Denorm;
};

// Static const initialization

template <class __dummy>
  const __iec559_consts<__dummy>::_rep
  __iec559_consts<__dummy>::_S_QNaNF = { __FLOAT_QNAN_REP };

template <class __dummy>
  const __iec559_consts<__dummy>::_rep
  __iec559_consts<__dummy>::_S_SNaNF = { __FLOAT_SNAN_REP };

template <class __dummy>
  const __iec559_consts<__dummy>::_rep
  __iec559_consts<__dummy>::_S_InfF = { __FLOAT_INF_REP }; 

template <class __dummy>
  const __iec559_consts<__dummy>::_rep
  __iec559_consts<__dummy>::_S_DenormF = { __FLOAT_DENORM_REP };

template <class __dummy>
  const __iec559_consts<__dummy>::_rep
  __iec559_consts<__dummy>::_S_QNaN = { __DOUBLE_QNAN_REP };

template <class __dummy>
  const __iec559_consts<__dummy>::_rep
  __iec559_consts<__dummy>::_S_SNaN = { __DOUBLE_SNAN_REP };

template <class __dummy>
  const __iec559_consts<__dummy>::_rep
  __iec559_consts<__dummy>::_S_Inf = { __DOUBLE_INF_REP };

template <class __dummy>
  const __iec559_consts<__dummy>::_rep
  __iec559_consts<__dummy>::_S_Denorm  = { __DOUBLE_DENORM_REP };


// float
#define __glibcpp_float_has_infinity true
#define __glibcpp_float_has_quiet_NaN true
#define __glibcpp_float_has_signaling_NaN true
#define __glibcpp_float_has_denorm denorm_present
#define __glibcpp_float_has_denorm_loss true
#define __glibcpp_float_infinity \
	__iec559_consts<bool>::_S_InfF.float_val
#define __glibcpp_float_quiet_NaN \
	__iec559_consts<bool>::_S_QNaNF.float_val
#define __glibcpp_float_signaling_NaN \
	__iec559_consts<bool>::_S_SNaNF.float_val
#define __glibcpp_float_denorm_min \
	__iec559_consts<bool>::_S_DenormF.float_val
#define __glibcpp_float_is_iec559 true
#define __glibcpp_float_is_bounded true
#define __glibcpp_float_is_modulo false
#define __glibcpp_float_traps true
#define __glibcpp_float_tinyness_before true
#define __glibcpp_float_round_style round_to_nearest

// double

#define __glibcpp_double_has_infinity true
#define __glibcpp_double_has_quiet_NaN true
#define __glibcpp_double_has_signaling_NaN true
#define __glibcpp_double_has_denorm denorm_present
#define __glibcpp_double_has_denorm_loss true
#define __glibcpp_double_infinity \
	__iec559_consts<bool>::_S_Inf.double_val
#define __glibcpp_double_quiet_NaN \
	__iec559_consts<bool>::_S_QNaN.double_val
#define __glibcpp_double_signaling_NaN \
	__iec559_consts<bool>::_S_SNaN.double_val
#define __glibcpp_double_denorm_min \
	__iec559_consts<bool>::_S_Denorm.double_val
#define __glibcpp_double_is_iec559 true
#define __glibcpp_double_is_bounded true
#define __glibcpp_double_is_modulo false
#define __glibcpp_double_traps true
#define __glibcpp_double_tinyness_before true
#define __glibcpp_double_round_style round_to_nearest

#endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]