public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "'Rask Ingemann Lambertsen'" <rask@sygehus.dk>
To: "Balaji V. Iyer" <bviyer@ncsu.edu>
Cc: gcc@gcc.gnu.org, openrisc@opencores.org
Subject: Re: Help with another constraint
Date: Wed, 12 Dec 2007 15:21:00 -0000	[thread overview]
Message-ID: <20071212143508.GP17368@sygehus.dk> (raw)
In-Reply-To: <002601c83c7c$b3763960$33160e98@ece.ncsu.edu>

On Wed, Dec 12, 2007 at 12:06:04AM -0500, Balaji V. Iyer wrote:
> Hello Everyone,
>     I got past that negdi2 and some errors..now I am trying to compile
> some linux module, and it says I am not able to find this constraint:
> 
> init/main.c: In function 'start_kernel':
> init/main.c:441: error: insn does not satisfy its constraints:
> (insn 112 110 478 12 (set (mem:QI (reg/v/f:SI 16 r16 [orig:72 line.183 ]
> [72]) [0 S1 A8])
>         (const_int 0 [0x0])) 16 {movqi} (nil)
>     (nil))
> init/main.c:441: internal compiler error: in
> reload_cse_simplify_operands, at postreload.c:391
> Please submit a full bug report,
> 
> Here is what I have for movqi:

   The movxx patterns are special and you'll need to hold the compiler's
hands a little. Since your target can't move immediates directly to memory,
you have to ask for a secondary reload to an intermediate register. Use the
target hook TARGET_SECONDARY_RELOAD.

   When you've got the secondary reloads working, you can likely improve
code quality:

1) Use a movqi expander to expand the instructions correctly to begin with.
For example, if operand 0 is in memory and operand 1 is an immediate, use

	operands[1] = force_reg (QImode, operands[1]);

Rename the "movqi" insn to "*movqi".

> (define_insn "movqi"
>   [(set (match_operand:QI 0 "nonimmediate_operand" "=p,q,m,m,p,q,p,q")
>         (match_operand:QI 1 "general_operand"       "m,m,p,q,p,q,I,I"))]
>   ""
    ^^
2) Reject operand combinations that aren't supported, such as operand 0
being in memory and operand 1 being an immediate.

   You can look at other RISC targets (e.g. ARM, PA-RISC, MIPS, SPARC, Alpha
or RS6000) for examples.

>   "*

   New ports should not use the old-style "* ... " C-blocks. Use { ... } as
documented. Then you'll also avoid the \" and \\ sequences.

>   switch(which_alternative)
>    {
>      case 0:
>      case 1:
>        return \"l.lbz   \\t%0,%1\";
>      case 2:
>      case 3:
>        return \"l.sb    \\t%0,%1\";
>      case 4:
>      case 5:
>        return \"l.ori   \\t%0,%1,0\\t # move reg to reg\";
>      case 6:
>      case 7:
>        return \"l.addi  \\t%0,r0,%1\\t # move immediate\";
>      default:
>        return \"invalid alternative\";
>    }

   Presumably you've temporarily coded it this way for debugging purposes.
If not, use the normal way:

   "@
    l.lbz ...
    l.sb ...
    ..."

> To give a quick explanation: 
> p = register numbers between 0-31 (inclusive)
> q = register numbers between 32-63 (inclusive)

   You use them in pairs a lot. Define a register class which consists of
registers 0-64 and use that in your constraints.
 
-- 
Rask Ingemann Lambertsen
Danish law requires addresses in e-mail to be logged and stored for a year

  parent reply	other threads:[~2007-12-12 14:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-09 13:07 Balaji V. Iyer
2007-12-09 14:28 ` Rask Ingemann Lambertsen
2007-12-09 22:06   ` Balaji V. Iyer
2007-12-10 17:31     ` 'Rask Ingemann Lambertsen'
2007-12-12  5:13       ` Balaji V. Iyer
2007-12-12 12:53         ` Revital1 Eres
2007-12-12 13:01           ` Balaji V. Iyer
2007-12-12 14:35           ` Dave Korn
2007-12-12 17:50             ` Rask Ingemann Lambertsen
2007-12-16 14:24             ` Hans-Peter Nilsson
2007-12-16 17:18               ` Hans-Peter Nilsson
2007-12-12 15:21         ` 'Rask Ingemann Lambertsen' [this message]
2007-12-17 18:38           ` Rask Ingemann Lambertsen
2007-12-17 20:31             ` Balaji V. Iyer

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=20071212143508.GP17368@sygehus.dk \
    --to=rask@sygehus.dk \
    --cc=bviyer@ncsu.edu \
    --cc=gcc@gcc.gnu.org \
    --cc=openrisc@opencores.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).