This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: real.c on unicosmk
On Thu, May 16, 2002 at 10:33:15AM +0200, Roman Lechtchinsky wrote:
> On Wed, 15 May 2002, Zack Weinberg wrote:
>
> > Do you have a 32-bit and a 64-bit type?
>
> Yes.
>
> > If so, a patch to make real.c
> > work on your architecture is feasible -- it's a bit more involved than
> > I feel like doing right now, but it can be done.
>
> Does it require some fundamental changes or just a lot of tedious typing?
> I could do the latter.
Just a lot of tedious typing. Lemme get you started. Apply the
appended patch. Go through the entire of real.c and change all the
uses of 2*NE to EBYTES. Then inspect all the other uses of NE to make
sure they don't assume that EMUSHORT/UEMUSHORT are 16 bits. You
should probably also take a close look at NI, NBITS, etc. I'll help
as needed.
Bonus points if you can persuade EMUSHORT to be 16 bits on 32-bit
architectures and 32 bits on 64-bit architectures (this would be most
efficient on both).
zw
===================================================================
Index: real.c
--- real.c 12 May 2002 17:09:23 -0000 1.71
+++ real.c 17 May 2002 04:06:01 -0000
@@ -171,21 +171,6 @@ unknown arithmetic type
#endif
#endif
-/* If no 16-bit type has been found and the compiler is GCC, try HImode. */
-#if defined(__GNUC__) && EMUSHORT_SIZE != 16
-typedef int HItype __attribute__ ((mode (HI)));
-typedef unsigned int UHItype __attribute__ ((mode (HI)));
-#undef EMUSHORT
-#undef EMUSHORT_SIZE
-#undef EMULONG_SIZE
-#define EMUSHORT HItype
-#define UEMUSHORT UHItype
-#define EMUSHORT_SIZE 16
-#define EMULONG_SIZE 32
-#else
-#define UEMUSHORT unsigned EMUSHORT
-#endif
-
#if HOST_BITS_PER_SHORT >= EMULONG_SIZE
#define EMULONG short
#else
@@ -204,36 +189,38 @@ typedef unsigned int UHItype __attribute
#endif
#endif
-#if EMUSHORT_SIZE != 16
- #error "The host interface doesn't work if no 16-bit size exists."
-#endif
-
/* Calculate the size of the generic "e" type. This always has
identical in-memory size to REAL_VALUE_TYPE. The sizes are supposed
to be the same as well, but when REAL_VALUE_TYPE_SIZE is not evenly
divisible by HOST_BITS_PER_WIDE_INT we have some padding in
REAL_VALUE_TYPE.
- There are only two supported sizes: ten and six 16-bit words (160
- or 96 bits). */
+ There are only two supported sizes: 160 and 96 bits. */
#if MAX_LONG_DOUBLE_TYPE_SIZE == 128 && !INTEL_EXTENDED_IEEE_FORMAT
/* TFmode */
-# define NE 10
+# define EBITS 160
# define MAXDECEXP 4932
# define MINDECEXP -4977
#else
-# define NE 6
+# define EBITS 96
# define MAXDECEXP 4932
# define MINDECEXP -4956
#endif
-/* Fail compilation if 2*NE is not the appropriate size.
+#define EBYTES (EBITS / CHAR_BIT)
+#define NE (EBITS / EMUSHORT_SIZE)
+/* There must not have been any rounding. */
+#if NE * EMUSHORT_SIZE != EBITS
+ #error "EMUSHORT_SIZE does not divide EBITS"
+#endif
+
+/* Fail compilation if EBYTES is not the appropriate size.
If HOST_BITS_PER_WIDE_INT is 64, we're going to have padding
at the end of the array, because neither 96 nor 160 is
evenly divisible by 64. */
struct compile_test_dummy {
char twice_NE_must_equal_sizeof_REAL_VALUE_TYPE
- [(sizeof (REAL_VALUE_TYPE) >= 2*NE) ? 1 : -1];
+ [(sizeof (REAL_VALUE_TYPE) >= EBYTES) ? 1 : -1];
};
/* Construct macros to translate between REAL_VALUE_TYPE and e type.