[16/55] rs6000: Write output to the builtin definition include file

Message ID 1e0b1c8cc10ba52b1de242b92391e28b78530e04.1623941441.git.wschmidt@linux.ibm.com
State New
Headers show
Series
  • Replace the Power target-specific builtin machinery
Related show

Commit Message

Jeff Law via Gcc-patches June 17, 2021, 3:19 p.m.
2021-06-07  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-gen-builtins.c (write_defines_file):
	Implement.
---
 gcc/config/rs6000/rs6000-gen-builtins.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

-- 
2.27.0

Comments

Segher Boessenkool July 20, 2021, 11:27 p.m. | #1
On Thu, Jun 17, 2021 at 10:19:00AM -0500, Bill Schmidt wrote:
> 2021-06-07  Bill Schmidt  <wschmidt@linux.ibm.com>

> 

> gcc/

> 	* config/rs6000/rs6000-gen-builtins.c (write_defines_file):

> 	Implement.


Okay for trunk.  Thanks!


Segher

Patch

diff --git a/gcc/config/rs6000/rs6000-gen-builtins.c b/gcc/config/rs6000/rs6000-gen-builtins.c
index 466fce1cdd2..18922d829ff 100644
--- a/gcc/config/rs6000/rs6000-gen-builtins.c
+++ b/gcc/config/rs6000/rs6000-gen-builtins.c
@@ -2006,6 +2006,23 @@  write_init_file (void)
 static int
 write_defines_file (void)
 {
+  fprintf (defines_file, "#ifndef _RS6000_VECDEFINES_H\n");
+  fprintf (defines_file, "#define _RS6000_VECDEFINES_H 1\n\n");
+  fprintf (defines_file, "#if defined(_ARCH_PPC64) && defined (_ARCH_PWR9)\n");
+  fprintf (defines_file, "  #define _ARCH_PPC64_PWR9 1\n");
+  fprintf (defines_file, "#endif\n\n");
+  for (int i = 0; i < num_ovld_stanzas; i++)
+    if (strcmp (ovld_stanzas[i].extern_name, "SKIP"))
+      {
+	if (ovld_stanzas[i].ifdef)
+	  fprintf (defines_file, "#ifdef %s\n", ovld_stanzas[i].ifdef);
+	fprintf (defines_file, "#define %s %s\n",
+		 ovld_stanzas[i].extern_name,
+		 ovld_stanzas[i].intern_name);
+	if (ovld_stanzas[i].ifdef)
+	  fprintf (defines_file, "#endif\n");
+      }
+  fprintf (defines_file, "\n#endif\n");
   return 1;
 }