diff gcc/gencfn-macros.c @ 132:d34655255c78

update gcc-8.2
author mir3636
date Thu, 25 Oct 2018 10:21:07 +0900
parents 84e7813d76e9
children 1830386684a0
line wrap: on
line diff
--- a/gcc/gencfn-macros.c	Thu Oct 25 08:08:40 2018 +0900
+++ b/gcc/gencfn-macros.c	Thu Oct 25 10:21:07 2018 +0900
@@ -1,5 +1,5 @@
 /* Generate macros based on the combined_fn enum.
-   Copyright (C) 2015-2017 Free Software Foundation, Inc.
+   Copyright (C) 2015-2018 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -94,30 +94,37 @@
 
 /* Print a macro for all combined functions related to NAME, with the
    null-terminated list of suffixes in SUFFIXES.  INTERNAL_P says whether
-   CFN_<NAME> also exists.  */
+   CFN_<NAME> also exists.  FLOATN_P is a suffix to the operator name, blank
+   for normal operators, "_FN" for _Float<N>/_Float<N>X operators only, and
+   "_ALL" for both the traditional operators and the _Float<N>/_Float<N>X
+   operators.  */
 
 static void
 print_case_cfn (const char *name, bool internal_p,
-		const char *const *suffixes)
+		const char *const *suffixes, const char *floatn)
 {
-  printf ("#define CASE_CFN_%s", name);
+  printf ("#define CASE_CFN_%s%s", name, floatn);
   if (internal_p)
-    printf (" \\\n  case CFN_%s", name);
+    printf (" \\\n  case CFN_%s%s", name, floatn);
   for (unsigned int i = 0; suffixes[i]; ++i)
     printf ("%s \\\n  case CFN_BUILT_IN_%s%s",
 	    internal_p || i > 0 ? ":" : "", name, suffixes[i]);
   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.  */
+/* 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.  FLOATN_P is a suffix to the operator name, blank
+   for normal operators, "_FN" for _Float<N>/_Float<N>X operators only, and
+   "_ALL" for both the traditional operators and the _Float<N>/_Float<N>X
+   operators.  */
 
 static void
 print_define_operator_list (const char *name, bool internal_p,
-			    const char *const *suffixes)
+			    const char *const *suffixes,
+			    const char *floatn)
 {
-  printf ("(define_operator_list %s\n", name);
+  printf ("(define_operator_list %s%s\n", name, floatn);
   for (unsigned int i = 0; suffixes[i]; ++i)
     printf ("    BUILT_IN_%s%s\n", name, suffixes[i]);
   if (internal_p)
@@ -148,6 +155,11 @@
 };
 
 static const char *const flt_suffixes[] = { "F", "", "L", NULL };
+static const char *const fltfn_suffixes[] = { "F16", "F32", "F64", "F128",
+					      "F32X", "F64X", "F128X", NULL };
+static const char *const fltall_suffixes[] = { "F", "", "L", "F16", "F32",
+					       "F64", "F128", "F32X", "F64X",
+					       "F128X", NULL };
 static const char *const int_suffixes[] = { "", "L", "LL", "IMAX", NULL };
 
 static const char *const *const suffix_lists[] = {
@@ -200,15 +212,42 @@
 	{
 	  const char *root = name + 9;
 	  for (unsigned int j = 0; suffix_lists[j]; ++j)
-	    if (is_group (&builtins, root, suffix_lists[j]))
-	      {
-		bool internal_p = internal_fns.contains (root);
-		if (type == 'c')
-		  print_case_cfn (root, internal_p, suffix_lists[j]);
-		else
-		  print_define_operator_list (root, internal_p,
-					      suffix_lists[j]);
-	      }
+	    {
+	      const char *const *const suffix = suffix_lists[j];
+
+	      if (is_group (&builtins, root, suffix))
+		{
+		  bool internal_p = internal_fns.contains (root);
+
+		  if (type == 'c')
+		    print_case_cfn (root, internal_p, suffix, "");
+		  else
+		    print_define_operator_list (root, internal_p, suffix, "");
+
+		      /* Support the _Float<N> and _Float<N>X math functions if
+			 they exist.  We put these out as a separate CFN or
+			 operator macro, so code can add support or not as
+			 needed.  We also put out a combined CFN or operator
+			 macro that includes both the traditional names and the
+			 _Float<N> and _Float<N>X versions.  */
+		  if (suffix == flt_suffixes
+		      && is_group (&builtins, root, fltfn_suffixes))
+		    {
+		      if (type == 'c')
+			{
+			  print_case_cfn (root, false, fltfn_suffixes, "_FN");
+			  print_case_cfn (root, false, fltall_suffixes, "_ALL");
+			}
+		      else
+			{
+			  print_define_operator_list (root, false,
+						      fltfn_suffixes, "_FN");
+			  print_define_operator_list (root, internal_p,
+						      fltall_suffixes, "_ALL");
+			}
+		    }
+		}
+	    }
 	}
     }