On 5/4/07, Andrew Haley <[EMAIL PROTECTED]> wrote:
Mohamed Shafi writes:

 > 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.

What do you mean, exactly?  C only has call by value, and gcc's
builtins can only return one value.  Builtins don't change their
arguments.  If you want to update one of the arguments you'll have to
pass a pointer to the builtin.

After the builtin i want to have the following operations also to carried out
operand3 = result ;
Since builtins don't change their arguments and since i don't want to
pass the pointers, i will have to write some kind of wrapper function
to do that. Where should i be doing this? in target_expand_builtin
function ? or should it be done in the backend patten of macf builtin
?

Thanks in advance.

Regards,
Shafi

Reply via email to