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]

How can I write an empty conversion instruction


I was wondering if anyone could tell me how to write an (empty)
instruction pattern that does a truncate/extend conversion on a register
'in place'.

All the conversions I see are like this one in ia64/ia64.md:

(define_insn "extendsfdf2"
  [(set (match_operand:DF 0 "fr_register_operand" "=f")
        (float_extend:DF (match_operand:SF 1 "fr_register_operand" "f")))]
  ""
  "fnorm.d %0 = %1"
  [(set_attr "itanium_class" "fmac")])

Where the source and the destination may or may not be the same
register.

I am trying to create an empty extend operation I can use to 'convert' a
SFmode register into a DFmode register without actually generating any
code.  Since I don't want this extend called in place of the normal one
I defined it as an UNSPEC operation instead of a float_extend operation
and since it doesn't generate any code and it cannot move the result
from one register to another I need to define it with only one operand.

But my attempt to do this doesn't seem to work and I was wondering if
anyone could tell me why or perhaps point me to an example of an
instruction that does a conversion in place that might help me
understand how to write such an instruction.

My attempt:

(define_insn "nop_extendsfdf"
  [(set (match_operand:DF 0 "fr_register_operand" "+f")
        (unspec:DF [(match_dup:SF 0)] UNSPEC_NOP_EXTEND))]
  ""
  ""
  [(set_attr "itanium_class" "ignore")
   (set_attr "predicable" "no")
   (set_attr "empty" "yes")])

I think the match_dup may be wrong since I am using it with SF but the
original match_operand has DF.  Do I need to make this modeless?  Or is
there some other way to create an empty conversion instruction.

Steve Ellcey
sje@cup.hp.com


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