public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: youssef fahmi <yflelion@hotmail.fr>
To: <cgen@sourceware.org>
Subject: FW: Problem with instruction description
Date: Mon, 16 Jan 2012 08:37:00 -0000	[thread overview]
Message-ID: <SNT142-W55E6D7BB2F4CBE4C3ABEA1A8830@phx.gbl> (raw)
In-Reply-To: <SNT142-W25447ECD857E54B6EF0E56A8830@phx.gbl>


Hello,

I am working on the porting of binutils to a new architecture.
This processor has an instruction of the form: ld rx,[r1] + imm6 [load the 32 bit word at the address calculated from the contents of r1 plus the 6 bit immediate value (multiplied by 4) ]
In summary:    rx <- mem[r1 + imm6 * 4]

I need to generate code for this instruction, but only in the case where the code generator in the compiler generates a standard load, but with an offset appropriate for the imm6 value. That is to say the immediate value would be less than 256 and be a multiple of 4 (word access).

This is the description that I am using at the moment:
(df​​-f imm6x4 "imm6x4" ()
    11 6 UINT
  ((value pc) (sra WI value (const 2)))
  ((value pc) (sll WI value (const 2))))
(dnop imm6x4 "imm6x4" () h-uint f-imm6x4)
(dni ldstack-r1-imm6x4 "ldstack r1#imm6x4"   ()   "ld $r1,[r1]+$imm6x4"   (+ (f-stack-opcode #05) r1 imm6x4)   ()   ())   
However this description causes the "ld rx,[r1] + imm6" to be used whenever the immediate vallue is less than 256, and not JUST when the offset is also a multiple of 4.
How do I alter this description so that it only operates when the immediate value is less than 256 AND ALSO a multiple of 4.

I have already tried.... but this generates code with this instruction in these cases ;;; which are not appropriate.How do I achieve this? 
I guess that I'll have to create an attribute to handle this, but I could not get an attribute that suits me. is there a way to create an attribute of type integer, for example, but with only specific integers not necessarily following.  

Thanks in advance  for your answer.
Youssef 		 	   		   		 	   		  

           reply	other threads:[~2012-01-16  8:37 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <SNT142-W25447ECD857E54B6EF0E56A8830@phx.gbl>]

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=SNT142-W55E6D7BB2F4CBE4C3ABEA1A8830@phx.gbl \
    --to=yflelion@hotmail.fr \
    --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).