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]

Porting GCC: setting lenght-atrribute


Hello,

I write a Machine Description and have the following problem: In the
Standard Instruction Pattern "ashl*3" (Arithmetic Shift left) I call
another function in the machine.c-File. Here is the Instruction Pattern:

(define_insn "ashlqi3"
  [(set (match_operand:QI 0 "register_operand" "=a,f,r")
 (ashift:QI (match_operand:QI 1 "register_operand" "0,0,0")
     (match_operand:QI 2 "general_operand" "i,i,i")))]
  ""
  "*
  { int len;
    return gen_ashlqi3 (insn, operands, &len, which_alternative);"
  }
  [(set_attr "length" "?,?,?") <- dependet from variable len (set by the
called function)
   (set_attr "type" "logic,logic,logic")
   (set_attr "cc" "*,*,*")]
)

Then I also want to set the attribute length. But the length of the
Assembler Instruction Block depends on operand[2] that is an immediate
operand in this case. For example: the Assembler Instruction block for
alternative 0 is 2 Bytes long when operands[2] is 1, that means
operands[0] has to be shiftet by 1 Bit. The same Assembler Instruction
block is 3 Bytes long when operands[2] is 2, that means operands[0] has
to be shiftet by 2 Bit. In the called function (gen_ashlqi3) the
variable len is set to the right value - but how can use this varaible
to set the length-attribute ? Is there a possibility to set an attribute
in the Output Template ? I mean, it is possible to read the value of an
attribute in the Output Template with the function get_attr_length (or
get_attr_attributename), so is it also possible to set the attribute
there ? But in genattr.c there is no function set_attr_... or s.th. like
this. The other way is to set the attribute in the Attribute-Template
but I don't know how to reference the variable len. Is this possible
anyway ?

Another Question: What is the difference between Arithmetical and
Logical Shifting ? When shiften left the GCC does not distinguish
between these two cases -> there is only a the Operation "ashl*3", but
when shiften right there are the Operations "ashr*3" and "lshr*3". What
is the difference between them ?

ciao,
Anja




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