x86-64: Define ASM_OUTPUT_ALIGNED_DECL_LOCAL
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 26 Jun 2020 20:59:31 +0000 (13:59 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 18 Jul 2020 15:51:54 +0000 (08:51 -0700)
Define ASM_OUTPUT_ALIGNED_DECL_LOCAL for large local common symbol.

gcc/

PR target/95620
* config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): New.

libgomp/

PR target/95620
* testsuite/libgomp.c/pr95620.c: New test.

gcc/config/i386/x86-64.h
libgomp/testsuite/libgomp.c/pr95620.c [new file with mode: 0644]

index 88db428f592b78f1275bd4d825b06f92522ad164..0c5b8af5a13e7cfc47868ffd4a573f8a27c2ad53 100644 (file)
@@ -59,6 +59,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN)          \
   x86_elf_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN);
 
+#undef  ASM_OUTPUT_ALIGNED_DECL_LOCAL
+#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN)  \
+  do                                                                 \
+    {                                                                \
+      fprintf ((FILE), "%s", LOCAL_ASM_OP);                          \
+      assemble_name ((FILE), (NAME));                                \
+      fprintf ((FILE), "\n");                                        \
+      ASM_OUTPUT_ALIGNED_DECL_COMMON (FILE, DECL, NAME, SIZE, ALIGN); \
+    }                                                                \
+  while (0)
+
 /* This is used to align code labels according to Intel recommendations.  */
 
 #define SUBALIGN_LOG 3
diff --git a/libgomp/testsuite/libgomp.c/pr95620.c b/libgomp/testsuite/libgomp.c/pr95620.c
new file mode 100644 (file)
index 0000000..b310b56
--- /dev/null
@@ -0,0 +1,18 @@
+// { dg-do link { target { { i?86-*-* x86_64-*-* } && lp64 } } }
+/* { dg-require-effective-target lto } */
+/* { dg-additional-options "-flto -mcmodel=medium" } */
+
+double a[353783808];
+int b, c, d;
+
+int
+main()
+{
+  for (; b;)
+#pragma omp parallel
+    a[c] = 1;
+  for (;; b++)
+    if (a[c])
+      d++;
+  return 0;
+}