public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* movsi on 16-bit machine: how to?
@ 2009-03-27  8:56 Florent DEFAY
  2009-03-27 16:38 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Florent DEFAY @ 2009-03-27  8:56 UTC (permalink / raw)
  To: gcc-help

Hi,

I am implementing movsi on a 16-bit machine.
I did it this way:

;; ---- movsi

(define_insn "movsi"
  [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m,r,r")
        (match_operand:SI 1 "general_operand" "r,r,m,i"))]
  ""
  "#"
)

(define_split
  [(set (match_operand:SI 0 "nonimmediate_operand" "")
        (match_operand:SI 1 "general_operand" ""))]
  "reload_completed
  && !extra_constraint (operands[1], 'R')"
  [(set (match_dup 2)
        (match_dup 3))
   (set (match_dup 4)
        (match_dup 5))]
  {
    operands[2] = simplify_gen_subreg(HImode,operands[0],SImode,0);
    operands[4] = simplify_gen_subreg(HImode,operands[0],SImode,2);
    operands[3] = simplify_gen_subreg(HImode,operands[1],SImode,0);
    operands[5] = simplify_gen_subreg(HImode,operands[1],SImode,2);
  }
)


And I tried many other code. But each time I have some " insn does not
satisfy its constraints".

../../../gcc-4.3.3/libgcc/../gcc/libgcc2.c: In function ‘__lshrsi3’:
../../../gcc-4.3.3/libgcc/../gcc/libgcc2.c:435: error: insn does not
satisfy its constraints:
(insn 8 98 80 ../../../gcc-4.3.3/libgcc/../gcc/libgcc2.c:415 (set
(mem/c/i:SI (reg:HI 0 r0) [0 <result>+0 S4 A16])
        (reg:SI 1 r1)) 6 {movsi} (nil))


I am looking for a great and simple example of movsi for 16-bit
machine or movdi for 32-bit machine (because I think it is the same
mechanism);
or a basic method to do this.

I will be grateful for any advice.

Florent

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: movsi on 16-bit machine: how to?
  2009-03-27  8:56 movsi on 16-bit machine: how to? Florent DEFAY
@ 2009-03-27 16:38 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2009-03-27 16:38 UTC (permalink / raw)
  To: Florent DEFAY; +Cc: gcc-help

Florent DEFAY <spira.inhabitant@gmail.com> writes:

> ;; ---- movsi
>
> (define_insn "movsi"
>   [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m,r,r")
>         (match_operand:SI 1 "general_operand" "r,r,m,i"))]
>   ""
>   "#"
> )

...

> ../../../gcc-4.3.3/libgcc/../gcc/libgcc2.c: In function ‘__lshrsi3’:
> ../../../gcc-4.3.3/libgcc/../gcc/libgcc2.c:435: error: insn does not
> satisfy its constraints:
> (insn 8 98 80 ../../../gcc-4.3.3/libgcc/../gcc/libgcc2.c:415 (set
> (mem/c/i:SI (reg:HI 0 r0) [0 <result>+0 S4 A16])
>         (reg:SI 1 r1)) 6 {movsi} (nil))

As far as I can see, the only way that this insn could fail to satisfy
its constraints would be if (mem:SI (reg:HI 0)) does not satisfy the 'm'
constraint.  That implies that that address is not recognized by
GO_IF_LEGITIMATE_ADDRESS.  Look there first.


> I am looking for a great and simple example of movsi for 16-bit
> machine or movdi for 32-bit machine (because I think it is the same
> mechanism);
> or a basic method to do this.

There are many examples in the existing gcc backends.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-27 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-27  8:56 movsi on 16-bit machine: how to? Florent DEFAY
2009-03-27 16:38 ` Ian Lance Taylor

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).