From: Jean-Marc Saffroy <jean-marc.saffroy@joguin.com>
To: cgen@sourceware.org
Subject: problem with 64-bit arch
Date: Thu, 01 Oct 2009 14:41:00 -0000 [thread overview]
Message-ID: <4AC4BF97.8040302@joguin.com> (raw)
Hi,
I am trying to use CGEN for an experimental 64-bit architecture (ie.
word-bitsize is 64), and in my case the generated arch-ibld.c file is
incorrect.
I defined the following insn field:
(df f-disp24 "disp24" (PCREL-ADDR) 8 24 INT
((value pc) (sra WI (sub WI value pc) (const 2)))
((value pc) (add WI (sll WI value (const 2)) pc))
)
(define-operand
(name disp24)
(comment "24 bit signed displacement")
(type h-iaddr)
(mode WI)
(index f-disp24)
)
And arch-ibld.c contains the following code (in <arch>_cgen_insert_operand):
switch (opindex)
{
case <ARCH>_OPERAND_DISP24 :
{
long value = fields->f_disp24;
value = (() (((value) - (pc))) >> (2));
errmsg = insert_normal (cd, value,
0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 24, 32,
total_length, buffer);
}
break;
Note the missing type in the cast before assigning to value. Also using
a long type for value will cause problems when running on a 32-bit host,
since it operates on 64-bit values.
I had a quick look at the other two archs that use word-bitsize 64, ie.
sparc64 and ia64, and it seems they use multi-ifields for this kind of
PC-relative field, which may be an artificial way of avoiding the problem.
Is there an obvious fix to this problem?
Cheers,
JM
next reply other threads:[~2009-10-01 14:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-01 14:41 Jean-Marc Saffroy [this message]
2009-10-01 15:57 ` Doug Evans
2009-10-01 16:34 ` Jean-Marc Saffroy
2009-10-02 17:58 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AC4BF97.8040302@joguin.com \
--to=jean-marc.saffroy@joguin.com \
--cc=cgen@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).