This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: help on adding new insns like min/max
- From: Ming Ouyang <mouyang at yahoo dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Dale Johannesen <dalej at apple dot com>
- Date: Mon, 21 Oct 2002 16:22:38 -0700 (PDT)
- Subject: 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/