This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about UNSPEC rtx and a new instruction


JCX <jcx721@gmail.com> writes:

> Hello, I am working on a gcc porting for a new instruction. This
> instruction needs to move data from memory to two registers. So I use
> the SET rtx, and the dest of SET is an UNSPEC rtx with two registers.
> By using such a rtl pattern, gcc performs very differently. It makes
> mistakes for register replacement and instruction reordering.
> For example, when gcc optimizes in pass_cse, it performs register
> substitution of registers in UNSPEC rtx without checking the validity
> of the resulting insn.
> So I wonder about the UNSPEC rtx.
>
> What's the usage of UNSPEC rtx?

UNSPEC is used for values which can not be easily specified in RTL.
There are many existing examples.  I'm surprised that using it as the
destination of a set works at all.

> And do you have a better rtl pattern for this new instruction?

Use a PARALLEL with two SETs.

(define_insn ""
  [(set () ())
   (set () ())]
  ...)

This is a common RTL pattern on machines with a condition code
register, such as the x86.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]