public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/ieee-longdouble-002)] PowerPC: PR 97791: Fix gnu attributes.
@ 2020-12-02 19:12 Michael Meissner
  0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2020-12-02 19:12 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1042c8bcd730144de16ea6c96aec191bf2113609

commit 1042c8bcd730144de16ea6c96aec191bf2113609
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Wed Dec 2 13:58:13 2020 -0500

    PowerPC: PR 97791: Fix gnu attributes.
    
    This patch does two things to fix setting gnu attribute #4 (long double status)
    
    1) Only set gnu attribute #4 if long double was passed.  Passing __float128
    when long double is IBM or __ibm128 when long double is IEEE no longer sets the
    attribute.  This resulted in a lot of false positives, such as using __float128
    and no long double support.
    
    2) Do not set the gnu attribute if a mode used by long double (TF or DF) is
    used in a move.  The moves do not differentiate between the long double type
    and similar types.  Delete the three tests that tested this.
    
    I wrote the code for the move several years.  I wanted to flag that an object
    that used the appropriate long double type got flagged.  Unfortunately, at the
    RTL level, we have lost the type nodes, so we can't tell the difference between
    two types that use the same mode (for instance if long double is 64-bit, the
    attribute would be set if you used normal doubles, and not long doubles).  Alan
    Modra and I discussed this, and we think this is just the right thing to do.
    
    gcc/
    2020-11-30  Michael Meissner  <meissner@linux.ibm.com>
    
            PR gcc/97791
            * config/rs6000/rs6000-call.c (init_cumulative_args): Only set
            that long double was returned if the type is actually long
            double.
            (rs6000_function_arg_advance_1): Only set that long double was
            passed if the type is actually long double.
            * config/rs6000/rs6000.c (rs6000_emit_move): Delete code that sets
            whether long double was passed based on the modes used in moves.
    
    gcc/testsuite/
    2020-11-30  Michael Meissner  <meissner@linux.ibm.com>
    
            PR target/97791
            * gcc.target/powerpc/gnuattr1.c: Mark as XFAIL.
            * gcc.target/powerpc/gnuattr2.c: Mark as XFAIL.
            * gcc.target/powerpc/gnuattr3.c: Mark as XFAIL.

Diff:
---
 gcc/config/rs6000/rs6000-call.c             | 13 ++++---------
 gcc/config/rs6000/rs6000.c                  | 17 -----------------
 gcc/testsuite/gcc.target/powerpc/gnuattr1.c |  9 +++++++--
 gcc/testsuite/gcc.target/powerpc/gnuattr2.c |  9 +++++++--
 gcc/testsuite/gcc.target/powerpc/gnuattr3.c |  9 +++++++--
 5 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 45bc048b5c7..280004b8732 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -6555,11 +6555,8 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype,
 	    {
 	      rs6000_passes_float = true;
 	      if ((HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE || TARGET_64BIT)
-		  && (FLOAT128_IBM_P (return_mode)
-		      || FLOAT128_IEEE_P (return_mode)
-		      || (return_type != NULL
-			  && (TYPE_MAIN_VARIANT (return_type)
-			      == long_double_type_node))))
+		  && return_type != NULL
+		  && TYPE_MAIN_VARIANT (return_type) == long_double_type_node)
 		rs6000_passes_long_double = true;
 
 	      /* Note if we passed or return a IEEE 128-bit type.  We changed
@@ -6995,10 +6992,8 @@ rs6000_function_arg_advance_1 (CUMULATIVE_ARGS *cum, machine_mode mode,
 	{
 	  rs6000_passes_float = true;
 	  if ((HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE || TARGET_64BIT)
-	      && (FLOAT128_IBM_P (mode)
-		  || FLOAT128_IEEE_P (mode)
-		  || (type != NULL
-		      && TYPE_MAIN_VARIANT (type) == long_double_type_node)))
+	      && type != NULL
+	      && TYPE_MAIN_VARIANT (type) == long_double_type_node)
 	    rs6000_passes_long_double = true;
 
 	  /* Note if we passed or return a IEEE 128-bit type.  We changed the
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 0700ffef507..263b2bef8d1 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -10078,23 +10078,6 @@ rs6000_emit_move (rtx dest, rtx source, machine_mode mode)
       && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
     gcc_unreachable ();
 
-#ifdef HAVE_AS_GNU_ATTRIBUTE
-  /* If we use a long double type, set the flags in .gnu_attribute that say
-     what the long double type is.  This is to allow the linker's warning
-     message for the wrong long double to be useful, even if the function does
-     not do a call (for example, doing a 128-bit add on power9 if the long
-     double type is IEEE 128-bit.  Do not set this if __ibm128 or __floa128 are
-     used if they aren't the default long dobule type.  */
-  if (rs6000_gnu_attr && (HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE || TARGET_64BIT))
-    {
-      if (TARGET_LONG_DOUBLE_128 && (mode == TFmode || mode == TCmode))
-	rs6000_passes_float = rs6000_passes_long_double = true;
-
-      else if (!TARGET_LONG_DOUBLE_128 && (mode == DFmode || mode == DCmode))
-	rs6000_passes_float = rs6000_passes_long_double = true;
-    }
-#endif
-
   /* See if we need to special case SImode/SFmode SUBREG moves.  */
   if ((mode == SImode || mode == SFmode) && SUBREG_P (source)
       && rs6000_emit_move_si_sf_subreg (dest, source, mode))
diff --git a/gcc/testsuite/gcc.target/powerpc/gnuattr1.c b/gcc/testsuite/gcc.target/powerpc/gnuattr1.c
index cf46777849a..9c7680aabae 100644
--- a/gcc/testsuite/gcc.target/powerpc/gnuattr1.c
+++ b/gcc/testsuite/gcc.target/powerpc/gnuattr1.c
@@ -1,11 +1,16 @@
 /* { dg-do compile { target { powerpc*-linux-* } } } */
 /* { dg-require-effective-target powerpc_vsx_ok } */
 /* { dg-options "-O2 -mvsx -mlong-double-64" } */
-/* { dg-final { scan-assembler "gnu_attribute 4, 9" } } */
+/* { dg-final { scan-assembler "gnu_attribute 4, 9" {xfail *-*-*} } } */
 
 /* Check that if we can do the long double operation without doing an emulator
    call, such as with 64-bit long double support, that we still set the
-   appropriate .gnu_attribute.  */
+   appropriate .gnu_attribute.
+
+   However, the code that did this in rs6000_emit_move has been removed because
+   it could not differentiate between long double and another type that uses
+   the same mode.  This test is marked as xfail until a gimple pass is added to
+   track the use of long double types.  */
 
 long double a;
 
diff --git a/gcc/testsuite/gcc.target/powerpc/gnuattr2.c b/gcc/testsuite/gcc.target/powerpc/gnuattr2.c
index 32a4ba255a8..4ca60d63261 100644
--- a/gcc/testsuite/gcc.target/powerpc/gnuattr2.c
+++ b/gcc/testsuite/gcc.target/powerpc/gnuattr2.c
@@ -1,13 +1,18 @@
 /* { dg-do compile { target { powerpc*-linux-* && lp64 } } } */
 /* { dg-require-effective-target powerpc_p9vector_ok } */
 /* { dg-options "-O2 -mpower9-vector -mabi=ieeelongdouble -Wno-psabi" } */
-/* { dg-final { scan-assembler "gnu_attribute 4, 13" } } */
+/* { dg-final { scan-assembler "gnu_attribute 4, 13" {xfail *-*-*} } } */
 
 /* Check that if we can do the long double operation without doing an emulator
    call, such as with IEEE 128-bit hardware support on power9, that we still
    set the appropriate .gnu_attribute.  The && lp64 is needed, because we can't
    enable the IEEE 128-bit hardware instructions on ISA 3.0 (power9) in 32-bit,
-   because we don't have a TImode available.  */
+   because we don't have a TImode available.
+
+   However, the code that did this in rs6000_emit_move has been removed because
+   it could not differentiate between long double and another type that uses
+   the same mode.  This test is marked as xfail until a gimple pass is added to
+   track the use of long double types.  */
 
 long double a;
 
diff --git a/gcc/testsuite/gcc.target/powerpc/gnuattr3.c b/gcc/testsuite/gcc.target/powerpc/gnuattr3.c
index bd5a64fe330..7eb3ebc3c43 100644
--- a/gcc/testsuite/gcc.target/powerpc/gnuattr3.c
+++ b/gcc/testsuite/gcc.target/powerpc/gnuattr3.c
@@ -1,11 +1,16 @@
 /* { dg-do compile { target { powerpc*-linux-* } } } */
 /* { dg-require-effective-target powerpc_vsx_ok } */
 /* { dg-options "-O2 -mvsx -mabi=ibmlongdouble -Wno-psabi" } */
-/* { dg-final { scan-assembler "gnu_attribute 4, 5" } } */
+/* { dg-final { scan-assembler "gnu_attribute 4, 5" {xfail *-*-*} } } */
 
 /* Check that if we can do the long double operation without doing an emulator
    call, such as with copysign, that we still set the appropriate
-   .gnu_attribute.  */
+   .gnu_attribute.
+
+   However, the code that did this in rs6000_emit_move has been removed because
+   it could not differentiate between long double and another type that uses
+   the same mode.  This test is marked as xfail until a gimple pass is added to
+   track the use of long double types.  */
 
 long double a, b, c;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-02 19:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 19:12 [gcc(refs/vendors/ibm/heads/ieee-longdouble-002)] PowerPC: PR 97791: Fix gnu attributes Michael Meissner

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