This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Folding built-in functions
- From: Ian Lance Taylor <iant at google dot com>
- To: ranjith kumar <ranjit_kumar_b4u at yahoo dot co dot uk>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 08 Mar 2007 09:25:52 -0800
- Subject: Re: Folding built-in functions
- References: <20070306181652.9029.qmail@web27414.mail.ukl.yahoo.com>
ranjith kumar <ranjit_kumar_b4u@yahoo.co.uk> writes:
> Gcc manuals says all builtin functions are folded in
> tree optimization passe(given below) that are run
> after gimplification
> http://gcc.gnu.org/onlinedocs/gccint/Tree_002dSSA-passes.html#Tree_002dSSA-passes
>
> >Folding built-in functions
>
> >This pass simplifies built-in functions, as
> applicable, >with constant arguments or with
> inferrable string >lengths. It is located in
> tree-ssa-ccp.c and is >described by
> pass_fold_builtins.
>
> 1)I find _builtin* functions in mmintrin.h,
> xmmintrin.h and emmintrin.h........
> I think 'Folding built-in functions' is the pass that
> replaces _builtin functions when a program is
> compiled. Am I right?
Sort of but not really. The __builtin* functions used by mmintrin.h
and friends are not generally folded. They may be folded in some
cases if they are called with constant arguments, as in the
description of the pass. Those functions are usually expanded when
translating GIMPLE into RTL. The code to do the expansion of these
particular functions is ix86_expand_builtin. That function looks at
the __builtin function code and generates the appropriate RTL.
Ian