diff mbox

Patch, Split powerpc -mfloat128 into 2 parts

Message ID 20161007201018.GA31941@ibm-tiger.the-meissners.org
State New
Headers show

Commit Message

Michael Meissner Oct. 7, 2016, 8:10 p.m. UTC
On Thu, Oct 06, 2016 at 05:19:39PM -0500, Segher Boessenkool wrote:
> On Wed, Oct 05, 2016 at 06:18:50PM -0400, Michael Meissner wrote:
> > I have removed the #define of __float128, and instead created a keyword that
> > points to the _Float128 type.  I added a little commentary on the use of
> > __ieee128 (which is needed to create the type when we aren't using __float128).
> > 
> > I did a bootstrap and test on a little endian power8 system with no
> > regressions.  Can I install the patch on the trunk?
> 
> Not easy to read this patch :-)
> 
> It looks good; it is fine for trunk if Joseph thinks it is good, too.
> One nit...
> 
> > --- gcc/testsuite/gcc.target/powerpc/float128-type-1.c	(.../svn+ssh://meissner@gcc.gnu.org/svn/gcc/trunk/gcc/testsuite/gcc.target/powerpc)	(revision 0)
> > +++ gcc/testsuite/gcc.target/powerpc/float128-type-1.c	(.../gcc/testsuite/gcc.target/powerpc)	(revision 240807)
> > @@ -0,0 +1,24 @@
> > +/* { dg-do compile { target { powerpc64*-*-linux* && lp64 } } } */
> > +/* { dg-require-effective-target powerpc_vsx_ok } */
> > +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
> > +/* { dg-options "-mcpu=power8 -O2" } */
> > +
> > +/* -mfloat128-type is enabled by default on VSX Linux 64-bit systems.  */
> 
> "Check that" etc.?  Also for the next testcase.  It is really helpful
> five or ten years later if a testcase bluntly says what it is testing
> for so you don't have to reverse engineer that :-)

I added more to the comments to saw what these files were checking, and
committed them:
diff mbox

Patch

Index: gcc/testsuite/gcc.target/powerpc/float128-type-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/float128-type-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/float128-type-1.c	(revision 0)
@@ -0,0 +1,28 @@ 
+/* { dg-do compile { target { powerpc64*-*-linux* && lp64 } } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O2" } */
+
+/* This test tests whether -mfloat128-type (which enables the underlying IEEE
+   128-bit floating point) is enabled by default on VSX Linux 64-bit systems,
+   even if the keywords __float128 and _Float128 (-mfloat128) are not enabled
+   via the -mfloat128 switch.  Test that power8 generates a call to the
+   __addkf3 emulation function.  */
+
+typedef double          __attribute__((__mode__(__KF__))) f128_t;
+typedef _Complex double __attribute__((__mode__(__KC__))) f128c_t;
+
+f128_t
+add_scalar (f128_t a, f128_t b)
+{
+  return a+b;
+}
+
+
+f128c_t
+add_complex (f128c_t a, f128c_t b)
+{
+  return a+b;
+}
+
+/* { dg-final { scan-assembler "bl __addkf3" } } */
Index: gcc/testsuite/gcc.target/powerpc/float128-type-2.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/float128-type-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/float128-type-2.c	(revision 0)
@@ -0,0 +1,31 @@ 
+/* { dg-do compile { target { powerpc64-*-linux* && lp64 } } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-options "-mcpu=power9 -O2" } */
+
+/* This test tests whether -mfloat128-type (which enables the underlying IEEE
+   128-bit floating point) is enabled by default on VSX Linux 64-bit systems,
+   even if the keywords __float128 and _Float128 (-mfloat128) are not enabled
+   via the -mfloat128 switch.  Test that power9 generates the xsaddqp
+   instruction.  */
+
+/* The effective target powerpc_float128_hw_ok is not used, as that will pass
+   -mfloat128.  */
+
+typedef double          __attribute__((__mode__(__KF__))) f128_t;
+typedef _Complex double __attribute__((__mode__(__KC__))) f128c_t;
+
+f128_t
+add_scalar (f128_t a, f128_t b)
+{
+  return a+b;
+}
+
+
+f128c_t
+add_complex (f128c_t a, f128c_t b)
+{
+  return a+b;
+}
+
+/* { dg-final { scan-assembler "xsaddqp" } } */