x86-64: Define ASM_OUTPUT_ALIGNED_DECL_LOCAL

Message ID 20200626210217.884877-1-hjl.tools@gmail.com
State New
Headers show
Series
  • x86-64: Define ASM_OUTPUT_ALIGNED_DECL_LOCAL
Related show

Commit Message

Kirill Yukhin via Gcc-patches June 26, 2020, 9:02 p.m.
Define ASM_OUTPUT_ALIGNED_DECL_LOCAL for large local common symbol.

gcc/ChangeLog:

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

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr95620.c: New test.
---
 gcc/config/i386/x86-64.h                | 11 +++++++++++
 gcc/testsuite/gcc.target/i386/pr95620.c | 19 +++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr95620.c

-- 
2.26.2

Comments

Kirill Yukhin via Gcc-patches July 12, 2020, 12:05 p.m. | #1
On Fri, Jun 26, 2020 at 2:02 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>

> Define ASM_OUTPUT_ALIGNED_DECL_LOCAL for large local common symbol.

>

> gcc/ChangeLog:

>

>         * config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): New.

>

> gcc/testsuite/ChangeLog:

>

>         * gcc.target/i386/pr95620.c: New test.


PING:

https://gcc.gnu.org/pipermail/gcc-patches/2020-June/549001.html

-- 
H.J.
Kirill Yukhin via Gcc-patches July 18, 2020, 3:08 p.m. | #2
On Sun, Jul 12, 2020 at 5:05 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>

> On Fri, Jun 26, 2020 at 2:02 PM H.J. Lu <hjl.tools@gmail.com> wrote:

> >

> > Define ASM_OUTPUT_ALIGNED_DECL_LOCAL for large local common symbol.

> >

> > gcc/ChangeLog:

> >

> >         * config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): New.

> >

> > gcc/testsuite/ChangeLog:

> >

> >         * gcc.target/i386/pr95620.c: New test.

>

> PING:

>

> https://gcc.gnu.org/pipermail/gcc-patches/2020-June/549001.html

>


Any objections to check it in next Monday?


-- 
H.J.
Jan Hubicka July 18, 2020, 3:15 p.m. | #3
> On Sun, Jul 12, 2020 at 5:05 AM H.J. Lu <hjl.tools@gmail.com> wrote:

> >

> > On Fri, Jun 26, 2020 at 2:02 PM H.J. Lu <hjl.tools@gmail.com> wrote:

> > >

> > > Define ASM_OUTPUT_ALIGNED_DECL_LOCAL for large local common symbol.

> > >

> > > gcc/ChangeLog:

> > >

> > >         * config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): New.

> > >

> > > gcc/testsuite/ChangeLog:

> > >

> > >         * gcc.target/i386/pr95620.c: New test.

> >

> > PING:

> >

> > https://gcc.gnu.org/pipermail/gcc-patches/2020-June/549001.html

> >

> 

> Any objections to check it in next Monday?

Looks good to me.

Honza
> 

> 

> -- 

> H.J.
Kirill Yukhin via Gcc-patches July 18, 2020, 3:55 p.m. | #4
On Sat, Jul 18, 2020 at 8:15 AM Jan Hubicka <hubicka@ucw.cz> wrote:
>

> > On Sun, Jul 12, 2020 at 5:05 AM H.J. Lu <hjl.tools@gmail.com> wrote:

> > >

> > > On Fri, Jun 26, 2020 at 2:02 PM H.J. Lu <hjl.tools@gmail.com> wrote:

> > > >

> > > > Define ASM_OUTPUT_ALIGNED_DECL_LOCAL for large local common symbol.

> > > >

> > > > gcc/ChangeLog:

> > > >

> > > >         * config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): New.

> > > >

> > > > gcc/testsuite/ChangeLog:

> > > >

> > > >         * gcc.target/i386/pr95620.c: New test.

> > >

> > > PING:

> > >

> > > https://gcc.gnu.org/pipermail/gcc-patches/2020-June/549001.html

> > >

> >

> > Any objections to check it in next Monday?

> Looks good to me.

>

> Honza


This is the patch I am checking in.  I moved the test to
libgomp/testsuite/libgomp.c
since the test fails at link-time without the fix.

Thanks.

-- 
H.J.
From 7aa22a8f1a5cd7f79d6bdd8b56ef7ab89a43bce3 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Fri, 26 Jun 2020 13:59:31 -0700
Subject: [PATCH] x86-64: Define ASM_OUTPUT_ALIGNED_DECL_LOCAL

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              | 11 +++++++++++
 libgomp/testsuite/libgomp.c/pr95620.c | 18 ++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 libgomp/testsuite/libgomp.c/pr95620.c

diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h
index 88db428f592..0c5b8af5a13 100644
--- a/gcc/config/i386/x86-64.h
+++ b/gcc/config/i386/x86-64.h
@@ -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
index 00000000000..b310b56555b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr95620.c
@@ -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;
+}
Kirill Yukhin via Gcc-patches July 24, 2020, 11:12 a.m. | #5
On Sat, Jul 18, 2020 at 8:55 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>

> On Sat, Jul 18, 2020 at 8:15 AM Jan Hubicka <hubicka@ucw.cz> wrote:

> >

> > > On Sun, Jul 12, 2020 at 5:05 AM H.J. Lu <hjl.tools@gmail.com> wrote:

> > > >

> > > > On Fri, Jun 26, 2020 at 2:02 PM H.J. Lu <hjl.tools@gmail.com> wrote:

> > > > >

> > > > > Define ASM_OUTPUT_ALIGNED_DECL_LOCAL for large local common symbol.

> > > > >

> > > > > gcc/ChangeLog:

> > > > >

> > > > >         * config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): New.

> > > > >

> > > > > gcc/testsuite/ChangeLog:

> > > > >

> > > > >         * gcc.target/i386/pr95620.c: New test.

> > > >

> > > > PING:

> > > >

> > > > https://gcc.gnu.org/pipermail/gcc-patches/2020-June/549001.html

> > > >

> > >

> > > Any objections to check it in next Monday?

> > Looks good to me.

> >

> > Honza

>

> This is the patch I am checking in.  I moved the test to

> libgomp/testsuite/libgomp.c

> since the test fails at link-time without the fix.

>


OK to backport to GCC 10 branch?


-- 
H.J.

Patch

diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h
index 88db428f592..0c5b8af5a13 100644
--- a/gcc/config/i386/x86-64.h
+++ b/gcc/config/i386/x86-64.h
@@ -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/gcc/testsuite/gcc.target/i386/pr95620.c b/gcc/testsuite/gcc.target/i386/pr95620.c
new file mode 100644
index 00000000000..ac9b40383e7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95620.c
@@ -0,0 +1,19 @@ 
+/* { dg-do assemble { target lp64 } } */
+/* { dg-require-effective-target fopenmp } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-flto -fopenmp -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;
+}