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: Is there a way to use define_subst when operands need to change modes?



On 02/03/15 17:38, Ilya Tocar wrote:
On 02 Mar 15:22, Kyrill Tkachov wrote:
Hi all,

I'm looking at using the define_subst machinery to auto-generate
zero-extended
versions of some patterns, for example having:
(set reg:SI
      (xor:SI a:SI b:SI))

generate a pattern of the form:
(set reg:DI
      (zero_extend:DI
        (xor:SI (a:SI b:SI))))

How do I go about achieving this? From the documentation, I think I need
something like:
      (define_subst "add_z_extend"
        [(set (match_operand:SI 0 "" "")
              (match_operand:SI 1 "" ""))]
        ""
        [(set (match_dup 0)
              (zero_extend:DI (match_dup 1)))]

but in the resultant pattern I need operand 0 to be tranfsormed into DImode.
Is there a way to write that?

Can't you just use  [(set (match_operand:DI 0 "" "")...  instead of
match_dup?

So, something like:

     (define_subst "add_z_extend"
       [(set (match_operand:SI 0 "" "")
             (match_operand:SI 1 "" ""))]
       ""
       [(set (match_operand:DI 0 "" "")
             (zero_extend:DI (match_dup 1)))]


?


Are we allowed to match an operand twice?



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