[RFC] Moving TM builtin creation to the machine independent parts of the compiler

Michael Meissner meissner@linux.vnet.ibm.com
Fri Sep 25 20:52:00 GMT 2009


As we were discussing Thursday on IRC, the powerpc port doesn't set up the
attributes correctly for the builtin functions.  Richard Henderson suggested
making the backend builtin creation to use the same infrastructure as the
normal builtins, so that we can use the types and attributes for the builtins.

I was wondering if the following work in progress is what was suggested.
Basically, it allows the target machine to define a set of *.def files that are
handled inside of builtins.def and builtin-types.def and builtin-attrs.def.
Right now, I don't anticipate needing to do the attributes, but I figure to put
in the support in case some other backend needs it.

This patch creates tm-builtins-headers.def, tm-builtins-types.def, and
tm-builtins-attrs.def in the build directory to include the various tm builtin
files.  At the moment, I'm including one builtin, before tackling the 900 or so
powerpc builtins.

I suspect I should use the s-* and moveifchange mecanism in the Makefile.

-- 
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com
-------------- next part --------------
2009-09-25  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* configure.ac: Add support for the target machine to add header
	files that define builtins, builtin types, and builtin attributes.
	* configure: Regenerate.

	* builtin-attrs.def (tm-builtin-attrs.def): Include to pick up
	target machine builtin attributes.

	* builtin-types.def (tm-builtin-types.def): Include to pick up
	target machine builtin types.

	* builtins.def (DEF_MD_BUILTIN): New macro to define target
	machine builtins.
	(tm-builtin-headers.def): Include to pick up target machine
	builtin functions.

	* config.gcc (powerpc*-*-*, rs6000*-*-*): Add the powerpc/rs6000
	builtin files.

	* Makefile.in (TM_BUILTIN_HEADERS_DEF): New list of files that
	define TM builtin functions.
	(TM_BUILTIN_TYPES_DEF): New list of files that define TM builtin
	types.
	(TM_BUILTIN_ATTRS_DEF): New list of files that define TM builtin
	attributes.
	(BUILTINS_DEF): Add dependencies for target machine builtins.
	(c-common.o): Add dependencies for target machine builtin types
	and attributes.
	(tm-builtin-*): Build the include files of the target machine
	builtin functions, types, and attributes.
	(mostlyclean): Delete the tm-builtin files.

	* config/rs6000/builtins-vec.def: Stub file for now.
	* config/rs6000/builtins-types.def: Ditto.
	* config/rs6000/builtins-paired.def: Ditto.
	* config/rs6000/builtins-vsx.def: Ditto.
	* config/rs6000/builtins-spe.def: Ditto.

	* config/rs6000/rs6000.c (rs6000_debug_reg_global): Print the
	number of normal and powerpc builtins.
	(rs6000_init_builtins): Move __builtin_bpermd creation to
	builtins-misc.def.

	* config/rs6000/rs6000.h (enum rs6000_builtins): Move
	POWER7_BUILTIN_BPERMD to builtins-misc.def.

	* config/rs6000/builtins-misc.def: New file.  Define the bpermpd
	builtin.

Index: configure
===================================================================
--- configure	(revision 152141)
+++ configure	(working copy)
@@ -782,6 +782,9 @@ extra_programs
 extra_passes
 extra_parts
 extra_objs
+builtin_attrs_list
+builtin_types_list
+builtin_headers_list
 extra_headers_list
 extra_gcc_objs
 TM_MULTILIB_EXCEPTIONS_CONFIG
@@ -11049,6 +11052,22 @@ if test x"$use_gcc_tgmath" = xyes
 then extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/tgmath.h"
 fi
 
+# expand builtin_headers, builtin_types, builtin_attrs
+builtin_headers_list=
+for file in ${builtin_headers} ; do
+  builtin_headers_list="${builtin_headers_list} config/${cpu_type}/${file}"
+done
+
+builtin_attrs_list=
+for file in ${builtin_attrs} ; do
+  builtin_attrs_list="${builtin_attrs_list} config/${cpu_type}/${file}"
+done
+
+builtin_types_list=
+for file in ${builtin_types} ; do
+  builtin_types_list="${builtin_types_list} config/${cpu_type}/${file}"
+done
+
 # Define collect2 in Makefile.
 case $host_can_use_collect2 in
   no) collect2= ;;
@@ -11565,13 +11584,13 @@ if test "${lt_cv_nm_interface+set}" = se
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:11568: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:11587: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:11571: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:11590: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:11574: output\"" >&5)
+  (eval echo "\"\$as_me:11593: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -12776,7 +12795,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 12779 "configure"' > conftest.$ac_ext
+  echo '#line 12798 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -14436,11 +14455,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14439: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14458: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14443: \$? = $ac_status" >&5
+   echo "$as_me:14462: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -14775,11 +14794,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14778: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14797: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14782: \$? = $ac_status" >&5
+   echo "$as_me:14801: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -14880,11 +14899,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14883: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14902: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14887: \$? = $ac_status" >&5
+   echo "$as_me:14906: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -14935,11 +14954,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14938: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14957: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14942: \$? = $ac_status" >&5
+   echo "$as_me:14961: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -17317,7 +17336,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17320 "configure"
+#line 17339 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17413,7 +17432,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17416 "configure"
+#line 17435 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19369,11 +19388,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19372: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19391: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:19376: \$? = $ac_status" >&5
+   echo "$as_me:19395: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -19468,11 +19487,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19471: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19490: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:19475: \$? = $ac_status" >&5
+   echo "$as_me:19494: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -19520,11 +19539,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19523: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19542: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:19527: \$? = $ac_status" >&5
+   echo "$as_me:19546: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -24867,6 +24886,9 @@ fi
 
 
 
+
+
+
 # Echo link setup.
 if test x${build} = x${host} ; then
   if test x${host} = x${target} ; then
Index: builtin-attrs.def
===================================================================
--- builtin-attrs.def	(revision 152141)
+++ builtin-attrs.def	(working copy)
@@ -200,3 +200,5 @@ DEF_FORMAT_ARG_ATTRIBUTE(1)
 DEF_FORMAT_ARG_ATTRIBUTE(2)
 #undef DEF_FORMAT_ARG_ATTRIBUTE
 
+/* Target machine attributes.  */
+#include "tm-builtin-attrs.def"
Index: builtin-types.def
===================================================================
--- builtin-types.def	(revision 152141)
+++ builtin-types.def	(working copy)
@@ -473,3 +473,6 @@ DEF_FUNCTION_TYPE_VAR_5 (BT_FN_INT_INT_I
 DEF_POINTER_TYPE (BT_PTR_FN_VOID_VAR, BT_FN_VOID_VAR)
 DEF_FUNCTION_TYPE_3 (BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE,
 		     BT_PTR, BT_PTR_FN_VOID_VAR, BT_PTR, BT_SIZE)
+
+/* Target machine types.  */
+#include "tm-builtin-types.def"
Index: builtins.def
===================================================================
--- builtins.def	(revision 152141)
+++ builtins.def	(working copy)
@@ -142,6 +142,14 @@ along with GCC; see the file COPYING3.  
                false, true, true, ATTRS, false, \
 	       (flag_openmp || flag_tree_parallelize_loops))
 
+/* A target machine specific builtin is provided by the
+   compiler, but does not correspond to a function in the standard
+   library.  */
+#undef DEF_MD_BUILTIN
+#define DEF_MD_BUILTIN(ENUM, NAME, TYPE, ATTRS, COND)	\
+  DEF_BUILTIN (ENUM, NAME, BUILT_IN_MD, TYPE, BT_LAST,	\
+	       false, false, false, ATTRS, false, COND)
+
 /* Define an attribute list for math functions that are normally
    "impure" because some of them may write into global memory for
    `errno'.  If !flag_errno_math they are instead "const".  */
@@ -770,3 +778,6 @@ DEF_BUILTIN_STUB (BUILT_IN_EH_COPY_VALUE
 
 /* OpenMP builtins.  */
 #include "omp-builtins.def"
+
+/* Target machine builtins.  */
+#include "tm-builtin-headers.def"
Index: configure.ac
===================================================================
--- configure.ac	(revision 152141)
+++ configure.ac	(working copy)
@@ -1791,6 +1791,22 @@ if test x"$use_gcc_tgmath" = xyes
 then extra_headers_list="${extra_headers_list} \$(srcdir)/ginclude/tgmath.h"
 fi
 
+# expand builtin_headers, builtin_types, builtin_attrs
+builtin_headers_list=
+for file in ${builtin_headers} ; do
+  builtin_headers_list="${builtin_headers_list} config/${cpu_type}/${file}"
+done
+
+builtin_attrs_list=
+for file in ${builtin_attrs} ; do
+  builtin_attrs_list="${builtin_attrs_list} config/${cpu_type}/${file}"
+done
+
+builtin_types_list=
+for file in ${builtin_types} ; do
+  builtin_types_list="${builtin_types_list} config/${cpu_type}/${file}"
+done
+
 # Define collect2 in Makefile.
 case $host_can_use_collect2 in
   no) collect2= ;;
@@ -4130,6 +4146,9 @@ AC_SUBST(TM_MULTILIB_CONFIG)
 AC_SUBST(TM_MULTILIB_EXCEPTIONS_CONFIG)
 AC_SUBST(extra_gcc_objs)
 AC_SUBST(extra_headers_list)
+AC_SUBST(builtin_headers_list)
+AC_SUBST(builtin_types_list)
+AC_SUBST(builtin_attrs_list)
 AC_SUBST(extra_objs)
 AC_SUBST(extra_parts)
 AC_SUBST(extra_passes)
Index: ChangeLog.power7
===================================================================
--- ChangeLog.power7	(revision 152142)
+++ ChangeLog.power7	(working copy)
@@ -1,3 +1,53 @@
+2009-09-25  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+	* configure.ac: Add support for the target machine to add header
+	files that define builtins, builtin types, and builtin attributes.
+	* configure: Regenerate.
+
+	* builtin-attrs.def (tm-builtin-attrs.def): Include to pick up
+	target machine builtin attributes.
+
+	* builtin-types.def (tm-builtin-types.def): Include to pick up
+	target machine builtin types.
+
+	* builtins.def (DEF_MD_BUILTIN): New macro to define target
+	machine builtins.
+	(tm-builtin-headers.def): Include to pick up target machine
+	builtin functions.
+
+	* config.gcc (powerpc*-*-*, rs6000*-*-*): Add the powerpc/rs6000
+	builtin files.
+
+	* Makefile.in (TM_BUILTIN_HEADERS_DEF): New list of files that
+	define TM builtin functions.
+	(TM_BUILTIN_TYPES_DEF): New list of files that define TM builtin
+	types.
+	(TM_BUILTIN_ATTRS_DEF): New list of files that define TM builtin
+	attributes.
+	(BUILTINS_DEF): Add dependencies for target machine builtins.
+	(c-common.o): Add dependencies for target machine builtin types
+	and attributes.
+	(tm-builtin-*): Build the include files of the target machine
+	builtin functions, types, and attributes.
+	(mostlyclean): Delete the tm-builtin files.
+
+	* config/rs6000/builtins-vec.def: Stub file for now.
+	* config/rs6000/builtins-types.def: Ditto.
+	* config/rs6000/builtins-paired.def: Ditto.
+	* config/rs6000/builtins-vsx.def: Ditto.
+	* config/rs6000/builtins-spe.def: Ditto.
+
+	* config/rs6000/rs6000.c (rs6000_debug_reg_global): Print the
+	number of normal and powerpc builtins.
+	(rs6000_init_builtins): Move __builtin_bpermd creation to
+	builtins-misc.def.
+
+	* config/rs6000/rs6000.h (enum rs6000_builtins): Move
+	POWER7_BUILTIN_BPERMD to builtins-misc.def.
+
+	* config/rs6000/builtins-misc.def: New file.  Define the bpermpd
+	builtin.
+
 2009-09-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
 	Merge up to 152141.  VSX load/store with update moved to
Index: config.gcc
===================================================================
--- config.gcc	(revision 152141)
+++ config.gcc	(working copy)
@@ -101,6 +101,15 @@
 #  extra_headers	List of used header files from the directory
 #			config/${cpu_type}.
 #
+#  builtin_headers	List of the header files in config/${cpu_type} that
+#			define new builtin functions.
+#
+#  builtin_types	List of the header files in config/${cpu_type} that
+#			define new types for builtin functions.
+#
+#  builtin_attrs	List of the header files in config/${cpu_type} that
+#			define new attributes for builtin functions.
+#
 #  use_gcc_tgmath	If set, add tgmath.h to the list of used header
 #			files.
 #
@@ -248,6 +257,9 @@ esac
 tm_p_file=
 cpu_type=`echo ${target} | sed 's/-.*$//'`
 cpu_is_64bit=
+builtin_headers=
+builtin_types=
+builtin_attrs=
 case ${target} in
 m32c*-*-*)
         cpu_type=m32c
@@ -326,6 +338,8 @@ powerpc*-*-*)
 	cpu_type=rs6000
 	extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h"
 	need_64bit_hwint=yes
+	builtin_headers="builtins-altivec.def builtins-vsx.def builtins-vec.def builtins-spe.def builtins-paired.def builtins-misc.def"
+	builtin_types="builtins-types.def"
 	case x$with_cpu in
 	    xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[34567]|xpower6x|xrs64a|xcell)
 		cpu_is_64bit=yes
@@ -334,6 +348,8 @@ powerpc*-*-*)
 	;;
 rs6000*-*-*)
 	need_64bit_hwint=yes
+	builtin_headers="builtins-altivec.def builtins-vsx.def builtins-vec.def builtins-spe.def builtins-paired.def builtins-misc.def"
+	builtin_types="builtins-types.def"
 	;;
 score*-*-*)
 	cpu_type=score
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 152141)
+++ Makefile.in	(working copy)
@@ -839,7 +839,11 @@ RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H)
 FIXED_VALUE_H = fixed-value.h $(MACHMODE_H) double-int.h
 RTL_H = $(RTL_BASE_H) genrtl.h
 PARAMS_H = params.h params.def
-BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def
+TM_BUILTIN_HEADERS_DEF = @builtin_headers_list@
+TM_BUILTIN_TYPES_DEF = @builtin_types_list@
+TM_BUILTIN_ATTRS_DEF = @builtin_attrs_list@
+BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def tm-builtin-headers.def \
+	$(TM_BUILTIN_HEADERS_DEF)
 TREE_H = tree.h all-tree.def tree.def c-common.def $(lang_tree_files) \
           $(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \
           $(INPUT_H) statistics.h vec.h treestruct.def $(HASHTAB_H) \
@@ -1995,7 +1999,8 @@ c-common.o : c-common.c $(CONFIG_H) $(SY
 	$(TARGET_H) $(C_TREE_H) tree-iterator.h langhooks.h tree-mudflap.h \
 	intl.h opts.h $(REAL_H) $(CPPLIB_H) $(TREE_INLINE_H) $(HASHTAB_H) \
 	$(BUILTINS_DEF) $(CGRAPH_H) $(BASIC_BLOCK_H) $(TARGET_DEF_H) \
-	$(GIMPLE_H) libfuncs.h
+	$(GIMPLE_H) libfuncs.h tm-builtin-types.def tm-builtin-attrs.def \
+	$(TM_BUILTIN_TYPES_DEF) $(TM_BUILTIN_ATTRS_DEF)
 
 c-pretty-print.o : c-pretty-print.c $(C_PRETTY_PRINT_H) \
 	$(C_TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(REAL_H) \
@@ -3704,6 +3709,25 @@ GCOV_DUMP_OBJS = gcov-dump.o version.o e
 gcov-dump$(exeext): $(GCOV_DUMP_OBJS) $(LIBDEPS)
 	$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_DUMP_OBJS) \
 		$(LIBS) -o $@
+
+
+# Built the tm specific builtin headers.
+tm-builtin-headers.def: $(TM_BUILTIN_HEADERS_DEF)
+	rm -rf tm-builtins-headers.def; \
+	echo "/* target machine builtin functions */" > tm-builtin-headers.def; \
+	for x in $(TM_BUILTIN_HEADERS_DEF); do echo "#include \"$${x}\"" >> tm-builtin-headers.def; done
+
+tm-builtin-types.def: $(TM_BUILTIN_TYPES_DEF)
+	rm -rf tm-builtin-types.def; \
+	echo "/* target machine builtin types */" > tm-builtin-types.def; \
+	for x in $(TM_BUILTIN_TYPES_DEF); do echo "#include \"$${x}\"" >> tm-builtin-types.def; done
+
+tm-builtin-attrs.def: $(TM_BUILTIN_ATTRS_DEF)
+	rm -rf tm-builtin-attrs.def; \
+	echo "/* target machine builtin attributes */" > tm-builtin-attrs.def; \
+	for x in $(TM_BUILTIN_ATTRS_DEF); do echo "#include \"$${x}\"" >> tm-builtin-attrs.def; done
+
+
 #
 # Build the include directories.  The stamp files are stmp-* rather than
 # s-* so that mostlyclean does not force the include directory to
@@ -4062,7 +4086,7 @@ mostlyclean: lang.mostlyclean
 # Delete debugging dump files.
 	-rm -f *.[0-9][0-9].* */*.[0-9][0-9].*
 # Delete some files made during installation.
-	-rm -f specs $(SPECS)
+	-rm -f specs $(SPECS) tm-builtin*.def
 	-rm -f collect collect2 mips-tfile mips-tdump
 # Delete unwanted output files from TeX.
 	-rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
Index: config/rs6000/builtins-vec.def
===================================================================
Index: config/rs6000/builtins-types.def
===================================================================
Index: config/rs6000/builtins-paired.def
===================================================================
Index: config/rs6000/builtins-vsx.def
===================================================================
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c	(revision 152141)
+++ config/rs6000/rs6000.c	(working copy)
@@ -1780,11 +1780,15 @@ rs6000_debug_reg_global (void)
 	   "align_branch_targets            = %s\n"
 	   "sched_restricted_insns_priority = %d\n"
 	   "sched_costly_dep                = %s\n"
-	   "sched_insert_nops               = %s\n\n",
+	   "sched_insert_nops               = %s\n"
+	   "# of rs6000 builtins            = %d\n"
+	   "# of standard builtins          = %d\n\n",
 	   rs6000_always_hint ? "true" : "false",
 	   rs6000_align_branch_targets ? "true" : "false",
 	   (int)rs6000_sched_restricted_insns_priority,
-	   costly_str, nop_str);
+	   costly_str, nop_str,
+	   (int)RS6000_BUILTIN_COUNT,
+	   (int)END_BUILTINS);
 }
 
 /* Initialize the various global tables that are based on register size.  */
@@ -11118,15 +11122,6 @@ rs6000_init_builtins (void)
 		   RS6000_BUILTIN_RECIP);
 
     }
-  if (TARGET_POPCNTD)
-    {
-      enum machine_mode mode = (TARGET_64BIT) ? DImode : SImode;
-      tree ftype = builtin_function_type (mode, mode, mode, VOIDmode,
-					  POWER7_BUILTIN_BPERMD,
-					  "__builtin_bpermd");
-      def_builtin (MASK_POPCNTD, "__builtin_bpermd", ftype,
-		   POWER7_BUILTIN_BPERMD);
-    }
   if (TARGET_POWERPC)
     {
       /* Don't use builtin_function_type here, as it maps HI/QI to SI.  */
Index: config/rs6000/rs6000.h
===================================================================
--- config/rs6000/rs6000.h	(revision 152141)
+++ config/rs6000/rs6000.h	(working copy)
@@ -3364,9 +3364,6 @@ enum rs6000_builtins
   VECTOR_BUILTIN_FIX_V4SF_V4SI,
   VECTOR_BUILTIN_FIXUNS_V4SF_V4SI,
 
-  /* Power7 builtins, that aren't VSX instructions.  */
-  POWER7_BUILTIN_BPERMD,
-
   RS6000_BUILTIN_COUNT
 };
 
Index: config/rs6000/builtins-spe.def
===================================================================
Index: config/rs6000/builtins-misc.def
===================================================================
--- config/rs6000/builtins-misc.def	(revision 0)
+++ config/rs6000/builtins-misc.def	(revision 0)
@@ -0,0 +1,32 @@
+/* Definitions of miscellaneous builtins for the RS/6000
+   Copyright (C) 2009
+   Free Software Foundation, Inc.
+   Contributed by Michael Meissner (meissner@linux.vnet.ibm.com)
+
+   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.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Power7 builtins, that aren't VSX instructions.  */
+DEF_MD_BUILTIN(POWER7_BUILTIN_BPERMD,
+	"__builtin_bpermd",
+	BT_FN_LONG_LONG_LONG,
+	ATTR_CONST_NOTHROW_LIST,
+	TARGET_POPCNTD && TARGET_64BIT)
Index: config/rs6000/builtins-altivec.def
===================================================================


More information about the Gcc-patches mailing list