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: Updating an operand in RTL for a builtin function


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

Why do you want this to happen? It seems very surprising semantics.
If at all possible my advice is to not do that. None of the other sets of 
compiler builtins I know of do this. One of the advantages of using builtins 
rather than assembly directly is the user can ignore all the weird register 
constraints of instructions (eg. read-write operands) and the compiler sorts 
all that out.

If you absolutely need these semantics to conform to some third party 
specification, then I suggest you use a macro wrapper something along the 
lines of:

#define __macf(a, b, c) (a = __builtin_macf(a, b, c))

Paul


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