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: help on adding new insns like min/max


Yes, you are totally right and I'm misled by the abs implemention in
our gcc compiler (I don't know who added support for the abs insn),
it can support "abs(a)" and will translate it into one single abs 
insn. Now it seems that guy did something really complicated.
Thank you so much :)

Ming

--- Dale Johannesen <dalej@apple.com> wrote:
> 
> On Monday, October 21, 2002, at 04:05  PM, Ming Ouyang wrote:
> 
> > I tried my gcc with definition of sminsi3/smaxsi3 and I dumpped
> > all debug info, gcc always treats min as a function call in my
> > test.c.00.rtl through test.c.30.dbr:
> >
> > (call (mem:SI (symbol_ref/v:SI ("smin")) ))
> >
> > I think once gcc found that is a function call, it would not
> > optimize it, am I right?
> > What I should get is something like "(smin: SI ...", is that right?
> > So probably I need to change something other than xxx.md?
> > Thanks.
> 
> If you're using it as a function of course gcc will treat it as
> a function.  It is not one of the standard C functions so gcc does
> not do anything special to it (and is not allowed to, that would
> break standard conformance).  The usual way to get min/max functionality
> in C is to put a macro definition in a header file somewhere, something 
> like
> #define MAX(x,y) ((x>y) ? x : y)
> (watch out for ++ operators, improvement left as an exercise)
> 


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/


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