On Thu, Sep 18, 2014 at 11:12:15AM +0100, Richard Earnshaw wrote: > On 18/09/14 10:53, James Greenhalgh wrote: > > +$(srcdir)/config/aarch64/aarch64-builtin-iterators.h: > > $(srcdir)/config/aarch64/geniterators.sh \ > > + $(srcdir)/config/aarch64/iterators.md > > + $(SHELL) $(srcdir)/config/aarch64/geniterators.sh \ > > + $(srcdir)/config/aarch64/iterators.md > \ > > + $(srcdir)/config/aarch64/aarch64-builtin-iterators.h > > + > > aarch-common.o: $(srcdir)/config/arm/aarch-common.c $(CONFIG_H) > > $(SYSTEM_H) \ > > coretypes.h $(TM_H) $(TM_P_H) $(RTL_H) $(TREE_H) output.h $(C_COMMON_H) > > $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ > > > > Is there any real need to write this into the source directory and have > the built file checked in? Ie. can't we always write to the build > directory and use it from there. That avoids problems if the sources > are on a read-only filesystem. > > If we do need to leave it in the sources, then contrib/update_gcc should > be taught how to touch the generated file when resyncing from the > repositories. >
I thought I had tried this and failed to make it work. I must not have been trying hard enough at the time. Updated as attached, generating the header in the build directory. It looks much better this way! Bootstrapped on aarch64-none-linux-gnueabi with no issues. Ok? Thanks, James --- gcc/ 2014-09-22 James Greenhalgh <james.greenha...@arm.com> * config/aarch64/geniterators.sh: New. * config/aarch64/iterators.md (VDQF_DF): New. * config/aarch64/t-aarch64: Generate aarch64-builtin-iterators.h. * config/aarch64/aarch64-builtins.c (BUILTIN_*) Remove.
diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c index 6a77d29..6b9c383 100644 --- a/gcc/config/aarch64/aarch64-builtins.c +++ b/gcc/config/aarch64/aarch64-builtins.c @@ -313,91 +313,7 @@ typedef struct VAR11 (T, N, MAP, A, B, C, D, E, F, G, H, I, J, K) \ VAR1 (T, N, MAP, L) -/* BUILTIN_<ITERATOR> macros should expand to cover the same range of - modes as is given for each define_mode_iterator in - config/aarch64/iterators.md. */ - -#define BUILTIN_DX(T, N, MAP) \ - VAR2 (T, N, MAP, di, df) -#define BUILTIN_GPF(T, N, MAP) \ - VAR2 (T, N, MAP, sf, df) -#define BUILTIN_SDQ_I(T, N, MAP) \ - VAR4 (T, N, MAP, qi, hi, si, di) -#define BUILTIN_SD_HSI(T, N, MAP) \ - VAR2 (T, N, MAP, hi, si) -#define BUILTIN_V2F(T, N, MAP) \ - VAR2 (T, N, MAP, v2sf, v2df) -#define BUILTIN_VALL(T, N, MAP) \ - VAR10 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, \ - v4si, v2di, v2sf, v4sf, v2df) -#define BUILTIN_VALLDI(T, N, MAP) \ - VAR11 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, \ - v4si, v2di, v2sf, v4sf, v2df, di) -#define BUILTIN_VALLDIF(T, N, MAP) \ - VAR12 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, \ - v4si, v2di, v2sf, v4sf, v2df, di, df) -#define BUILTIN_VB(T, N, MAP) \ - VAR2 (T, N, MAP, v8qi, v16qi) -#define BUILTIN_VD1(T, N, MAP) \ - VAR5 (T, N, MAP, v8qi, v4hi, v2si, v2sf, v1df) -#define BUILTIN_VDC(T, N, MAP) \ - VAR6 (T, N, MAP, v8qi, v4hi, v2si, v2sf, di, df) -#define BUILTIN_VDIC(T, N, MAP) \ - VAR3 (T, N, MAP, v8qi, v4hi, v2si) -#define BUILTIN_VDN(T, N, MAP) \ - VAR3 (T, N, MAP, v4hi, v2si, di) -#define BUILTIN_VDQ(T, N, MAP) \ - VAR7 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, v4si, v2di) -#define BUILTIN_VDQF(T, N, MAP) \ - VAR3 (T, N, MAP, v2sf, v4sf, v2df) -#define BUILTIN_VDQF_DF(T, N, MAP) \ - VAR4 (T, N, MAP, v2sf, v4sf, v2df, df) -#define BUILTIN_VDQH(T, N, MAP) \ - VAR2 (T, N, MAP, v4hi, v8hi) -#define BUILTIN_VDQHS(T, N, MAP) \ - VAR4 (T, N, MAP, v4hi, v8hi, v2si, v4si) -#define BUILTIN_VDQIF(T, N, MAP) \ - VAR9 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, v4si, v2sf, v4sf, v2df) -#define BUILTIN_VDQM(T, N, MAP) \ - VAR6 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, v4si) -#define BUILTIN_VDQV(T, N, MAP) \ - VAR5 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v4si) -#define BUILTIN_VDQQH(T, N, MAP) \ - VAR4 (T, N, MAP, v8qi, v16qi, v4hi, v8hi) -#define BUILTIN_VDQ_BHSI(T, N, MAP) \ - VAR6 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, v4si) -#define BUILTIN_VDQ_I(T, N, MAP) \ - VAR7 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, v4si, v2di) -#define BUILTIN_VDW(T, N, MAP) \ - VAR3 (T, N, MAP, v8qi, v4hi, v2si) -#define BUILTIN_VD_BHSI(T, N, MAP) \ - VAR3 (T, N, MAP, v8qi, v4hi, v2si) -#define BUILTIN_VD_HSI(T, N, MAP) \ - VAR2 (T, N, MAP, v4hi, v2si) -#define BUILTIN_VQ(T, N, MAP) \ - VAR6 (T, N, MAP, v16qi, v8hi, v4si, v2di, v4sf, v2df) -#define BUILTIN_VQN(T, N, MAP) \ - VAR3 (T, N, MAP, v8hi, v4si, v2di) -#define BUILTIN_VQW(T, N, MAP) \ - VAR3 (T, N, MAP, v16qi, v8hi, v4si) -#define BUILTIN_VQ_HSI(T, N, MAP) \ - VAR2 (T, N, MAP, v8hi, v4si) -#define BUILTIN_VQ_S(T, N, MAP) \ - VAR6 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, v4si) -#define BUILTIN_VSDQ_HSI(T, N, MAP) \ - VAR6 (T, N, MAP, v4hi, v8hi, v2si, v4si, hi, si) -#define BUILTIN_VSDQ_I(T, N, MAP) \ - VAR11 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, v4si, v2di, qi, hi, si, di) -#define BUILTIN_VSDQ_I_BHSI(T, N, MAP) \ - VAR10 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, v4si, v2di, qi, hi, si) -#define BUILTIN_VSDQ_I_DI(T, N, MAP) \ - VAR8 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, v4si, v2di, di) -#define BUILTIN_VSD_HSI(T, N, MAP) \ - VAR4 (T, N, MAP, v4hi, v2si, hi, si) -#define BUILTIN_VSQN_HSDI(T, N, MAP) \ - VAR6 (T, N, MAP, v8hi, v4si, v2di, hi, si, di) -#define BUILTIN_VSTRUCT(T, N, MAP) \ - VAR3 (T, N, MAP, oi, ci, xi) +#include "aarch64-builtin-iterators.h" static aarch64_simd_builtin_datum aarch64_simd_builtin_data[] = { #include "aarch64-simd-builtins.def" @@ -1482,40 +1398,6 @@ aarch64_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update) #undef AARCH64_CHECK_BUILTIN_MODE #undef AARCH64_FIND_FRINT_VARIANT -#undef BUILTIN_DX -#undef BUILTIN_SDQ_I -#undef BUILTIN_SD_HSI -#undef BUILTIN_V2F -#undef BUILTIN_VALL -#undef BUILTIN_VB -#undef BUILTIN_VD1 -#undef BUILTIN_VDC -#undef BUILTIN_VDIC -#undef BUILTIN_VDN -#undef BUILTIN_VDQ -#undef BUILTIN_VDQF -#undef BUILTIN_VDQH -#undef BUILTIN_VDQHS -#undef BUILTIN_VDQIF -#undef BUILTIN_VDQM -#undef BUILTIN_VDQV -#undef BUILTIN_VDQ_BHSI -#undef BUILTIN_VDQ_I -#undef BUILTIN_VDW -#undef BUILTIN_VD_BHSI -#undef BUILTIN_VD_HSI -#undef BUILTIN_VQ -#undef BUILTIN_VQN -#undef BUILTIN_VQW -#undef BUILTIN_VQ_HSI -#undef BUILTIN_VQ_S -#undef BUILTIN_VSDQ_HSI -#undef BUILTIN_VSDQ_I -#undef BUILTIN_VSDQ_I_BHSI -#undef BUILTIN_VSDQ_I_DI -#undef BUILTIN_VSD_HSI -#undef BUILTIN_VSQN_HSDI -#undef BUILTIN_VSTRUCT #undef CF0 #undef CF1 #undef CF2 diff --git a/gcc/config/aarch64/geniterators.sh b/gcc/config/aarch64/geniterators.sh new file mode 100755 index 0000000..a5bd690 --- /dev/null +++ b/gcc/config/aarch64/geniterators.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Copyright (C) 2014 Free Software Foundation, Inc. +# Contributed by ARM Ltd. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Generate aarch64-builtin-iterators.h, a file containing a series of +# BUILTIN_<ITERATOR> macros, which expand to VAR<N> Macros covering the +# same set of modes as the iterator in iterators.md + +echo "/* -*- buffer-read-only: t -*- */" +echo "/* Generated automatically by geniterators.sh from iterators.md. */" +echo "#ifndef GCC_AARCH64_ITERATORS_H" +echo "#define GCC_AARCH64_ITERATORS_H" + +# Strip newlines, create records marked ITERATOR, and strip junk (anything +# which does not have a matching brace because it contains characters we +# don't want to or can't handle (e.g P, PTR iterators change depending on +# Pmode and ptr_mode). +cat $1 | tr "\n" " " \ + | sed 's/(define_mode_iterator \([A-Za-z0-9_]*\) \([]\[A-Z0-9 \t]*\)/\n#define BUILTIN_\1(T, N, MAP) \\ \2\n/g' \ + | grep '#define [A-Z0-9_(), \\]* \[[A-Z0-9[:space:]]*]' \ + | sed 's/\t//g' \ + | sed 's/ \+/ /g' \ + | sed 's/ \[\([A-Z0-9 ]*\)]/\n\L\1/' \ + | awk ' BEGIN { FS = " " ; OFS = ", "} \ + /#/ { print } \ + ! /#/ { $1 = $1 ; printf " VAR%d (T, N, MAP, %s)\n", NF, $0 }' + +echo "#endif /* GCC_AARCH64_ITERATORS_H */" diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index 5ecb8e5d82519ab4f2cfb58b49b60c3656a5637f..daa5d9f70963208bec31f749e760b7324f579513 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -95,6 +95,9 @@ (define_mode_iterator PTR [(SI "ptr_mode ;; Vector Float modes. (define_mode_iterator VDQF [V2SF V4SF V2DF]) +;; Vector Float modes, and DF. +(define_mode_iterator VDQF_DF [V2SF V4SF V2DF DF]) + ;; Vector single Float modes. (define_mode_iterator VDQSF [V2SF V4SF]) diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64 index 158fbb5..ea2b3e9 100644 --- a/gcc/config/aarch64/t-aarch64 +++ b/gcc/config/aarch64/t-aarch64 @@ -31,10 +31,17 @@ aarch64-builtins.o: $(srcdir)/config/aarch64/aarch64-builtins.c $(CONFIG_H) \ $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(TREE_H) expr.h $(TM_P_H) $(RECOG_H) langhooks.h \ $(DIAGNOSTIC_CORE_H) $(OPTABS_H) \ - $(srcdir)/config/aarch64/aarch64-simd-builtins.def + $(srcdir)/config/aarch64/aarch64-simd-builtins.def \ + aarch64-builtin-iterators.h $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/aarch64/aarch64-builtins.c +aarch64-builtin-iterators.h: $(srcdir)/config/aarch64/geniterators.sh \ + $(srcdir)/config/aarch64/iterators.md + $(SHELL) $(srcdir)/config/aarch64/geniterators.sh \ + $(srcdir)/config/aarch64/iterators.md > \ + aarch64-builtin-iterators.h + aarch-common.o: $(srcdir)/config/arm/aarch-common.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TM_H) $(TM_P_H) $(RTL_H) $(TREE_H) output.h $(C_COMMON_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \