This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: HOST_WIDE_INT
- From: qinfeng dot zhang at philips dot com
- To: Roberto Belloni <rbelloni at yahoo dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 13 Jun 2003 18:58:28 +0800
- Subject: Re: HOST_WIDE_INT
Although the target machine is 64-bit, but you need not define all data type as 64-bit.
To: gcc@gcc.gnu.org
cc: (bcc: Qinfeng Zhang/SHA/RESEARCH/PHILIPS)
Subject: HOST_WIDE_INT
Roberto Belloni Classification:
<rbelloni@yahoo.com>
Sent by:
gcc-owner@gcc.gnu.org
2003-06-13 18:08
Hello
I'm hoping that someone can help me to better
understand my problem with the macro HOST_WIDE_INT.
I'm working on gcc 3.2.2, I have a 64 bit target
machine and my host
machine is a pentium.
So these are my target macros in local.h:
#define BITS_BIG_ENDIAN 0
#define BYTES_BIG_ENDIAN 0
#define WORDS_BIG_ENDIAN 0
#define BITS_PER_UNIT 64 // <-- NOTE
#define BITS_PER_WORD 64
#define UNITS_PER_WORD 1
#define POINTER_SIZE 64
#define PTRDIFF_TYPE "int"
#define SIZE_TYPE "int"
#define POINTER_BOUNDARY 64
#define PARM_BOUNDARY 64
#define STACK_BOUNDARY 64
#define FUNCTION_BOUNDARY 64
#define EMPTY_FIELD_BOUNDARY 64
#define BIGGEST_ALIGNMENT 128
#define STRICT_ALIGNMENT 1
#define INT_TYPE_SIZE 64
#define SHORT_TYPE_SIZE 64
#define LONG_TYPE_SIZE 64
#define LONG_LONG_TYPE_SIZE 64
#define CHAR_TYPE_SIZE 64
#define FLOAT_TYPE_SIZE 64
#define DOUBLE_TYPE_SIZE 64
#define LONG_DOUBLE_TYPE_SIZE 64
First, I have a problem with the function
"assemble_real" in varasm.c because it works only
if BITS_PER_UNIT is 8, 16, or 32 bit and not 64.
So I'm writing the 64 bit case.
void assemble_real (d, mode, align)
REAL_VALUE_TYPE d;
enum machine_mode mode;
unsigned int align;
{
long data[4];
long l;
unsigned int nalign = min_align (align, 32);
switch (BITS_PER_UNIT)
{
case 8:
//...
break;
case 16:
//...
break;
case 32:
//...
break;
case 64:
// NEW CASE ...!
break;
default:
abort ();
}
}
Second, the macro REAL_VALUE_TO_TARGET_SINGLE(d, data)
doesn't work because its code is (about)
union {
REAL_VALUE_TYPE f;
HOST_WIDE_INT l[2];
} u;
if (sizeof(long) * 2 < sizeof(REAL_VALUE_TYPE))
abort ();
u.l[0] = u.l[1] = 0;
u.f = d;
if (HOST_FLOAT_WORDS_BIG_ENDIAN ==
FLOAT_WORDS_BIG_ENDIAN)
{
data[0] = u.l[0];
data[1] = u.l[1];
}
else
{
data[1] = u.l[0];
data[0] = u.l[1];
}
Where data is a long vector and a long is a 32 bit
type.
REAL_VALUE_TYPE and HOST_WIDE_INT are two 64 bit
types.
Q: Why is HOST_WIDE_INT a 64 bit type?
Q: Did I make any errors?
Of course the macro works if I use long instead of
HOST_WIDE_INT.
Thanks for any clarifications.
Bye,
Roberto Belloni
______________________________________________________________________
Yahoo! Mail: 6MB di spazio gratuito, 30MB per i tuoi allegati, l'antivirus, il filtro Anti-spam
http://it.yahoo.com/mail_it/foot/?http://it.mail.yahoo.com/