Hello all,

I am trying to implement a builtin function __macf for a private target.
I have added the required target hooks for this.
Say for the following code

int main()
{
 int operand1 = 2;
 int operand2 = 3;
 int operand3 = 4;
 int result;

  /* operand3 = operand3 + (operand1 * operand2)*/

 result = __macf(operand1, operand2, operand3);

}

Requirement :  I need the value of operand3 and result to be same
after calling the builtin.
But this is not happening.
In this case, all the 3 operands are loaded from memory for the
operation. After the operation is complete, operand3 gets modified.
But the modified value of operand3 is not saved/updated.Only the
variable "result" is updated

How do i do this?

The pattern that i have used for this purpose is
(define_insn "macfsi"
  [(set (match_operand:SI 0 "data_reg" "=f")
                (plus:SI (mult:SI (match_operand:SI 1 "data_reg" "f")
                                        (match_operand:SI 2 "data_reg" "f"))
                            (match_operand:SI 3 "data_reg" "0")))]
    ""
    "macf\\t%1, %2, %3"
  [(set_attr "type" "arith")
   (set_attr "length" "2")]
)

The instruction macf will store the result in last operand i.e %3+=%2 * %1

Regards,
Shafi

Reply via email to