public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* Re: ALIAS instructions are messed up?
@ 2009-10-03 20:33 Joern Rennecke
  2009-10-05 18:22 ` Doug Evans
  0 siblings, 1 reply; 4+ messages in thread
From: Joern Rennecke @ 2009-10-03 20:33 UTC (permalink / raw)
  To: Doug Evans; +Cc: cgen

> Whether to disallow alias insns entirely is a separate question. Dunno.
> [We could still keep it for macro-insns.
> And I realize there are a few ports that currently use it, or at  
> least specify > it.]

Currently, macro-instructions can't be used in all instances where
it should be natural to use them.
When you want to set a multi-ifield to a constant, you end up with
the entire costant being added in in the bit position of each of
constituent simple bitfields.

By adding an ALIAS instruction by hand, you can at least work around
the problem by setting only simple bitfields to constants.

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

* Re: ALIAS instructions are messed up?
  2009-10-03 20:33 ALIAS instructions are messed up? Joern Rennecke
@ 2009-10-05 18:22 ` Doug Evans
  2009-10-05 21:42   ` Joern Rennecke
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Evans @ 2009-10-05 18:22 UTC (permalink / raw)
  To: Joern Rennecke; +Cc: cgen

Joern Rennecke wrote:
>> Whether to disallow alias insns entirely is a separate question. Dunno.
>> [We could still keep it for macro-insns.
>> And I realize there are a few ports that currently use it, or at 
>> least specify > it.]
>
> Currently, macro-instructions can't be used in all instances where
> it should be natural to use them.
> When you want to set a multi-ifield to a constant, you end up with
> the entire costant being added in in the bit position of each of
> constituent simple bitfields.

Let's fix this.  Do you have an example readily available?

>
> By adding an ALIAS instruction by hand, you can at least work around
> the problem by setting only simple bitfields to constants.

Good point.

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

* Re: ALIAS instructions are messed up?
  2009-10-05 18:22 ` Doug Evans
@ 2009-10-05 21:42   ` Joern Rennecke
  0 siblings, 0 replies; 4+ messages in thread
From: Joern Rennecke @ 2009-10-05 21:42 UTC (permalink / raw)
  To: Doug Evans; +Cc: cgen

Quoting Doug Evans <dje@sebabeach.org>:
> Let's fix this.  Do you have an example readily available?

The port where I have most recently encountered this is under NDA,
so I just made up a relevant macro insn for the frv:

Index: frv.cpu
===================================================================
RCS file: /cvs/src/src/cpu/frv.cpu,v
retrieving revision 1.25
diff -u -r1.25 frv.cpu
--- frv.cpu     7 Jan 2009 01:09:24 -0000       1.25
+++ frv.cpu     5 Oct 2009 21:36:15 -0000
@@ -5786,6 +5786,12 @@
  (register-transfer-spr movgs OP_03 OPE1_06 GRj spr u-gr2spr  
"transfer gr->spr")
  (register-transfer-spr movsg OP_03 OPE1_07 spr GRj u-spr2gr  
"transfer spr->gr")

+(dnmi movgs_pcsr ""
+       ()
+       ("movgs_pcsr$pack $GRj")
+       (emit movgs pack GRj (spr 1))
+)
+
  ; Integer Branch Conditions
  (define-pmacro (Inev cc) (const BI 0))
  (define-pmacro (Ira  cc) (const BI 1))
[bld-frv]$ cat tst.S
movgs sp,pcsr
movgs sp,hsr49
movgs_pcsr sp
[bld-frv]$ gas/as-new -ahld tst.S
FRV GAS  tst.S                  page 1


    1 0000 800C1181      movgs sp,pcsr
    2 0004 820C1181      movgs sp,hsr49
    3 0008 820C1181      movgs_pcsr sp

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

* ALIAS instructions are messed up?
@ 2009-06-18 17:27 Doug Evans
  0 siblings, 0 replies; 4+ messages in thread
From: Doug Evans @ 2009-06-18 17:27 UTC (permalink / raw)
  To: cgen

Blech.  Handling of ALIAS instructions is messed up.

 From insn.scm:-insn-parse:

        (let ((ifield-assertion (if (not (null? ifield-assertion))
                                    ifield-assertion
                                    #f))
              (semantics (if (not (null? semantics))
                             semantics
                             #f))
              (format (-parse-insn-format (string-append errtxt " format")
                                          fmt))
              (comment (parse-comment comment errtxt))
              ; If there are no semantics, mark this as an alias.
              ; ??? Not sure this makes sense for multi-insns.
              (atlist-obj (if semantics
                              atlist-obj
                              (atlist-cons (bool-attr-make 'ALIAS #t)
                                           atlist-obj)))
              (syntax (parse-syntax syntax errtxt))
              (timing (parse-insn-timing errtxt timing))
              )

If this were a `let*', then things would be a bit clearer, but not 
completely.
[the checking for alias insns won't work if it's expecting the previous 
assignment of semantics to change () to #f]

This comes up because generating the html doc for xc16x.cpu crashes 
because its "nop" instruction has () for semantics.

I can't remember if there's any usefulness to ALIAS insns that isn't 
provided by macro-insns.
Can anyone?

I don't have too strong a preference on what to do here (though I 
reserve the right to change my mind :-)).
Since, e.g., simulators rightly ignore ALIAS insns it seems like we want 
to flag insns in .cpu files with missing/empty semantics as an error and 
not silently convert them to aliases.
Nop insns would be required to specify (nop) for their semantics.
It'd be interesting to see if making this change causes any changes to 
the generated code.

Whether to disallow alias insns entirely is a separate question.  Dunno.
[We could still keep it for macro-insns.
And I realize there are a few ports that currently use it, or at least 
specify it.]

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

end of thread, other threads:[~2009-10-05 21:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-03 20:33 ALIAS instructions are messed up? Joern Rennecke
2009-10-05 18:22 ` Doug Evans
2009-10-05 21:42   ` Joern Rennecke
  -- strict thread matches above, loose matches on Subject: below --
2009-06-18 17:27 Doug Evans

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