* Replace match.pd DEFINE_MATH_FNs with auto-generated lists
@ 2015-11-07 13:23 Richard Sandiford
2015-11-10 11:24 ` Richard Biener
0 siblings, 1 reply; 6+ messages in thread
From: Richard Sandiford @ 2015-11-07 13:23 UTC (permalink / raw)
To: gcc-patches
This patch autogenerates the operator lists for maths functions
like SQRT, adding an additional entry for internal functions.
E.g.:
(define_operator_list SQRT
BUILT_IN_SQRTF
BUILT_IN_SQRT
BUILT_IN_SQRTL
IFN_SQRT)
and:
(define_operator_list CABS
BUILT_IN_CABSF
BUILT_IN_CABS
BUILT_IN_CABSL
null)
(since there's no internal function for CABS).
Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
OK to install?
Thanks,
Richard
gcc/
* Makefile.in (MOSTLYCLEANFILES): Add cfn-operators.pd.
(generated_files): Likewise.
(s-cfn-operators, cfn-operators.pd): New rules.
(s-match): Depend on cfn-operators.pd.
* gencfn-macros.c: Expand comment to describe -o behavior.
(print_define_operator_list): New function.
(main): Accept -o. Call print_define_operator_list.
* genmatch.c (main): Add "." to the include path.
* match.pd (DEFINE_MATH_FN): Delete. Include cfn-operators.pd
instead.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 298bb38..a21aaf5 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1566,7 +1566,7 @@ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
tm-preds.h tm-constrs.h checksum-options gimple-match.c generic-match.c \
tree-check.h min-insn-modes.c insn-modes.c insn-modes.h \
genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \
- case-cfn-macros.h \
+ case-cfn-macros.h cfn-operators.pd \
xgcc$(exeext) cpp$(exeext) $(FULL_DRIVER_NAME) \
$(EXTRA_PROGRAMS) gcc-cross$(exeext) \
$(SPECS) collect2$(exeext) gcc-ar$(exeext) gcc-nm$(exeext) \
@@ -2252,6 +2252,14 @@ s-case-cfn-macros: build/gencfn-macros$(build_exeext)
$(STAMP) s-case-cfn-macros
case-cfn-macros.h: s-case-cfn-macros; @true
+s-cfn-operators: build/gencfn-macros$(build_exeext)
+ $(RUN_GEN) build/gencfn-macros$(build_exeext) -o \
+ > tmp-cfn-operators.pd
+ $(SHELL) $(srcdir)/../move-if-change tmp-cfn-operators.pd \
+ cfn-operators.pd
+ $(STAMP) s-cfn-operators
+cfn-operators.pd: s-cfn-operators; @true
+
target-hooks-def.h: s-target-hooks-def-h; @true
# make sure that when we build info files, the used tm.texi is up to date.
$(srcdir)/doc/tm.texi: s-tm-texi; @true
@@ -2318,7 +2326,7 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
gimple-match.c: s-match gimple-match-head.c ; @true
generic-match.c: s-match generic-match-head.c ; @true
-s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd
+s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
$(RUN_GEN) build/genmatch$(build_exeext) --gimple $(srcdir)/match.pd \
> tmp-gimple-match.c
$(RUN_GEN) build/genmatch$(build_exeext) --generic $(srcdir)/match.pd \
@@ -2439,7 +2447,8 @@ generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \
$(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h \
options.h target-hooks-def.h insn-opinit.h \
common/common-target-hooks-def.h pass-instances.def \
- c-family/c-target-hooks-def.h params.list case-cfn-macros.h
+ c-family/c-target-hooks-def.h params.list case-cfn-macros.h \
+ cfn-operators.pd
#\f
# How to compile object files to run on the build machine.
diff --git a/gcc/gencfn-macros.c b/gcc/gencfn-macros.c
index 5ee3af0..401c429 100644
--- a/gcc/gencfn-macros.c
+++ b/gcc/gencfn-macros.c
@@ -40,7 +40,27 @@ along with GCC; see the file COPYING3. If not see
case CFN_BUILT_IN_SQRTL:
case CFN_SQRT:
- The macros for groups with no internal function drop the last line. */
+ The macros for groups with no internal function drop the last line.
+
+ When run with -o, the generator prints a similar list of
+ define_operator_list directives, for use by match.pd. Each operator
+ list starts with the built-in functions, in order of ascending type width.
+ This is followed by an entry for the internal function, or "null" if there
+ is no internal function for the group. For example:
+
+ (define_operator_list SQRT
+ BUILT_IN_SQRTF
+ BUILT_IN_SQRT
+ BUILT_IN_SQRTL
+ IFN_SQRT)
+
+ and:
+
+ (define_operator_list CABS
+ BUILT_IN_CABSF
+ BUILT_IN_CABS
+ BUILT_IN_CABSL
+ null) */
#include "bconfig.h"
#include "system.h"
@@ -89,6 +109,23 @@ print_case_cfn (const char *name, bool internal_p,
printf ("\n");
}
+/* Print an operator list for all combined functions related to NAME,
+ with the null-terminated list of suffixes in SUFFIXES. INTERNAL_P
+ says whether CFN_<NAME> also exists. */
+
+static void
+print_define_operator_list (const char *name, bool internal_p,
+ const char *const *suffixes)
+{
+ printf ("(define_operator_list %s\n", name);
+ for (unsigned int i = 0; suffixes[i]; ++i)
+ printf (" BUILT_IN_%s%s\n", name, suffixes[i]);
+ if (internal_p)
+ printf (" IFN_%s)\n", name);
+ else
+ printf (" null)\n");
+}
+
const char *const builtin_names[] = {
#define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) \
#ENUM,
@@ -126,9 +163,10 @@ main (int argc, char **argv)
progname = argv[0];
if (argc != 2
|| argv[1][0] != '-'
- || argv[1][1] != 'c'
+ || !strchr ("co", argv[1][1])
|| argv[1][2])
- fatal ("usage: %s -c > file", progname);
+ fatal ("usage: %s [-c|-o] > file", progname);
+ int type = argv[1][1];
/* Collect the set of built-in and internal functions. */
string_set builtins;
@@ -165,7 +203,11 @@ main (int argc, char **argv)
if (is_group (&builtins, root, suffix_lists[j]))
{
bool internal_p = internal_fns.contains (root);
- print_case_cfn (root, internal_p, suffix_lists[j]);
+ if (type == 'c')
+ print_case_cfn (root, internal_p, suffix_lists[j]);
+ else
+ print_define_operator_list (root, internal_p,
+ suffix_lists[j]);
}
}
}
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index cff32b0..7139476 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -4638,6 +4638,11 @@ main (int argc, char **argv)
cpp_callbacks *cb = cpp_get_callbacks (r);
cb->error = error_cb;
+ /* Add the build directory to the #include "" search path. */
+ cpp_dir *dir = XCNEW (cpp_dir);
+ dir->name = ASTRDUP (".");
+ cpp_set_include_chains (r, dir, NULL, false);
+
if (!cpp_read_main_file (r, input))
return 1;
cpp_define (r, gimple ? "GIMPLE=1": "GENERIC=1");
diff --git a/gcc/match.pd b/gcc/match.pd
index e8ccb85..1f9de49 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -47,10 +47,7 @@ along with GCC; see the file COPYING3. If not see
(define_operator_list simple_comparison lt le eq ne ge gt)
(define_operator_list swapped_simple_comparison gt ge eq ne le lt)
-/* Define an operand list for math function FN, with float, double and
- long double variants (in that order). */
-#define DEFINE_MATH_FN(FN) \
- (define_operator_list FN BUILT_IN_##FN##F BUILT_IN_##FN BUILT_IN_##FN##L)
+#include "cfn-operators.pd"
/* Define operand lists for math rounding functions {,i,l,ll}FN,
where the versions prefixed with "i" return an int, those prefixed with
@@ -62,10 +59,6 @@ along with GCC; see the file COPYING3. If not see
X<FN> for all double functions, in the same order
X<FN>L for all long double functions, in the same order. */
#define DEFINE_INT_AND_FLOAT_ROUND_FN(FN) \
- DEFINE_MATH_FN (FN) \
- DEFINE_MATH_FN (I##FN) \
- DEFINE_MATH_FN (L##FN) \
- DEFINE_MATH_FN (LL##FN) \
(define_operator_list X##FN##F BUILT_IN_I##FN##F \
BUILT_IN_L##FN##F \
BUILT_IN_LL##FN##F) \
@@ -76,39 +69,6 @@ along with GCC; see the file COPYING3. If not see
BUILT_IN_L##FN##L \
BUILT_IN_LL##FN##L)
-DEFINE_MATH_FN (LOG)
-DEFINE_MATH_FN (EXP)
-DEFINE_MATH_FN (LOG2)
-DEFINE_MATH_FN (EXP2)
-DEFINE_MATH_FN (LOG10)
-DEFINE_MATH_FN (EXP10)
-DEFINE_MATH_FN (POW)
-DEFINE_MATH_FN (POW10)
-DEFINE_MATH_FN (POWI)
-DEFINE_MATH_FN (SQRT)
-DEFINE_MATH_FN (CBRT)
-DEFINE_MATH_FN (SIN)
-DEFINE_MATH_FN (COS)
-DEFINE_MATH_FN (TAN)
-DEFINE_MATH_FN (ATAN)
-DEFINE_MATH_FN (COSH)
-DEFINE_MATH_FN (CEXP)
-DEFINE_MATH_FN (CEXPI)
-DEFINE_MATH_FN (CPROJ)
-DEFINE_MATH_FN (CCOS)
-DEFINE_MATH_FN (CCOSH)
-DEFINE_MATH_FN (HYPOT)
-DEFINE_MATH_FN (COPYSIGN)
-DEFINE_MATH_FN (CABS)
-DEFINE_MATH_FN (TRUNC)
-DEFINE_MATH_FN (NEARBYINT)
-DEFINE_MATH_FN (SIGNBIT)
-DEFINE_MATH_FN (FMIN)
-DEFINE_MATH_FN (FMAX)
-DEFINE_MATH_FN (LDEXP)
-DEFINE_MATH_FN (SCALBN)
-DEFINE_MATH_FN (SCALBLN)
-
DEFINE_INT_AND_FLOAT_ROUND_FN (FLOOR)
DEFINE_INT_AND_FLOAT_ROUND_FN (CEIL)
DEFINE_INT_AND_FLOAT_ROUND_FN (ROUND)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Replace match.pd DEFINE_MATH_FNs with auto-generated lists
2015-11-07 13:23 Replace match.pd DEFINE_MATH_FNs with auto-generated lists Richard Sandiford
@ 2015-11-10 11:24 ` Richard Biener
2015-11-10 20:13 ` Richard Sandiford
0 siblings, 1 reply; 6+ messages in thread
From: Richard Biener @ 2015-11-10 11:24 UTC (permalink / raw)
To: GCC Patches, richard.sandiford
On Sat, Nov 7, 2015 at 2:23 PM, Richard Sandiford
<richard.sandiford@arm.com> wrote:
> This patch autogenerates the operator lists for maths functions
> like SQRT, adding an additional entry for internal functions.
> E.g.:
>
> (define_operator_list SQRT
> BUILT_IN_SQRTF
> BUILT_IN_SQRT
> BUILT_IN_SQRTL
> IFN_SQRT)
>
> and:
>
> (define_operator_list CABS
> BUILT_IN_CABSF
> BUILT_IN_CABS
> BUILT_IN_CABSL
> null)
>
> (since there's no internal function for CABS).
>
> Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
> OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> * Makefile.in (MOSTLYCLEANFILES): Add cfn-operators.pd.
> (generated_files): Likewise.
> (s-cfn-operators, cfn-operators.pd): New rules.
> (s-match): Depend on cfn-operators.pd.
> * gencfn-macros.c: Expand comment to describe -o behavior.
> (print_define_operator_list): New function.
> (main): Accept -o. Call print_define_operator_list.
> * genmatch.c (main): Add "." to the include path.
> * match.pd (DEFINE_MATH_FN): Delete. Include cfn-operators.pd
> instead.
>
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 298bb38..a21aaf5 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -1566,7 +1566,7 @@ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
> tm-preds.h tm-constrs.h checksum-options gimple-match.c generic-match.c \
> tree-check.h min-insn-modes.c insn-modes.c insn-modes.h \
> genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \
> - case-cfn-macros.h \
> + case-cfn-macros.h cfn-operators.pd \
> xgcc$(exeext) cpp$(exeext) $(FULL_DRIVER_NAME) \
> $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
> $(SPECS) collect2$(exeext) gcc-ar$(exeext) gcc-nm$(exeext) \
> @@ -2252,6 +2252,14 @@ s-case-cfn-macros: build/gencfn-macros$(build_exeext)
> $(STAMP) s-case-cfn-macros
> case-cfn-macros.h: s-case-cfn-macros; @true
>
> +s-cfn-operators: build/gencfn-macros$(build_exeext)
> + $(RUN_GEN) build/gencfn-macros$(build_exeext) -o \
> + > tmp-cfn-operators.pd
> + $(SHELL) $(srcdir)/../move-if-change tmp-cfn-operators.pd \
> + cfn-operators.pd
> + $(STAMP) s-cfn-operators
> +cfn-operators.pd: s-cfn-operators; @true
> +
> target-hooks-def.h: s-target-hooks-def-h; @true
> # make sure that when we build info files, the used tm.texi is up to date.
> $(srcdir)/doc/tm.texi: s-tm-texi; @true
> @@ -2318,7 +2326,7 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
> gimple-match.c: s-match gimple-match-head.c ; @true
> generic-match.c: s-match generic-match-head.c ; @true
>
> -s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd
> +s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
> $(RUN_GEN) build/genmatch$(build_exeext) --gimple $(srcdir)/match.pd \
> > tmp-gimple-match.c
> $(RUN_GEN) build/genmatch$(build_exeext) --generic $(srcdir)/match.pd \
> @@ -2439,7 +2447,8 @@ generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \
> $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h \
> options.h target-hooks-def.h insn-opinit.h \
> common/common-target-hooks-def.h pass-instances.def \
> - c-family/c-target-hooks-def.h params.list case-cfn-macros.h
> + c-family/c-target-hooks-def.h params.list case-cfn-macros.h \
> + cfn-operators.pd
>
> #
> # How to compile object files to run on the build machine.
> diff --git a/gcc/gencfn-macros.c b/gcc/gencfn-macros.c
> index 5ee3af0..401c429 100644
> --- a/gcc/gencfn-macros.c
> +++ b/gcc/gencfn-macros.c
> @@ -40,7 +40,27 @@ along with GCC; see the file COPYING3. If not see
> case CFN_BUILT_IN_SQRTL:
> case CFN_SQRT:
>
> - The macros for groups with no internal function drop the last line. */
> + The macros for groups with no internal function drop the last line.
> +
> + When run with -o, the generator prints a similar list of
> + define_operator_list directives, for use by match.pd. Each operator
> + list starts with the built-in functions, in order of ascending type width.
> + This is followed by an entry for the internal function, or "null" if there
> + is no internal function for the group. For example:
> +
> + (define_operator_list SQRT
> + BUILT_IN_SQRTF
> + BUILT_IN_SQRT
> + BUILT_IN_SQRTL
> + IFN_SQRT)
> +
> + and:
> +
> + (define_operator_list CABS
> + BUILT_IN_CABSF
> + BUILT_IN_CABS
> + BUILT_IN_CABSL
> + null) */
>
> #include "bconfig.h"
> #include "system.h"
> @@ -89,6 +109,23 @@ print_case_cfn (const char *name, bool internal_p,
> printf ("\n");
> }
>
> +/* Print an operator list for all combined functions related to NAME,
> + with the null-terminated list of suffixes in SUFFIXES. INTERNAL_P
> + says whether CFN_<NAME> also exists. */
> +
> +static void
> +print_define_operator_list (const char *name, bool internal_p,
> + const char *const *suffixes)
> +{
> + printf ("(define_operator_list %s\n", name);
> + for (unsigned int i = 0; suffixes[i]; ++i)
> + printf (" BUILT_IN_%s%s\n", name, suffixes[i]);
> + if (internal_p)
> + printf (" IFN_%s)\n", name);
> + else
> + printf (" null)\n");
> +}
> +
> const char *const builtin_names[] = {
> #define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) \
> #ENUM,
> @@ -126,9 +163,10 @@ main (int argc, char **argv)
> progname = argv[0];
> if (argc != 2
> || argv[1][0] != '-'
> - || argv[1][1] != 'c'
> + || !strchr ("co", argv[1][1])
> || argv[1][2])
> - fatal ("usage: %s -c > file", progname);
> + fatal ("usage: %s [-c|-o] > file", progname);
> + int type = argv[1][1];
>
> /* Collect the set of built-in and internal functions. */
> string_set builtins;
> @@ -165,7 +203,11 @@ main (int argc, char **argv)
> if (is_group (&builtins, root, suffix_lists[j]))
> {
> bool internal_p = internal_fns.contains (root);
> - print_case_cfn (root, internal_p, suffix_lists[j]);
> + if (type == 'c')
> + print_case_cfn (root, internal_p, suffix_lists[j]);
> + else
> + print_define_operator_list (root, internal_p,
> + suffix_lists[j]);
> }
> }
> }
> diff --git a/gcc/genmatch.c b/gcc/genmatch.c
> index cff32b0..7139476 100644
> --- a/gcc/genmatch.c
> +++ b/gcc/genmatch.c
> @@ -4638,6 +4638,11 @@ main (int argc, char **argv)
> cpp_callbacks *cb = cpp_get_callbacks (r);
> cb->error = error_cb;
>
> + /* Add the build directory to the #include "" search path. */
> + cpp_dir *dir = XCNEW (cpp_dir);
> + dir->name = ASTRDUP (".");
> + cpp_set_include_chains (r, dir, NULL, false);
Does that work on non-UNIX hosts? I wonder if there is sth
better we can use by passing some -DXXX=... to the genmatch
build command from the Makefile?
Richard.
> +
> if (!cpp_read_main_file (r, input))
> return 1;
> cpp_define (r, gimple ? "GIMPLE=1": "GENERIC=1");
> diff --git a/gcc/match.pd b/gcc/match.pd
> index e8ccb85..1f9de49 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -47,10 +47,7 @@ along with GCC; see the file COPYING3. If not see
> (define_operator_list simple_comparison lt le eq ne ge gt)
> (define_operator_list swapped_simple_comparison gt ge eq ne le lt)
>
> -/* Define an operand list for math function FN, with float, double and
> - long double variants (in that order). */
> -#define DEFINE_MATH_FN(FN) \
> - (define_operator_list FN BUILT_IN_##FN##F BUILT_IN_##FN BUILT_IN_##FN##L)
> +#include "cfn-operators.pd"
>
> /* Define operand lists for math rounding functions {,i,l,ll}FN,
> where the versions prefixed with "i" return an int, those prefixed with
> @@ -62,10 +59,6 @@ along with GCC; see the file COPYING3. If not see
> X<FN> for all double functions, in the same order
> X<FN>L for all long double functions, in the same order. */
> #define DEFINE_INT_AND_FLOAT_ROUND_FN(FN) \
> - DEFINE_MATH_FN (FN) \
> - DEFINE_MATH_FN (I##FN) \
> - DEFINE_MATH_FN (L##FN) \
> - DEFINE_MATH_FN (LL##FN) \
> (define_operator_list X##FN##F BUILT_IN_I##FN##F \
> BUILT_IN_L##FN##F \
> BUILT_IN_LL##FN##F) \
> @@ -76,39 +69,6 @@ along with GCC; see the file COPYING3. If not see
> BUILT_IN_L##FN##L \
> BUILT_IN_LL##FN##L)
>
> -DEFINE_MATH_FN (LOG)
> -DEFINE_MATH_FN (EXP)
> -DEFINE_MATH_FN (LOG2)
> -DEFINE_MATH_FN (EXP2)
> -DEFINE_MATH_FN (LOG10)
> -DEFINE_MATH_FN (EXP10)
> -DEFINE_MATH_FN (POW)
> -DEFINE_MATH_FN (POW10)
> -DEFINE_MATH_FN (POWI)
> -DEFINE_MATH_FN (SQRT)
> -DEFINE_MATH_FN (CBRT)
> -DEFINE_MATH_FN (SIN)
> -DEFINE_MATH_FN (COS)
> -DEFINE_MATH_FN (TAN)
> -DEFINE_MATH_FN (ATAN)
> -DEFINE_MATH_FN (COSH)
> -DEFINE_MATH_FN (CEXP)
> -DEFINE_MATH_FN (CEXPI)
> -DEFINE_MATH_FN (CPROJ)
> -DEFINE_MATH_FN (CCOS)
> -DEFINE_MATH_FN (CCOSH)
> -DEFINE_MATH_FN (HYPOT)
> -DEFINE_MATH_FN (COPYSIGN)
> -DEFINE_MATH_FN (CABS)
> -DEFINE_MATH_FN (TRUNC)
> -DEFINE_MATH_FN (NEARBYINT)
> -DEFINE_MATH_FN (SIGNBIT)
> -DEFINE_MATH_FN (FMIN)
> -DEFINE_MATH_FN (FMAX)
> -DEFINE_MATH_FN (LDEXP)
> -DEFINE_MATH_FN (SCALBN)
> -DEFINE_MATH_FN (SCALBLN)
> -
> DEFINE_INT_AND_FLOAT_ROUND_FN (FLOOR)
> DEFINE_INT_AND_FLOAT_ROUND_FN (CEIL)
> DEFINE_INT_AND_FLOAT_ROUND_FN (ROUND)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Replace match.pd DEFINE_MATH_FNs with auto-generated lists
2015-11-10 11:24 ` Richard Biener
@ 2015-11-10 20:13 ` Richard Sandiford
2015-11-10 20:24 ` Richard Biener
0 siblings, 1 reply; 6+ messages in thread
From: Richard Sandiford @ 2015-11-10 20:13 UTC (permalink / raw)
To: Richard Biener; +Cc: GCC Patches
Richard Biener <richard.guenther@gmail.com> writes:
> On Sat, Nov 7, 2015 at 2:23 PM, Richard Sandiford
> <richard.sandiford@arm.com> wrote:
>> diff --git a/gcc/genmatch.c b/gcc/genmatch.c
>> index cff32b0..7139476 100644
>> --- a/gcc/genmatch.c
>> +++ b/gcc/genmatch.c
>> @@ -4638,6 +4638,11 @@ main (int argc, char **argv)
>> cpp_callbacks *cb = cpp_get_callbacks (r);
>> cb->error = error_cb;
>>
>> + /* Add the build directory to the #include "" search path. */
>> + cpp_dir *dir = XCNEW (cpp_dir);
>> + dir->name = ASTRDUP (".");
>> + cpp_set_include_chains (r, dir, NULL, false);
>
> Does that work on non-UNIX hosts?
Bah, hadn't thought about that.
> I wonder if there is sth
> better we can use by passing some -DXXX=... to the genmatch
> build command from the Makefile?
toplev.c has:
src_pwd = getpwd ();
if (!src_pwd)
src_pwd = ".";
where getpwd is a libiberty function. Maybe we can use that?
Thanks,
Richard
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Replace match.pd DEFINE_MATH_FNs with auto-generated lists
2015-11-10 20:13 ` Richard Sandiford
@ 2015-11-10 20:24 ` Richard Biener
2015-11-17 9:23 ` Richard Sandiford
0 siblings, 1 reply; 6+ messages in thread
From: Richard Biener @ 2015-11-10 20:24 UTC (permalink / raw)
To: Richard Sandiford; +Cc: GCC Patches
On November 10, 2015 9:13:25 PM GMT+01:00, Richard Sandiford <richard.sandiford@arm.com> wrote:
>Richard Biener <richard.guenther@gmail.com> writes:
>> On Sat, Nov 7, 2015 at 2:23 PM, Richard Sandiford
>> <richard.sandiford@arm.com> wrote:
>>> diff --git a/gcc/genmatch.c b/gcc/genmatch.c
>>> index cff32b0..7139476 100644
>>> --- a/gcc/genmatch.c
>>> +++ b/gcc/genmatch.c
>>> @@ -4638,6 +4638,11 @@ main (int argc, char **argv)
>>> cpp_callbacks *cb = cpp_get_callbacks (r);
>>> cb->error = error_cb;
>>>
>>> + /* Add the build directory to the #include "" search path. */
>>> + cpp_dir *dir = XCNEW (cpp_dir);
>>> + dir->name = ASTRDUP (".");
>>> + cpp_set_include_chains (r, dir, NULL, false);
>>
>> Does that work on non-UNIX hosts?
>
>Bah, hadn't thought about that.
>
>> I wonder if there is sth
>> better we can use by passing some -DXXX=... to the genmatch
>> build command from the Makefile?
>
>toplev.c has:
>
> src_pwd = getpwd ();
> if (!src_pwd)
> src_pwd = ".";
>
>where getpwd is a libiberty function. Maybe we can use that?
Looks like so.
Richard.
>Thanks,
>Richard
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Replace match.pd DEFINE_MATH_FNs with auto-generated lists
2015-11-10 20:24 ` Richard Biener
@ 2015-11-17 9:23 ` Richard Sandiford
2015-11-17 14:32 ` Richard Biener
0 siblings, 1 reply; 6+ messages in thread
From: Richard Sandiford @ 2015-11-17 9:23 UTC (permalink / raw)
To: Richard Biener; +Cc: GCC Patches
Richard Biener <richard.guenther@gmail.com> writes:
> On November 10, 2015 9:13:25 PM GMT+01:00, Richard Sandiford
> <richard.sandiford@arm.com> wrote:
>>Richard Biener <richard.guenther@gmail.com> writes:
>>> On Sat, Nov 7, 2015 at 2:23 PM, Richard Sandiford
>>> <richard.sandiford@arm.com> wrote:
>>>> diff --git a/gcc/genmatch.c b/gcc/genmatch.c
>>>> index cff32b0..7139476 100644
>>>> --- a/gcc/genmatch.c
>>>> +++ b/gcc/genmatch.c
>>>> @@ -4638,6 +4638,11 @@ main (int argc, char **argv)
>>>> cpp_callbacks *cb = cpp_get_callbacks (r);
>>>> cb->error = error_cb;
>>>>
>>>> + /* Add the build directory to the #include "" search path. */
>>>> + cpp_dir *dir = XCNEW (cpp_dir);
>>>> + dir->name = ASTRDUP (".");
>>>> + cpp_set_include_chains (r, dir, NULL, false);
>>>
>>> Does that work on non-UNIX hosts?
>>
>>Bah, hadn't thought about that.
>>
>>> I wonder if there is sth
>>> better we can use by passing some -DXXX=... to the genmatch
>>> build command from the Makefile?
>>
>>toplev.c has:
>>
>> src_pwd = getpwd ();
>> if (!src_pwd)
>> src_pwd = ".";
>>
>>where getpwd is a libiberty function. Maybe we can use that?
>
> Looks like so.
OK, here's the updated patch. Tested as before. OK to install?
Thanks,
Richard
gcc/
* Makefile.in (MOSTLYCLEANFILES): Add cfn-operators.pd.
(generated_files): Likewise.
(s-cfn-operators, cfn-operators.pd): New rules.
(s-match): Depend on cfn-operators.pd.
* gencfn-macros.c: Expand comment to describe -o behavior.
(print_define_operator_list): New function.
(main): Accept -o. Call print_define_operator_list.
* genmatch.c (main): Add the current directory to the include path.
* match.pd (DEFINE_MATH_FN): Delete. Include cfn-operators.pd
instead.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index ba8108d..0fd8d99 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1570,7 +1570,7 @@ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
tm-preds.h tm-constrs.h checksum-options gimple-match.c generic-match.c \
tree-check.h min-insn-modes.c insn-modes.c insn-modes.h \
genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \
- case-cfn-macros.h \
+ case-cfn-macros.h cfn-operators.pd \
xgcc$(exeext) cpp$(exeext) $(FULL_DRIVER_NAME) \
$(EXTRA_PROGRAMS) gcc-cross$(exeext) \
$(SPECS) collect2$(exeext) gcc-ar$(exeext) gcc-nm$(exeext) \
@@ -2256,6 +2256,14 @@ s-case-cfn-macros: build/gencfn-macros$(build_exeext)
$(STAMP) s-case-cfn-macros
case-cfn-macros.h: s-case-cfn-macros; @true
+s-cfn-operators: build/gencfn-macros$(build_exeext)
+ $(RUN_GEN) build/gencfn-macros$(build_exeext) -o \
+ > tmp-cfn-operators.pd
+ $(SHELL) $(srcdir)/../move-if-change tmp-cfn-operators.pd \
+ cfn-operators.pd
+ $(STAMP) s-cfn-operators
+cfn-operators.pd: s-cfn-operators; @true
+
target-hooks-def.h: s-target-hooks-def-h; @true
# make sure that when we build info files, the used tm.texi is up to date.
$(srcdir)/doc/tm.texi: s-tm-texi; @true
@@ -2322,7 +2330,7 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
gimple-match.c: s-match gimple-match-head.c ; @true
generic-match.c: s-match generic-match-head.c ; @true
-s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd
+s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
$(RUN_GEN) build/genmatch$(build_exeext) --gimple $(srcdir)/match.pd \
> tmp-gimple-match.c
$(RUN_GEN) build/genmatch$(build_exeext) --generic $(srcdir)/match.pd \
@@ -2443,7 +2451,8 @@ generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \
$(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h \
options.h target-hooks-def.h insn-opinit.h \
common/common-target-hooks-def.h pass-instances.def \
- c-family/c-target-hooks-def.h params.list case-cfn-macros.h
+ c-family/c-target-hooks-def.h params.list case-cfn-macros.h \
+ cfn-operators.pd
#\f
# How to compile object files to run on the build machine.
diff --git a/gcc/gencfn-macros.c b/gcc/gencfn-macros.c
index 5ee3af0..401c429 100644
--- a/gcc/gencfn-macros.c
+++ b/gcc/gencfn-macros.c
@@ -40,7 +40,27 @@ along with GCC; see the file COPYING3. If not see
case CFN_BUILT_IN_SQRTL:
case CFN_SQRT:
- The macros for groups with no internal function drop the last line. */
+ The macros for groups with no internal function drop the last line.
+
+ When run with -o, the generator prints a similar list of
+ define_operator_list directives, for use by match.pd. Each operator
+ list starts with the built-in functions, in order of ascending type width.
+ This is followed by an entry for the internal function, or "null" if there
+ is no internal function for the group. For example:
+
+ (define_operator_list SQRT
+ BUILT_IN_SQRTF
+ BUILT_IN_SQRT
+ BUILT_IN_SQRTL
+ IFN_SQRT)
+
+ and:
+
+ (define_operator_list CABS
+ BUILT_IN_CABSF
+ BUILT_IN_CABS
+ BUILT_IN_CABSL
+ null) */
#include "bconfig.h"
#include "system.h"
@@ -89,6 +109,23 @@ print_case_cfn (const char *name, bool internal_p,
printf ("\n");
}
+/* Print an operator list for all combined functions related to NAME,
+ with the null-terminated list of suffixes in SUFFIXES. INTERNAL_P
+ says whether CFN_<NAME> also exists. */
+
+static void
+print_define_operator_list (const char *name, bool internal_p,
+ const char *const *suffixes)
+{
+ printf ("(define_operator_list %s\n", name);
+ for (unsigned int i = 0; suffixes[i]; ++i)
+ printf (" BUILT_IN_%s%s\n", name, suffixes[i]);
+ if (internal_p)
+ printf (" IFN_%s)\n", name);
+ else
+ printf (" null)\n");
+}
+
const char *const builtin_names[] = {
#define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) \
#ENUM,
@@ -126,9 +163,10 @@ main (int argc, char **argv)
progname = argv[0];
if (argc != 2
|| argv[1][0] != '-'
- || argv[1][1] != 'c'
+ || !strchr ("co", argv[1][1])
|| argv[1][2])
- fatal ("usage: %s -c > file", progname);
+ fatal ("usage: %s [-c|-o] > file", progname);
+ int type = argv[1][1];
/* Collect the set of built-in and internal functions. */
string_set builtins;
@@ -165,7 +203,11 @@ main (int argc, char **argv)
if (is_group (&builtins, root, suffix_lists[j]))
{
bool internal_p = internal_fns.contains (root);
- print_case_cfn (root, internal_p, suffix_lists[j]);
+ if (type == 'c')
+ print_case_cfn (root, internal_p, suffix_lists[j]);
+ else
+ print_define_operator_list (root, internal_p,
+ suffix_lists[j]);
}
}
}
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 4df5689..3a20a48 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -4638,6 +4638,13 @@ main (int argc, char **argv)
cpp_callbacks *cb = cpp_get_callbacks (r);
cb->error = error_cb;
+ /* Add the build directory to the #include "" search path. */
+ cpp_dir *dir = XCNEW (cpp_dir);
+ dir->name = getpwd ();
+ if (!dir->name)
+ dir->name = ASTRDUP (".");
+ cpp_set_include_chains (r, dir, NULL, false);
+
if (!cpp_read_main_file (r, input))
return 1;
cpp_define (r, gimple ? "GIMPLE=1": "GENERIC=1");
diff --git a/gcc/match.pd b/gcc/match.pd
index 15bf2c9..e86cc8b 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -47,10 +47,7 @@ along with GCC; see the file COPYING3. If not see
(define_operator_list simple_comparison lt le eq ne ge gt)
(define_operator_list swapped_simple_comparison gt ge eq ne le lt)
-/* Define an operand list for math function FN, with float, double and
- long double variants (in that order). */
-#define DEFINE_MATH_FN(FN) \
- (define_operator_list FN BUILT_IN_##FN##F BUILT_IN_##FN BUILT_IN_##FN##L)
+#include "cfn-operators.pd"
/* Define operand lists for math rounding functions {,i,l,ll}FN,
where the versions prefixed with "i" return an int, those prefixed with
@@ -62,10 +59,6 @@ along with GCC; see the file COPYING3. If not see
X<FN> for all double functions, in the same order
X<FN>L for all long double functions, in the same order. */
#define DEFINE_INT_AND_FLOAT_ROUND_FN(FN) \
- DEFINE_MATH_FN (FN) \
- DEFINE_MATH_FN (I##FN) \
- DEFINE_MATH_FN (L##FN) \
- DEFINE_MATH_FN (LL##FN) \
(define_operator_list X##FN##F BUILT_IN_I##FN##F \
BUILT_IN_L##FN##F \
BUILT_IN_LL##FN##F) \
@@ -76,39 +69,6 @@ along with GCC; see the file COPYING3. If not see
BUILT_IN_L##FN##L \
BUILT_IN_LL##FN##L)
-DEFINE_MATH_FN (LOG)
-DEFINE_MATH_FN (EXP)
-DEFINE_MATH_FN (LOG2)
-DEFINE_MATH_FN (EXP2)
-DEFINE_MATH_FN (LOG10)
-DEFINE_MATH_FN (EXP10)
-DEFINE_MATH_FN (POW)
-DEFINE_MATH_FN (POW10)
-DEFINE_MATH_FN (POWI)
-DEFINE_MATH_FN (SQRT)
-DEFINE_MATH_FN (CBRT)
-DEFINE_MATH_FN (SIN)
-DEFINE_MATH_FN (COS)
-DEFINE_MATH_FN (TAN)
-DEFINE_MATH_FN (ATAN)
-DEFINE_MATH_FN (COSH)
-DEFINE_MATH_FN (CEXP)
-DEFINE_MATH_FN (CEXPI)
-DEFINE_MATH_FN (CPROJ)
-DEFINE_MATH_FN (CCOS)
-DEFINE_MATH_FN (CCOSH)
-DEFINE_MATH_FN (HYPOT)
-DEFINE_MATH_FN (COPYSIGN)
-DEFINE_MATH_FN (CABS)
-DEFINE_MATH_FN (TRUNC)
-DEFINE_MATH_FN (NEARBYINT)
-DEFINE_MATH_FN (SIGNBIT)
-DEFINE_MATH_FN (FMIN)
-DEFINE_MATH_FN (FMAX)
-DEFINE_MATH_FN (LDEXP)
-DEFINE_MATH_FN (SCALBN)
-DEFINE_MATH_FN (SCALBLN)
-
DEFINE_INT_AND_FLOAT_ROUND_FN (FLOOR)
DEFINE_INT_AND_FLOAT_ROUND_FN (CEIL)
DEFINE_INT_AND_FLOAT_ROUND_FN (ROUND)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Replace match.pd DEFINE_MATH_FNs with auto-generated lists
2015-11-17 9:23 ` Richard Sandiford
@ 2015-11-17 14:32 ` Richard Biener
0 siblings, 0 replies; 6+ messages in thread
From: Richard Biener @ 2015-11-17 14:32 UTC (permalink / raw)
To: Richard Biener, GCC Patches, richard.sandiford
On Tue, Nov 17, 2015 at 10:23 AM, Richard Sandiford
<richard.sandiford@arm.com> wrote:
> Richard Biener <richard.guenther@gmail.com> writes:
>> On November 10, 2015 9:13:25 PM GMT+01:00, Richard Sandiford
>> <richard.sandiford@arm.com> wrote:
>>>Richard Biener <richard.guenther@gmail.com> writes:
>>>> On Sat, Nov 7, 2015 at 2:23 PM, Richard Sandiford
>>>> <richard.sandiford@arm.com> wrote:
>>>>> diff --git a/gcc/genmatch.c b/gcc/genmatch.c
>>>>> index cff32b0..7139476 100644
>>>>> --- a/gcc/genmatch.c
>>>>> +++ b/gcc/genmatch.c
>>>>> @@ -4638,6 +4638,11 @@ main (int argc, char **argv)
>>>>> cpp_callbacks *cb = cpp_get_callbacks (r);
>>>>> cb->error = error_cb;
>>>>>
>>>>> + /* Add the build directory to the #include "" search path. */
>>>>> + cpp_dir *dir = XCNEW (cpp_dir);
>>>>> + dir->name = ASTRDUP (".");
>>>>> + cpp_set_include_chains (r, dir, NULL, false);
>>>>
>>>> Does that work on non-UNIX hosts?
>>>
>>>Bah, hadn't thought about that.
>>>
>>>> I wonder if there is sth
>>>> better we can use by passing some -DXXX=... to the genmatch
>>>> build command from the Makefile?
>>>
>>>toplev.c has:
>>>
>>> src_pwd = getpwd ();
>>> if (!src_pwd)
>>> src_pwd = ".";
>>>
>>>where getpwd is a libiberty function. Maybe we can use that?
>>
>> Looks like so.
>
> OK, here's the updated patch. Tested as before. OK to install?
Ok.
Thanks,
Richard.
> Thanks,
> Richard
>
>
> gcc/
> * Makefile.in (MOSTLYCLEANFILES): Add cfn-operators.pd.
> (generated_files): Likewise.
> (s-cfn-operators, cfn-operators.pd): New rules.
> (s-match): Depend on cfn-operators.pd.
> * gencfn-macros.c: Expand comment to describe -o behavior.
> (print_define_operator_list): New function.
> (main): Accept -o. Call print_define_operator_list.
> * genmatch.c (main): Add the current directory to the include path.
> * match.pd (DEFINE_MATH_FN): Delete. Include cfn-operators.pd
> instead.
>
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index ba8108d..0fd8d99 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -1570,7 +1570,7 @@ MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
> tm-preds.h tm-constrs.h checksum-options gimple-match.c generic-match.c \
> tree-check.h min-insn-modes.c insn-modes.c insn-modes.h \
> genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \
> - case-cfn-macros.h \
> + case-cfn-macros.h cfn-operators.pd \
> xgcc$(exeext) cpp$(exeext) $(FULL_DRIVER_NAME) \
> $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
> $(SPECS) collect2$(exeext) gcc-ar$(exeext) gcc-nm$(exeext) \
> @@ -2256,6 +2256,14 @@ s-case-cfn-macros: build/gencfn-macros$(build_exeext)
> $(STAMP) s-case-cfn-macros
> case-cfn-macros.h: s-case-cfn-macros; @true
>
> +s-cfn-operators: build/gencfn-macros$(build_exeext)
> + $(RUN_GEN) build/gencfn-macros$(build_exeext) -o \
> + > tmp-cfn-operators.pd
> + $(SHELL) $(srcdir)/../move-if-change tmp-cfn-operators.pd \
> + cfn-operators.pd
> + $(STAMP) s-cfn-operators
> +cfn-operators.pd: s-cfn-operators; @true
> +
> target-hooks-def.h: s-target-hooks-def-h; @true
> # make sure that when we build info files, the used tm.texi is up to date.
> $(srcdir)/doc/tm.texi: s-tm-texi; @true
> @@ -2322,7 +2330,7 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
> gimple-match.c: s-match gimple-match-head.c ; @true
> generic-match.c: s-match generic-match-head.c ; @true
>
> -s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd
> +s-match: build/genmatch$(build_exeext) $(srcdir)/match.pd cfn-operators.pd
> $(RUN_GEN) build/genmatch$(build_exeext) --gimple $(srcdir)/match.pd \
> > tmp-gimple-match.c
> $(RUN_GEN) build/genmatch$(build_exeext) --generic $(srcdir)/match.pd \
> @@ -2443,7 +2451,8 @@ generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \
> $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h \
> options.h target-hooks-def.h insn-opinit.h \
> common/common-target-hooks-def.h pass-instances.def \
> - c-family/c-target-hooks-def.h params.list case-cfn-macros.h
> + c-family/c-target-hooks-def.h params.list case-cfn-macros.h \
> + cfn-operators.pd
>
> #
> # How to compile object files to run on the build machine.
> diff --git a/gcc/gencfn-macros.c b/gcc/gencfn-macros.c
> index 5ee3af0..401c429 100644
> --- a/gcc/gencfn-macros.c
> +++ b/gcc/gencfn-macros.c
> @@ -40,7 +40,27 @@ along with GCC; see the file COPYING3. If not see
> case CFN_BUILT_IN_SQRTL:
> case CFN_SQRT:
>
> - The macros for groups with no internal function drop the last line. */
> + The macros for groups with no internal function drop the last line.
> +
> + When run with -o, the generator prints a similar list of
> + define_operator_list directives, for use by match.pd. Each operator
> + list starts with the built-in functions, in order of ascending type width.
> + This is followed by an entry for the internal function, or "null" if there
> + is no internal function for the group. For example:
> +
> + (define_operator_list SQRT
> + BUILT_IN_SQRTF
> + BUILT_IN_SQRT
> + BUILT_IN_SQRTL
> + IFN_SQRT)
> +
> + and:
> +
> + (define_operator_list CABS
> + BUILT_IN_CABSF
> + BUILT_IN_CABS
> + BUILT_IN_CABSL
> + null) */
>
> #include "bconfig.h"
> #include "system.h"
> @@ -89,6 +109,23 @@ print_case_cfn (const char *name, bool internal_p,
> printf ("\n");
> }
>
> +/* Print an operator list for all combined functions related to NAME,
> + with the null-terminated list of suffixes in SUFFIXES. INTERNAL_P
> + says whether CFN_<NAME> also exists. */
> +
> +static void
> +print_define_operator_list (const char *name, bool internal_p,
> + const char *const *suffixes)
> +{
> + printf ("(define_operator_list %s\n", name);
> + for (unsigned int i = 0; suffixes[i]; ++i)
> + printf (" BUILT_IN_%s%s\n", name, suffixes[i]);
> + if (internal_p)
> + printf (" IFN_%s)\n", name);
> + else
> + printf (" null)\n");
> +}
> +
> const char *const builtin_names[] = {
> #define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) \
> #ENUM,
> @@ -126,9 +163,10 @@ main (int argc, char **argv)
> progname = argv[0];
> if (argc != 2
> || argv[1][0] != '-'
> - || argv[1][1] != 'c'
> + || !strchr ("co", argv[1][1])
> || argv[1][2])
> - fatal ("usage: %s -c > file", progname);
> + fatal ("usage: %s [-c|-o] > file", progname);
> + int type = argv[1][1];
>
> /* Collect the set of built-in and internal functions. */
> string_set builtins;
> @@ -165,7 +203,11 @@ main (int argc, char **argv)
> if (is_group (&builtins, root, suffix_lists[j]))
> {
> bool internal_p = internal_fns.contains (root);
> - print_case_cfn (root, internal_p, suffix_lists[j]);
> + if (type == 'c')
> + print_case_cfn (root, internal_p, suffix_lists[j]);
> + else
> + print_define_operator_list (root, internal_p,
> + suffix_lists[j]);
> }
> }
> }
> diff --git a/gcc/genmatch.c b/gcc/genmatch.c
> index 4df5689..3a20a48 100644
> --- a/gcc/genmatch.c
> +++ b/gcc/genmatch.c
> @@ -4638,6 +4638,13 @@ main (int argc, char **argv)
> cpp_callbacks *cb = cpp_get_callbacks (r);
> cb->error = error_cb;
>
> + /* Add the build directory to the #include "" search path. */
> + cpp_dir *dir = XCNEW (cpp_dir);
> + dir->name = getpwd ();
> + if (!dir->name)
> + dir->name = ASTRDUP (".");
> + cpp_set_include_chains (r, dir, NULL, false);
> +
> if (!cpp_read_main_file (r, input))
> return 1;
> cpp_define (r, gimple ? "GIMPLE=1": "GENERIC=1");
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 15bf2c9..e86cc8b 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -47,10 +47,7 @@ along with GCC; see the file COPYING3. If not see
> (define_operator_list simple_comparison lt le eq ne ge gt)
> (define_operator_list swapped_simple_comparison gt ge eq ne le lt)
>
> -/* Define an operand list for math function FN, with float, double and
> - long double variants (in that order). */
> -#define DEFINE_MATH_FN(FN) \
> - (define_operator_list FN BUILT_IN_##FN##F BUILT_IN_##FN BUILT_IN_##FN##L)
> +#include "cfn-operators.pd"
>
> /* Define operand lists for math rounding functions {,i,l,ll}FN,
> where the versions prefixed with "i" return an int, those prefixed with
> @@ -62,10 +59,6 @@ along with GCC; see the file COPYING3. If not see
> X<FN> for all double functions, in the same order
> X<FN>L for all long double functions, in the same order. */
> #define DEFINE_INT_AND_FLOAT_ROUND_FN(FN) \
> - DEFINE_MATH_FN (FN) \
> - DEFINE_MATH_FN (I##FN) \
> - DEFINE_MATH_FN (L##FN) \
> - DEFINE_MATH_FN (LL##FN) \
> (define_operator_list X##FN##F BUILT_IN_I##FN##F \
> BUILT_IN_L##FN##F \
> BUILT_IN_LL##FN##F) \
> @@ -76,39 +69,6 @@ along with GCC; see the file COPYING3. If not see
> BUILT_IN_L##FN##L \
> BUILT_IN_LL##FN##L)
>
> -DEFINE_MATH_FN (LOG)
> -DEFINE_MATH_FN (EXP)
> -DEFINE_MATH_FN (LOG2)
> -DEFINE_MATH_FN (EXP2)
> -DEFINE_MATH_FN (LOG10)
> -DEFINE_MATH_FN (EXP10)
> -DEFINE_MATH_FN (POW)
> -DEFINE_MATH_FN (POW10)
> -DEFINE_MATH_FN (POWI)
> -DEFINE_MATH_FN (SQRT)
> -DEFINE_MATH_FN (CBRT)
> -DEFINE_MATH_FN (SIN)
> -DEFINE_MATH_FN (COS)
> -DEFINE_MATH_FN (TAN)
> -DEFINE_MATH_FN (ATAN)
> -DEFINE_MATH_FN (COSH)
> -DEFINE_MATH_FN (CEXP)
> -DEFINE_MATH_FN (CEXPI)
> -DEFINE_MATH_FN (CPROJ)
> -DEFINE_MATH_FN (CCOS)
> -DEFINE_MATH_FN (CCOSH)
> -DEFINE_MATH_FN (HYPOT)
> -DEFINE_MATH_FN (COPYSIGN)
> -DEFINE_MATH_FN (CABS)
> -DEFINE_MATH_FN (TRUNC)
> -DEFINE_MATH_FN (NEARBYINT)
> -DEFINE_MATH_FN (SIGNBIT)
> -DEFINE_MATH_FN (FMIN)
> -DEFINE_MATH_FN (FMAX)
> -DEFINE_MATH_FN (LDEXP)
> -DEFINE_MATH_FN (SCALBN)
> -DEFINE_MATH_FN (SCALBLN)
> -
> DEFINE_INT_AND_FLOAT_ROUND_FN (FLOOR)
> DEFINE_INT_AND_FLOAT_ROUND_FN (CEIL)
> DEFINE_INT_AND_FLOAT_ROUND_FN (ROUND)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-11-17 14:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-07 13:23 Replace match.pd DEFINE_MATH_FNs with auto-generated lists Richard Sandiford
2015-11-10 11:24 ` Richard Biener
2015-11-10 20:13 ` Richard Sandiford
2015-11-10 20:24 ` Richard Biener
2015-11-17 9:23 ` Richard Sandiford
2015-11-17 14:32 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).