public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 2 of 3
@ 2021-06-15 17:17 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-06-15 17:17 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e8fd0020eda67aeeb7ba628a48a02ad29cfac607

commit e8fd0020eda67aeeb7ba628a48a02ad29cfac607
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Mon Jun 7 14:48:31 2021 -0500

    rs6000: Write output to the builtins init file, part 2 of 3
    
    2021-06-07  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-gen-builtins.c (write_init_bif_table):
            Implement.

Diff:
---
 gcc/config/rs6000/rs6000-gen-builtins.c | 81 +++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 2240dfc030f..a261da88097 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2238,6 +2238,87 @@ write_header_file (void)
 static void
 write_init_bif_table (void)
 {
+  for (int i = 0; i <= curr_bif; i++)
+    {
+      fprintf (init_file,
+	       "  rs6000_builtin_info_x[RS6000_BIF_%s].fntype"
+	       "\n    = %s;\n",
+	       bifs[i].idname, bifs[i].fndecl);
+
+      /* Check whether we have a "tf" token in this string, representing
+	 a float128_type_node.  It's possible that float128_type_node is
+	 undefined (occurs for -maltivec -mno-vsx, for example), so we
+	 must guard against that.  */
+      int tf_found = strstr (bifs[i].fndecl, "tf") != NULL;
+
+      /* Similarly, look for decimal float tokens.  */
+      int dfp_found = (strstr (bifs[i].fndecl, "dd") != NULL
+		       || strstr (bifs[i].fndecl, "td") != NULL
+		       || strstr (bifs[i].fndecl, "sd") != NULL);
+
+      fprintf (init_file,
+	       "  if (new_builtins_are_live)\n");
+      fprintf (init_file, "    {\n");
+
+      if (tf_found)
+	{
+	  fprintf (init_file, "      if (float128_type_node)\n");
+	  fprintf (init_file, "        {\n");
+	}
+      else if (dfp_found)
+	{
+	  fprintf (init_file, "      if (dfloat64_type_node)\n");
+	  fprintf (init_file, "        {\n");
+	}
+
+      fprintf (init_file,
+	       "      rs6000_builtin_decls_x[(int)RS6000_BIF_%s] = t\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "        = add_builtin_function (\"%s\",\n",
+	       bifs[i].proto.bifname);
+      fprintf (init_file,
+	       "                                %s,\n",
+	       bifs[i].fndecl);
+      fprintf (init_file,
+	       "                                (int)RS6000_BIF_%s,"
+	       " BUILT_IN_MD,\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "                                NULL, NULL_TREE);\n");
+      if (bifs[i].kind == FNK_CONST)
+	{
+	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_PURE)
+	{
+	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_FPMATH)
+	{
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	  fprintf (init_file, "      if (flag_rounding_math)\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        TREE_READONLY (t) = 1;\n");
+	}
+
+      if (tf_found || dfp_found)
+	{
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          rs6000_builtin_decls_x"
+		   "[(int)RS6000_BIF_%s] = NULL_TREE;\n", bifs[i].idname);
+	  fprintf (init_file, "        }\n");
+	}
+      fprintf (init_file, "    }\n\n");
+    }
 }
 
 /* Write code to initialize the overload table.  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 2 of 3
@ 2021-06-25 16:16 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-06-25 16:16 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:107f994be1c1f2c40963df468429e332c458e45f

commit 107f994be1c1f2c40963df468429e332c458e45f
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Mon Jun 7 14:48:31 2021 -0500

    rs6000: Write output to the builtins init file, part 2 of 3
    
    2021-06-07  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-gen-builtins.c (write_init_bif_table):
            Implement.

Diff:
---
 gcc/config/rs6000/rs6000-gen-builtins.c | 81 +++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 2240dfc030f..a261da88097 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2238,6 +2238,87 @@ write_header_file (void)
 static void
 write_init_bif_table (void)
 {
+  for (int i = 0; i <= curr_bif; i++)
+    {
+      fprintf (init_file,
+	       "  rs6000_builtin_info_x[RS6000_BIF_%s].fntype"
+	       "\n    = %s;\n",
+	       bifs[i].idname, bifs[i].fndecl);
+
+      /* Check whether we have a "tf" token in this string, representing
+	 a float128_type_node.  It's possible that float128_type_node is
+	 undefined (occurs for -maltivec -mno-vsx, for example), so we
+	 must guard against that.  */
+      int tf_found = strstr (bifs[i].fndecl, "tf") != NULL;
+
+      /* Similarly, look for decimal float tokens.  */
+      int dfp_found = (strstr (bifs[i].fndecl, "dd") != NULL
+		       || strstr (bifs[i].fndecl, "td") != NULL
+		       || strstr (bifs[i].fndecl, "sd") != NULL);
+
+      fprintf (init_file,
+	       "  if (new_builtins_are_live)\n");
+      fprintf (init_file, "    {\n");
+
+      if (tf_found)
+	{
+	  fprintf (init_file, "      if (float128_type_node)\n");
+	  fprintf (init_file, "        {\n");
+	}
+      else if (dfp_found)
+	{
+	  fprintf (init_file, "      if (dfloat64_type_node)\n");
+	  fprintf (init_file, "        {\n");
+	}
+
+      fprintf (init_file,
+	       "      rs6000_builtin_decls_x[(int)RS6000_BIF_%s] = t\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "        = add_builtin_function (\"%s\",\n",
+	       bifs[i].proto.bifname);
+      fprintf (init_file,
+	       "                                %s,\n",
+	       bifs[i].fndecl);
+      fprintf (init_file,
+	       "                                (int)RS6000_BIF_%s,"
+	       " BUILT_IN_MD,\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "                                NULL, NULL_TREE);\n");
+      if (bifs[i].kind == FNK_CONST)
+	{
+	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_PURE)
+	{
+	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_FPMATH)
+	{
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	  fprintf (init_file, "      if (flag_rounding_math)\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        TREE_READONLY (t) = 1;\n");
+	}
+
+      if (tf_found || dfp_found)
+	{
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          rs6000_builtin_decls_x"
+		   "[(int)RS6000_BIF_%s] = NULL_TREE;\n", bifs[i].idname);
+	  fprintf (init_file, "        }\n");
+	}
+      fprintf (init_file, "    }\n\n");
+    }
 }
 
 /* Write code to initialize the overload table.  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 2 of 3
@ 2021-04-26 20:49 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-04-26 20:49 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0dec08d895316bfc2cb3e6aeacc6db594de7efa3

commit 0dec08d895316bfc2cb3e6aeacc6db594de7efa3
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Wed Mar 3 17:11:00 2021 -0600

    rs6000: Write output to the builtins init file, part 2 of 3
    
    2021-03-03  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-gen-builtins.c (write_init_bif_table):
            Implement.

Diff:
---
 gcc/config/rs6000/rs6000-gen-builtins.c | 71 +++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 28810f56ec2..82c0567756b 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2272,6 +2272,77 @@ write_header_file ()
 static void
 write_init_bif_table ()
 {
+  for (int i = 0; i <= curr_bif; i++)
+    {
+      fprintf (init_file,
+	       "  rs6000_builtin_info_x[RS6000_BIF_%s].fntype"
+	       "\n    = %s;\n",
+	       bifs[i].idname, bifs[i].fndecl);
+
+      /* Check whether we have a "tf" token in this string, representing
+	 a float128_type_node.  It's possible that float128_type_node is
+	 undefined (occurs for -maltivec -mno-vsx, for example), so we
+	 must guard against that.  */
+      int tf_found = strstr (bifs[i].fndecl, "tf") != NULL;
+
+      fprintf (init_file,
+	       "  if (new_builtins_are_live)\n");
+      fprintf (init_file, "    {\n");
+
+      if (tf_found)
+	{
+	  fprintf (init_file, "      if (float128_type_node)\n");
+	  fprintf (init_file, "        {\n");
+	}
+
+      fprintf (init_file,
+	       "      rs6000_builtin_decls_x[(int)RS6000_BIF_%s] = t\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "        = add_builtin_function (\"%s\",\n",
+	       bifs[i].proto.bifname);
+      fprintf (init_file,
+	       "                                %s,\n",
+	       bifs[i].fndecl);
+      fprintf (init_file,
+	       "                                (int)RS6000_BIF_%s,"
+	       " BUILT_IN_MD,\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "                                NULL, NULL_TREE);\n");
+      if (bifs[i].kind == FNK_CONST)
+	{
+	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_PURE)
+	{
+	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_FPMATH)
+	{
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	  fprintf (init_file, "      if (flag_rounding_math)\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        TREE_READONLY (t) = 1;\n");
+	}
+
+      if (tf_found)
+	{
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          rs6000_builtin_decls_x"
+		   "[(int)RS6000_BIF_%s] = NULL_TREE;\n", bifs[i].idname);
+	  fprintf (init_file, "        }\n");
+	}
+      fprintf (init_file, "    }\n\n");
+    }
 }
 
 /* Write code to initialize the overload table.  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 2 of 3
@ 2021-04-02 22:10 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-04-02 22:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:18fc5fb0854c236bf414adf175d8c33ca63d7be1

commit 18fc5fb0854c236bf414adf175d8c33ca63d7be1
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Wed Mar 3 17:11:00 2021 -0600

    rs6000: Write output to the builtins init file, part 2 of 3
    
    2021-03-03  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-gen-builtins.c (write_init_bif_table):
            Implement.

Diff:
---
 gcc/config/rs6000/rs6000-gen-builtins.c | 71 +++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 28810f56ec2..82c0567756b 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2272,6 +2272,77 @@ write_header_file ()
 static void
 write_init_bif_table ()
 {
+  for (int i = 0; i <= curr_bif; i++)
+    {
+      fprintf (init_file,
+	       "  rs6000_builtin_info_x[RS6000_BIF_%s].fntype"
+	       "\n    = %s;\n",
+	       bifs[i].idname, bifs[i].fndecl);
+
+      /* Check whether we have a "tf" token in this string, representing
+	 a float128_type_node.  It's possible that float128_type_node is
+	 undefined (occurs for -maltivec -mno-vsx, for example), so we
+	 must guard against that.  */
+      int tf_found = strstr (bifs[i].fndecl, "tf") != NULL;
+
+      fprintf (init_file,
+	       "  if (new_builtins_are_live)\n");
+      fprintf (init_file, "    {\n");
+
+      if (tf_found)
+	{
+	  fprintf (init_file, "      if (float128_type_node)\n");
+	  fprintf (init_file, "        {\n");
+	}
+
+      fprintf (init_file,
+	       "      rs6000_builtin_decls_x[(int)RS6000_BIF_%s] = t\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "        = add_builtin_function (\"%s\",\n",
+	       bifs[i].proto.bifname);
+      fprintf (init_file,
+	       "                                %s,\n",
+	       bifs[i].fndecl);
+      fprintf (init_file,
+	       "                                (int)RS6000_BIF_%s,"
+	       " BUILT_IN_MD,\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "                                NULL, NULL_TREE);\n");
+      if (bifs[i].kind == FNK_CONST)
+	{
+	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_PURE)
+	{
+	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_FPMATH)
+	{
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	  fprintf (init_file, "      if (flag_rounding_math)\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        TREE_READONLY (t) = 1;\n");
+	}
+
+      if (tf_found)
+	{
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          rs6000_builtin_decls_x"
+		   "[(int)RS6000_BIF_%s] = NULL_TREE;\n", bifs[i].idname);
+	  fprintf (init_file, "        }\n");
+	}
+      fprintf (init_file, "    }\n\n");
+    }
 }
 
 /* Write code to initialize the overload table.  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 2 of 3
@ 2021-04-01 19:48 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-04-01 19:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9e37111cbe45aaa334937f664b109f6c1cd9f361

commit 9e37111cbe45aaa334937f664b109f6c1cd9f361
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Wed Mar 3 17:11:00 2021 -0600

    rs6000: Write output to the builtins init file, part 2 of 3
    
    2021-03-03  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-gen-builtins.c (write_init_bif_table):
            Implement.

Diff:
---
 gcc/config/rs6000/rs6000-gen-builtins.c | 71 +++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index ef4a070340d..9395820b6c2 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2271,6 +2271,77 @@ write_header_file ()
 static void
 write_init_bif_table ()
 {
+  for (int i = 0; i <= curr_bif; i++)
+    {
+      fprintf (init_file,
+	       "  rs6000_builtin_info_x[RS6000_BIF_%s].fntype"
+	       "\n    = %s;\n",
+	       bifs[i].idname, bifs[i].fndecl);
+
+      /* Check whether we have a "tf" token in this string, representing
+	 a float128_type_node.  It's possible that float128_type_node is
+	 undefined (occurs for -maltivec -mno-vsx, for example), so we
+	 must guard against that.  */
+      int tf_found = strstr (bifs[i].fndecl, "tf") != NULL;
+
+      fprintf (init_file,
+	       "  if (new_builtins_are_live)\n");
+      fprintf (init_file, "    {\n");
+
+      if (tf_found)
+	{
+	  fprintf (init_file, "      if (float128_type_node)\n");
+	  fprintf (init_file, "        {\n");
+	}
+
+      fprintf (init_file,
+	       "      rs6000_builtin_decls_x[(int)RS6000_BIF_%s] = t\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "        = add_builtin_function (\"%s\",\n",
+	       bifs[i].proto.bifname);
+      fprintf (init_file,
+	       "                                %s,\n",
+	       bifs[i].fndecl);
+      fprintf (init_file,
+	       "                                (int)RS6000_BIF_%s,"
+	       " BUILT_IN_MD,\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "                                NULL, NULL_TREE);\n");
+      if (bifs[i].kind == FNK_CONST)
+	{
+	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_PURE)
+	{
+	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_FPMATH)
+	{
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	  fprintf (init_file, "      if (flag_rounding_math)\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        TREE_READONLY (t) = 1;\n");
+	}
+
+      if (tf_found)
+	{
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          rs6000_builtin_decls_x"
+		   "[(int)RS6000_BIF_%s] = NULL_TREE;\n", bifs[i].idname);
+	  fprintf (init_file, "        }\n");
+	}
+      fprintf (init_file, "    }\n\n");
+    }
 }
 
 /* Write code to initialize the overload table.  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 2 of 3
@ 2021-03-25 15:46 William Schmidt
  0 siblings, 0 replies; 6+ messages in thread
From: William Schmidt @ 2021-03-25 15:46 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:aaec08a433a74c19a47848081d865d95a6d1175a

commit aaec08a433a74c19a47848081d865d95a6d1175a
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Wed Mar 3 17:11:00 2021 -0600

    rs6000: Write output to the builtins init file, part 2 of 3
    
    2021-03-03  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-gen-builtins.c (write_init_bif_table):
            Implement.

Diff:
---
 gcc/config/rs6000/rs6000-gen-builtins.c | 71 +++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 097c3cf08f5..93589750ee7 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2271,6 +2271,77 @@ write_header_file ()
 static void
 write_init_bif_table ()
 {
+  for (int i = 0; i <= curr_bif; i++)
+    {
+      fprintf (init_file,
+	       "  rs6000_builtin_info_x[RS6000_BIF_%s].fntype"
+	       "\n    = %s;\n",
+	       bifs[i].idname, bifs[i].fndecl);
+
+      /* Check whether we have a "tf" token in this string, representing
+	 a float128_type_node.  It's possible that float128_type_node is
+	 undefined (occurs for -maltivec -mno-vsx, for example), so we
+	 must guard against that.  */
+      int tf_found = strstr (bifs[i].fndecl, "tf") != NULL;
+
+      fprintf (init_file,
+	       "  if (new_builtins_are_live)\n");
+      fprintf (init_file, "    {\n");
+
+      if (tf_found)
+	{
+	  fprintf (init_file, "      if (float128_type_node)\n");
+	  fprintf (init_file, "        {\n");
+	}
+
+      fprintf (init_file,
+	       "      rs6000_builtin_decls_x[(int)RS6000_BIF_%s] = t\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "        = add_builtin_function (\"%s\",\n",
+	       bifs[i].proto.bifname);
+      fprintf (init_file,
+	       "                                %s,\n",
+	       bifs[i].fndecl);
+      fprintf (init_file,
+	       "                                (int)RS6000_BIF_%s,"
+	       " BUILT_IN_MD,\n",
+	       bifs[i].idname);
+      fprintf (init_file,
+	       "                                NULL, NULL_TREE);\n");
+      if (bifs[i].kind == FNK_CONST)
+	{
+	  fprintf (init_file, "      TREE_READONLY (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_PURE)
+	{
+	  fprintf (init_file, "      DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	}
+      else if (bifs[i].kind == FNK_FPMATH)
+	{
+	  fprintf (init_file, "      TREE_NOTHROW (t) = 1;\n");
+	  fprintf (init_file, "      if (flag_rounding_math)\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          DECL_PURE_P (t) = 1;\n");
+	  fprintf (init_file, "          DECL_IS_NOVOPS (t) = 1;\n");
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        TREE_READONLY (t) = 1;\n");
+	}
+
+      if (tf_found)
+	{
+	  fprintf (init_file, "        }\n");
+	  fprintf (init_file, "      else\n");
+	  fprintf (init_file, "        {\n");
+	  fprintf (init_file, "          rs6000_builtin_decls_x"
+		   "[(int)RS6000_BIF_%s] = NULL_TREE;\n", bifs[i].idname);
+	  fprintf (init_file, "        }\n");
+	}
+      fprintf (init_file, "    }\n\n");
+    }
 }
 
 /* Write code to initialize the overload table.  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-25 16:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 17:17 [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Write output to the builtins init file, part 2 of 3 William Schmidt
  -- strict thread matches above, loose matches on Subject: below --
2021-06-25 16:16 William Schmidt
2021-04-26 20:49 William Schmidt
2021-04-02 22:10 William Schmidt
2021-04-01 19:48 William Schmidt
2021-03-25 15:46 William Schmidt

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).