⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 900-nios2.patch

📁 用于生成linux操作系统下的交叉编译工具链和嵌入式linux系统的根文件系统,支持x86、arm、powerpc等处理器
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
index 0000000..48a7bd7--- /dev/null+++ b/gcc/config/nios2/lib2-divtable.c@@ -0,0 +1,46 @@++/* We include auto-host.h here to get HAVE_GAS_HIDDEN.  This is+   supposedly valid even though this is a "target" file.  */+#include "auto-host.h"+++#include "tconfig.h"+#include "tsystem.h"+#include "coretypes.h"+#include "tm.h"+++/* Don't use `fancy_abort' here even if config.h says to use it.  */+#ifdef abort+#undef abort+#endif+++#ifdef HAVE_GAS_HIDDEN+#define ATTRIBUTE_HIDDEN  __attribute__ ((__visibility__ ("hidden")))+#else+#define ATTRIBUTE_HIDDEN+#endif++#include "libgcc2.h"++UQItype __divsi3_table[] =+{+  0, 0/1, 0/2, 0/3, 0/4, 0/5, 0/6, 0/7, 0/8, 0/9, 0/10, 0/11, 0/12, 0/13, 0/14, 0/15,+  0, 1/1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12, 1/13, 1/14, 1/15,+  0, 2/1, 2/2, 2/3, 2/4, 2/5, 2/6, 2/7, 2/8, 2/9, 2/10, 2/11, 2/12, 2/13, 2/14, 2/15,+  0, 3/1, 3/2, 3/3, 3/4, 3/5, 3/6, 3/7, 3/8, 3/9, 3/10, 3/11, 3/12, 3/13, 3/14, 3/15,+  0, 4/1, 4/2, 4/3, 4/4, 4/5, 4/6, 4/7, 4/8, 4/9, 4/10, 4/11, 4/12, 4/13, 4/14, 4/15,+  0, 5/1, 5/2, 5/3, 5/4, 5/5, 5/6, 5/7, 5/8, 5/9, 5/10, 5/11, 5/12, 5/13, 5/14, 5/15,+  0, 6/1, 6/2, 6/3, 6/4, 6/5, 6/6, 6/7, 6/8, 6/9, 6/10, 6/11, 6/12, 6/13, 6/14, 6/15,+  0, 7/1, 7/2, 7/3, 7/4, 7/5, 7/6, 7/7, 7/8, 7/9, 7/10, 7/11, 7/12, 7/13, 7/14, 7/15,+  0, 8/1, 8/2, 8/3, 8/4, 8/5, 8/6, 8/7, 8/8, 8/9, 8/10, 8/11, 8/12, 8/13, 8/14, 8/15,+  0, 9/1, 9/2, 9/3, 9/4, 9/5, 9/6, 9/7, 9/8, 9/9, 9/10, 9/11, 9/12, 9/13, 9/14, 9/15,+  0, 10/1, 10/2, 10/3, 10/4, 10/5, 10/6, 10/7, 10/8, 10/9, 10/10, 10/11, 10/12, 10/13, 10/14, 10/15,+  0, 11/1, 11/2, 11/3, 11/4, 11/5, 11/6, 11/7, 11/8, 11/9, 11/10, 11/11, 11/12, 11/13, 11/14, 11/15,+  0, 12/1, 12/2, 12/3, 12/4, 12/5, 12/6, 12/7, 12/8, 12/9, 12/10, 12/11, 12/12, 12/13, 12/14, 12/15,+  0, 13/1, 13/2, 13/3, 13/4, 13/5, 13/6, 13/7, 13/8, 13/9, 13/10, 13/11, 13/12, 13/13, 13/14, 13/15,+  0, 14/1, 14/2, 14/3, 14/4, 14/5, 14/6, 14/7, 14/8, 14/9, 14/10, 14/11, 14/12, 14/13, 14/14, 14/15,+  0, 15/1, 15/2, 15/3, 15/4, 15/5, 15/6, 15/7, 15/8, 15/9, 15/10, 15/11, 15/12, 15/13, 15/14, 15/15,+};+diff --git a/gcc/config/nios2/lib2-mul.c b/gcc/config/nios2/lib2-mul.cnew file mode 100644index 0000000..8511b33--- /dev/null+++ b/gcc/config/nios2/lib2-mul.c@@ -0,0 +1,103 @@+/* while we are debugging (ie compile outside of gcc build) +   disable gcc specific headers */+#ifndef DEBUG_MULSI3+++/* We include auto-host.h here to get HAVE_GAS_HIDDEN.  This is+   supposedly valid even though this is a "target" file.  */+#include "auto-host.h"+++#include "tconfig.h"+#include "tsystem.h"+#include "coretypes.h"+#include "tm.h"+++/* Don't use `fancy_abort' here even if config.h says to use it.  */+#ifdef abort+#undef abort+#endif+++#ifdef HAVE_GAS_HIDDEN+#define ATTRIBUTE_HIDDEN  __attribute__ ((__visibility__ ("hidden")))+#else+#define ATTRIBUTE_HIDDEN+#endif++#include "libgcc2.h"++#else+#define SItype int+#define USItype unsigned int+#endif+++extern SItype __mulsi3 (SItype, SItype);++SItype+__mulsi3 (SItype a, SItype b)+{+  SItype res = 0;+  USItype cnt = a;+  +  while (cnt)+    {+      if (cnt & 1)+        {+	  res += b;	  +	}+      b <<= 1;+      cnt >>= 1;+    }+    +  return res;+}+/*+TODO: Choose best alternative implementation.++SItype+__divsi3 (SItype a, SItype b)+{+  SItype res = 0;+  USItype cnt = 0;+  +  while (cnt < 32)+    {+      if (a & (1L << cnt))+        {+	  res += b;	  +	}+      b <<= 1;+      cnt++;+    }+    +  return res;+}+*/+++#ifdef DEBUG_MULSI3++int+main ()+{+  int i, j;+  int error = 0;+  +  for (i = -1000; i < 1000; i++)+    for (j = -1000; j < 1000; j++)+      {+	int expect = i * j;+	int actual = A__divsi3 (i, j);+	if (expect != actual)+	  {+	    printf ("error: %d * %d = %d not %d\n", i, j, expect, actual);+	    error = 1;+	  }+      }++  return error;+}+#endifdiff --git a/gcc/config/nios2/nios2-dp-bit.c b/gcc/config/nios2/nios2-dp-bit.cnew file mode 100644index 0000000..4d63748--- /dev/null+++ b/gcc/config/nios2/nios2-dp-bit.c@@ -0,0 +1,1655 @@++#ifndef __nios2_big_endian__+#define FLOAT_BIT_ORDER_MISMATCH+#endif+/* This is a software floating point library which can be used+   for targets without hardware floating point. +   Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004+   Free Software Foundation, Inc.++This file 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.++In addition to the permissions in the GNU General Public License, the+Free Software Foundation gives you unlimited permission to link the+compiled version of this file with other programs, and to distribute+those programs without any restriction coming from the use of this+file.  (The General Public License restrictions do apply in other+respects; for example, they cover modification of the file, and+distribution when not linked into another program.)++This file 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 program; 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, if you link this library with other files,+   some of which are compiled with GCC, to produce an executable,+   this library 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.  */++/* This implements IEEE 754 format arithmetic, but does not provide a+   mechanism for setting the rounding mode, or for generating or handling+   exceptions.++   The original code by Steve Chamberlain, hacked by Mark Eichin and Jim+   Wilson, all of Cygnus Support.  */++/* The intended way to use this file is to make two copies, add `#define FLOAT'+   to one copy, then compile both copies and add them to libgcc.a.  */++#include "tconfig.h"+#include "coretypes.h"+#include "tm.h"+#include "config/fp-bit.h"++/* The following macros can be defined to change the behavior of this file:+   FLOAT: Implement a `float', aka SFmode, fp library.  If this is not+     defined, then this file implements a `double', aka DFmode, fp library.+   FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e.+     don't include float->double conversion which requires the double library.+     This is useful only for machines which can't support doubles, e.g. some+     8-bit processors.+   CMPtype: Specify the type that floating point compares should return.+     This defaults to SItype, aka int.+   US_SOFTWARE_GOFAST: This makes all entry points use the same names as the+     US Software goFast library.+   _DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding+     two integers to the FLO_union_type.+   NO_DENORMALS: Disable handling of denormals.+   NO_NANS: Disable nan and infinity handling+   SMALL_MACHINE: Useful when operations on QIs and HIs are faster+     than on an SI */++/* We don't currently support extended floats (long doubles) on machines+   without hardware to deal with them.++   These stubs are just to keep the linker from complaining about unresolved+   references which can be pulled in from libio & libstdc++, even if the+   user isn't using long doubles.  However, they may generate an unresolved+   external to abort if abort is not used by the function, and the stubs+   are referenced from within libc, since libgcc goes before and after the+   system library.  */++#ifdef DECLARE_LIBRARY_RENAMES+  DECLARE_LIBRARY_RENAMES+#endif++#ifdef EXTENDED_FLOAT_STUBS+extern void abort (void);+void __extendsfxf2 (void) { abort(); }+void __extenddfxf2 (void) { abort(); }+void __truncxfdf2 (void) { abort(); }+void __truncxfsf2 (void) { abort(); }+void __fixxfsi (void) { abort(); }+void __floatsixf (void) { abort(); }+void __addxf3 (void) { abort(); }+void __subxf3 (void) { abort(); }+void __mulxf3 (void) { abort(); }+void __divxf3 (void) { abort(); }+void __negxf2 (void) { abort(); }+void __eqxf2 (void) { abort(); }+void __nexf2 (void) { abort(); }+void __gtxf2 (void) { abort(); }+void __gexf2 (void) { abort(); }+void __lexf2 (void) { abort(); }+void __ltxf2 (void) { abort(); }++void __extendsftf2 (void) { abort(); }+void __extenddftf2 (void) { abort(); }+void __trunctfdf2 (void) { abort(); }+void __trunctfsf2 (void) { abort(); }+void __fixtfsi (void) { abort(); }+void __floatsitf (void) { abort(); }+void __addtf3 (void) { abort(); }+void __subtf3 (void) { abort(); }+void __multf3 (void) { abort(); }+void __divtf3 (void) { abort(); }+void __negtf2 (void) { abort(); }+void __eqtf2 (void) { abort(); }+void __netf2 (void) { abort(); }+void __gttf2 (void) { abort(); }+void __getf2 (void) { abort(); }+void __letf2 (void) { abort(); }+void __lttf2 (void) { abort(); }+#else	/* !EXTENDED_FLOAT_STUBS, rest of file */++/* IEEE "special" number predicates */++#ifdef NO_NANS++#define nan() 0+#define isnan(x) 0+#define isinf(x) 0+#else++#if   defined L_thenan_sf+const fp_number_type __thenan_sf = { CLASS_SNAN, 0, 0, {(fractype) 0} };+#elif defined L_thenan_df+const fp_number_type __thenan_df = { CLASS_SNAN, 0, 0, {(fractype) 0} };+#elif defined L_thenan_tf+const fp_number_type __thenan_tf = { CLASS_SNAN, 0, 0, {(fractype) 0} };+#elif defined TFLOAT+extern const fp_number_type __thenan_tf;+#elif defined FLOAT+extern const fp_number_type __thenan_sf;+#else+extern const fp_number_type __thenan_df;+#endif++INLINE+static fp_number_type *+nan (void)+{+  /* Discard the const qualifier...  */+#ifdef TFLOAT+  return (fp_number_type *) (& __thenan_tf);+#elif defined FLOAT  +  return (fp_number_type *) (& __thenan_sf);+#else+  return (fp_number_type *) (& __thenan_df);+#endif+}++INLINE+static int+isnan ( fp_number_type *  x)+{+  return x->class == CLASS_SNAN || x->class == CLASS_QNAN;+}++INLINE+static int+isinf ( fp_number_type *  x)+{+  return x->class == CLASS_INFINITY;+}++#endif /* NO_NANS */++INLINE+static int+iszero ( fp_number_type *  x)+{+  return x->class == CLASS_ZERO;+}++INLINE +static void+flip_sign ( fp_number_type *  x)+{+  x->sign = !x->sign;+}++extern FLO_type pack_d ( fp_number_type * );++#if defined(L_pack_df) || defined(L_pack_sf) || defined(L_pack_tf)+FLO_type+pack_d ( fp_number_type *  src)+{+  FLO_union_type dst;+  fractype fraction = src->fraction.ll;	/* wasn't unsigned before? */+  int sign = src->sign;+  int exp = 0;++  if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && (isnan (src) || isinf (src)))+    {+      /* We can't represent these values accurately.  By using the+	 largest possible magnitude, we guarantee that the conversion+	 of infinity is at least as big as any finite number.  */+      exp = EXPMAX;+      fraction = ((fractype) 1 << FRACBITS) - 1;+    }+  else if (isnan (src))+    {+      exp = EXPMAX;+      if (src->class == CLASS_QNAN || 1)+	{+#ifdef QUIET_NAN_NEGATED+	  fraction |= QUIET_NAN - 1;+#else+	  fraction |= QUIET_NAN;+#endif+	}+    }+  else if (isinf (src))+    {+      exp = EXPMAX;+      fraction = 0;+    }+  else if (iszero (src))+    {+      exp = 0;+      fraction = 0;+    }+  else if (fraction == 0)+    {+      exp = 0;+    }+  else+    {+      if (src->normal_exp < NORMAL_EXPMIN)+	{+#ifdef NO_DENORMALS+	  /* Go straight to a zero representation if denormals are not+ 	     supported.  The denormal handling would be harmless but+ 	     isn't unnecessary.  */+	  exp = 0;+	  fraction = 0;+#else /* NO_DENORMALS */+	  /* This number's exponent is too low to fit into the bits+	     available in the number, so we'll store 0 in the exponent and+	     shift the fraction to the right to make up for it.  */++	  int shift = NORMAL_EXPMIN - src->normal_exp;++	  exp = 0;++	  if (shift > FRAC_NBITS - NGARDS)+	    {+	      /* No point shifting, since it's more that 64 out.  */+	      fraction = 0;+	    }+	  else+	    {+	      int lowbit = (fraction & (((fractype)1 << shift) - 1)) ? 1 : 0;+	      fraction = (fraction >> shift) | lowbit;+	    }+	  if ((fraction & GARDMASK) == GARDMSB)+	    {+	      if ((fraction & (1 << NGARDS)))+		fraction += GARDROUND + 1;+	    }+	  else+	    {+	      /* Add to the guards to round up.  */+	      fraction += GARDROUND;+	    }+	  /* Perhaps the rounding means we now need to change the+             exponent, because the fraction is no longer denormal.  */+	  if (fraction >= IMPLICIT_1)+	    {+	      exp += 1;+	    }+	  fraction >>= NGARDS;+#endif /* NO_DENORMALS */+	}+      else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS)+	       && src->normal_exp > EXPBIAS)+	{+	  exp = EXPMAX;+	  fraction = 0;+	}+      else+	{+	  exp = src->normal_exp + EXPBIAS;+	  if (!ROUND_TOWARDS_ZERO)+	    {+	      /* IF the gard bits are the all zero, but the first, then we're+		 half way between two numbers, choose the one which makes the+		 lsb of the answer 0.  */+	      if ((fraction & GARDMASK) == GARDMSB)+		{+		  if (fraction & (1 << NGARDS))+		    fraction += GARDROUND + 1;+		}+	      else+		{+		  /* Add a one to the guards to round up */+		  fraction += GARDROUND;+		}+	      if (fraction >= IMPLICIT_2)+		{+		  fraction >>= 1;+		  exp += 1;+		}+	    }+	  fraction >>= NGARDS;++	  if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp > EXPMAX)+	    {+	      /* Saturate on overflow.  */+	      exp = EXPMAX;+	      fraction = ((fractype) 1 << FRACBITS) - 1;+	    }+	}+    }++  /* We previously used bitfields to store the number, but this doesn't+     handle little/big endian systems conveniently, so use shifts and+     masks */+#ifdef FLOAT_BIT_ORDER_MISMATCH+  dst.bits.fraction = fraction;+  dst.bits.exp = exp;+  dst.bits.sign = sign;+#else+# if defined TFLOAT && defined HALFFRACBITS+ {+   halffractype high, low, unity;+   int lowsign, lowexp;++   unity = (halffractype) 1 << HALFFRACBITS;++   /* Set HIGH to the high double's significand, masking out the implicit 1.+      Set LOW to the low double's full significand.  */+   high = (fraction >> (FRACBITS - HALFFRACBITS)) & (unity - 1);+   low = fraction & (unity * 2 - 1);++   /* Get the initial sign and exponent of the low double.  */+   lowexp = exp - HALFFRACBITS - 1;+   lowsign = sign;++   /* HIGH should be rounded like a normal double, making |LOW| <=+      0.5 ULP of HIGH.  Assume round-to-nearest.  */+   if (exp < EXPMAX)+     if (low > unity || (low == unity && (high & 1) == 1))+       {+	 /* Round HIGH up and adjust LOW to match.  */+	 high++;+	 if (high == unity)+	   {+	     /* May make it infinite, but that's OK.  */+	     high = 0;+	     exp++;+	   }+	 low = unity * 2 - low;+	 lowsign ^= 1;+       }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -