public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Aurelien Buhrig <aurelien.buhrig.gcc@gmail.com>
To: cgen@sources.redhat.com
Subject: 2-word field extraction issue
Date: Mon, 08 Aug 2011 14:49:00 -0000	[thread overview]
Message-ID: <CAJ-J9_UERtRCjo-K+Y4be+q44AzpcRk97PGzAQSmdM10-_VyBw@mail.gmail.com> (raw)

Hi,

I'm modifiying our existing sid port for our 16-bit MCU to add a
branch instruction with a 22-bit pcrel offset. Here is the short
description:

(define-arch
    (name tam16)
    (default-alignment aligned)
    (insn-lsb0? #f)
...)

(define-isa
  (name tam16)
  (default-insn-bitsize 16)
  (base-insn-bitsize 16)
  (default-insn-word-bitsize 16))

(define-cpu
   (name tam16bf)
   (endian big)
    (word-bitsize 16)
   (insn-chunk-bitsize 0))

The new 22-bit pcrel branch instruction is 2-word long and the pcrel
corresponding field is continuous. I tried to define it like this:

(define-ifield
       (name  f-pcrel22)
       (attrs PCREL-ADDR)
       (word-offset 0)
       (word-length 32)
       (start 10)
       (length 22)
       (mode INT)
       (encode (...))
       (decode (...))))

The generated code for extraction this field in
tam16bf_extract_sfmt_bsr22l tam16bf_extract_sfmt_bsr22l
(tam16-decode.cxx file)
 is EXTRACT_MSB0_SINT (insn, 16, 10, 22), which I think is wrong (base
insn are 16-bit long).

I worked around this problem by defining a multi-ifield with insert
and extract expressions to make it doing the correct thing, but i'm
wondering if it should be a bug ?

Aurelien

                 reply	other threads:[~2011-08-08 14:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CAJ-J9_UERtRCjo-K+Y4be+q44AzpcRk97PGzAQSmdM10-_VyBw@mail.gmail.com \
    --to=aurelien.buhrig.gcc@gmail.com \
    --cc=cgen@sources.redhat.com \
    /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).