public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [power-ieee128] libquadmath: Use -mno-gnu-attribute in libquadmath
@ 2022-01-03 15:24 Jakub Jelinek
  2022-01-03 15:58 ` Thomas Koenig
  2022-01-05 22:31 ` Michael Meissner
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 2022-01-03 15:24 UTC (permalink / raw)
  To: Thomas Koenig
  Cc: Michael Meissner, Bill Schmidt, fortran, Segher Boessenkool,
	Peter Bergner, David Edelsohn, gcc-patches

Hi!

Testing found that we also need libquadmath to be built with
-mno-gnu-attribute, otherwise -mabi=ieeelongdouble programs don't link.

Ok for power-ieee128?

2022-01-03  Jakub Jelinek  <jakub@redhat.com>

	* configure.ac: Set XCFLAGS to -mno-gnu-attribute on
	powerpc64le*-linux*.
	* configure: Regenerated.

--- libquadmath/configure.ac
+++ libquadmath/configure.ac
@@ -352,6 +352,19 @@ fi
 # Add CET specific flags if CET is enabled
 GCC_CET_FLAGS(CET_FLAGS)
 XCFLAGS="$XCFLAGS $CET_FLAGS"
+
+case x$target in
+  xpowerpc64le*-linux*)
+    AC_PREPROC_IFELSE(
+      [AC_LANG_PROGRAM([[#if __SIZEOF_LONG_DOUBLE__ != 16
+                         #error long double is double
+                         #endif]],
+                       [[(void) 0;]])],
+      [XCFLAGS="$XCFLAGS -mno-gnu-attribute"])
+    ;;
+  *)
+    ;;
+esac
 AC_SUBST(XCFLAGS)
 
 AC_CACHE_SAVE
--- libquadmath/configure
+++ libquadmath/configure
@@ -13096,6 +13096,30 @@ fi
 
 XCFLAGS="$XCFLAGS $CET_FLAGS"
 
+case x$target in
+  xpowerpc64le*-linux*)
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if __SIZEOF_LONG_DOUBLE__ != 16
+                         #error long double is double
+                         #endif
+int
+main ()
+{
+(void) 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  XCFLAGS="$XCFLAGS -mno-gnu-attribute"
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+    ;;
+  *)
+    ;;
+esac
+
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure

	Jakub


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

* Re: [power-ieee128] libquadmath: Use -mno-gnu-attribute in libquadmath
  2022-01-03 15:24 [power-ieee128] libquadmath: Use -mno-gnu-attribute in libquadmath Jakub Jelinek
@ 2022-01-03 15:58 ` Thomas Koenig
  2022-01-05 22:31 ` Michael Meissner
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Koenig @ 2022-01-03 15:58 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Segher Boessenkool, fortran, Peter Bergner, Bill Schmidt,
	gcc-patches, David Edelsohn

On 03.01.22 16:24, Jakub Jelinek via Fortran wrote:
> Ok for power-ieee128?

OK.

Thanks!

Best regards

	Thomas

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

* Re: [power-ieee128] libquadmath: Use -mno-gnu-attribute in libquadmath
  2022-01-03 15:24 [power-ieee128] libquadmath: Use -mno-gnu-attribute in libquadmath Jakub Jelinek
  2022-01-03 15:58 ` Thomas Koenig
@ 2022-01-05 22:31 ` Michael Meissner
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Meissner @ 2022-01-05 22:31 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Thomas Koenig, Michael Meissner, Bill Schmidt, fortran,
	Segher Boessenkool, Peter Bergner, David Edelsohn, gcc-patches

On Mon, Jan 03, 2022 at 04:24:50PM +0100, Jakub Jelinek wrote:
> Hi!
> 
> Testing found that we also need libquadmath to be built with
> -mno-gnu-attribute, otherwise -mabi=ieeelongdouble programs don't link.
> 
> Ok for power-ieee128?
> 
> 2022-01-03  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* configure.ac: Set XCFLAGS to -mno-gnu-attribute on
> 	powerpc64le*-linux*.
> 	* configure: Regenerated.

I'm wondering whether we want to change things so that Fortran never uses long
double on PowerPC, but instead it explicitly uses __float128 and __ibm128.  But
this breaks down in using printf/scanf, which don't have format options for
those types.

Unfortunately this won't work with the current code, since passing any of the
128-bit floating point types causes the flag 'rs6000_passes_long_double' to be
set (and then the gnu attribute #4 is set).  In theory, that should be set only
if an explicit long double type is used.  But the problem is when those things
are set, you tend to only have modes and not types.

To do it 'right', you probably need a GIMPLE pass that looks at the actual
types used, not the modes.

-- 
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: meissner@linux.ibm.com

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

end of thread, other threads:[~2022-01-05 22:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-03 15:24 [power-ieee128] libquadmath: Use -mno-gnu-attribute in libquadmath Jakub Jelinek
2022-01-03 15:58 ` Thomas Koenig
2022-01-05 22:31 ` 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).