Message ID | 20160708133133.GA31893@ibm-tiger.the-meissners.org |
---|---|
State | New |
Headers | show |
On Fri, Jul 08, 2016 at 09:31:33AM -0400, Michael Meissner wrote: > * gcc.target/powerpc/p9-lxvx-stxvx-3.c: Add -mfloat128 option. Is that the only testcase that needs updating? > --- gcc/config/rs6000/rs6000-cpus.def (revision 238127) > +++ gcc/config/rs6000/rs6000-cpus.def (working copy) > @@ -63,7 +63,6 @@ > /* Add ISEL back into ISA 3.0, since it is supposed to be a win. Do not add > P9_MINMAX until the hardware that supports it is available. */ > #define ISA_3_0_MASKS_SERVER (ISA_2_7_MASKS_SERVER \ > - | OPTION_MASK_FLOAT128_HW \ Please add a comment for this as well? > /* IEEE 128-bit floating point hardware instructions imply enabling > __float128. */ > if (TARGET_FLOAT128_HW > - && (rs6000_isa_flags & (OPTION_MASK_P9_VECTOR > - | OPTION_MASK_DIRECT_MOVE > - | OPTION_MASK_UPPER_REGS_DI > - | OPTION_MASK_UPPER_REGS_DF > - | OPTION_MASK_UPPER_REGS_SF)) == 0) > + && (rs6000_isa_flags & ISA_3_0_MASKS_IEEE) != ISA_3_0_MASKS_IEEE) > { > if ((rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_HW) != 0) > error ("-mfloat128-hardware requires full ISA 3.0 support"); That is not the same thing... New one looks better, is this a bugfix? The changelog doesn't say. Okay for trunk and 6 with those nits fixed. Thanks, Segher
On Fri, Jul 08, 2016 at 09:13:50AM -0500, Segher Boessenkool wrote: > On Fri, Jul 08, 2016 at 09:31:33AM -0400, Michael Meissner wrote: > > * gcc.target/powerpc/p9-lxvx-stxvx-3.c: Add -mfloat128 option. > > Is that the only testcase that needs updating? > > > --- gcc/config/rs6000/rs6000-cpus.def (revision 238127) > > +++ gcc/config/rs6000/rs6000-cpus.def (working copy) > > @@ -63,7 +63,6 @@ > > /* Add ISEL back into ISA 3.0, since it is supposed to be a win. Do not add > > P9_MINMAX until the hardware that supports it is available. */ > > #define ISA_3_0_MASKS_SERVER (ISA_2_7_MASKS_SERVER \ > > - | OPTION_MASK_FLOAT128_HW \ > > Please add a comment for this as well? Ok. > > /* IEEE 128-bit floating point hardware instructions imply enabling > > __float128. */ > > if (TARGET_FLOAT128_HW > > - && (rs6000_isa_flags & (OPTION_MASK_P9_VECTOR > > - | OPTION_MASK_DIRECT_MOVE > > - | OPTION_MASK_UPPER_REGS_DI > > - | OPTION_MASK_UPPER_REGS_DF > > - | OPTION_MASK_UPPER_REGS_SF)) == 0) > > + && (rs6000_isa_flags & ISA_3_0_MASKS_IEEE) != ISA_3_0_MASKS_IEEE) > > { > > if ((rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_HW) != 0) > > error ("-mfloat128-hardware requires full ISA 3.0 support"); > > That is not the same thing... New one looks better, is this a bugfix? > The changelog doesn't say. I just moved the OPTIONS_MASKS_* used here to a common macro that is checked earlier to enable hardware support if -mfloat128. > Okay for trunk and 6 with those nits fixed. Thanks, Thanks.
On Fri, Jul 08, 2016 at 10:17:14AM -0400, Michael Meissner wrote: > > > /* IEEE 128-bit floating point hardware instructions imply enabling > > > __float128. */ > > > if (TARGET_FLOAT128_HW > > > - && (rs6000_isa_flags & (OPTION_MASK_P9_VECTOR > > > - | OPTION_MASK_DIRECT_MOVE > > > - | OPTION_MASK_UPPER_REGS_DI > > > - | OPTION_MASK_UPPER_REGS_DF > > > - | OPTION_MASK_UPPER_REGS_SF)) == 0) > > > + && (rs6000_isa_flags & ISA_3_0_MASKS_IEEE) != ISA_3_0_MASKS_IEEE) > > > { > > > if ((rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_HW) != 0) > > > error ("-mfloat128-hardware requires full ISA 3.0 support"); > > > > That is not the same thing... New one looks better, is this a bugfix? > > The changelog doesn't say. > > I just moved the OPTIONS_MASKS_* used here to a common macro that is checked > earlier to enable hardware support if -mfloat128. The old code tests if all options are off; the new if any are off. Segher
Index: gcc/config/rs6000/rs6000-cpus.def =================================================================== --- gcc/config/rs6000/rs6000-cpus.def (revision 238127) +++ gcc/config/rs6000/rs6000-cpus.def (working copy) @@ -63,7 +63,6 @@ /* Add ISEL back into ISA 3.0, since it is supposed to be a win. Do not add P9_MINMAX until the hardware that supports it is available. */ #define ISA_3_0_MASKS_SERVER (ISA_2_7_MASKS_SERVER \ - | OPTION_MASK_FLOAT128_HW \ | OPTION_MASK_ISEL \ | OPTION_MASK_MODULO \ | OPTION_MASK_P9_FUSION \ @@ -72,6 +71,16 @@ | OPTION_MASK_P9_MISC \ | OPTION_MASK_P9_VECTOR) +/* Support for the IEEE 128-bit floating point hardware requires a lot of the + VSX instructions that are part of ISA 3.0. */ +#define ISA_3_0_MASKS_IEEE (OPTION_MASK_VSX \ + | OPTION_MASK_P8_VECTOR \ + | OPTION_MASK_P9_VECTOR \ + | OPTION_MASK_DIRECT_MOVE \ + | OPTION_MASK_UPPER_REGS_DI \ + | OPTION_MASK_UPPER_REGS_DF \ + | OPTION_MASK_UPPER_REGS_SF) + #define POWERPC_7400_MASK (OPTION_MASK_PPC_GFXOPT | OPTION_MASK_ALTIVEC) /* Deal with ports that do not have -mstrict-align. */ Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 238130) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -4381,14 +4381,21 @@ rs6000_option_override_internal (bool gl rs6000_isa_flags &= ~(OPTION_MASK_FLOAT128 | OPTION_MASK_FLOAT128_HW); } + /* If we have -mfloat128 and full ISA 3.0 support, enable -mfloat128-hardware + by default. */ + if (TARGET_FLOAT128 && !TARGET_FLOAT128_HW + && (rs6000_isa_flags & ISA_3_0_MASKS_IEEE) == ISA_3_0_MASKS_IEEE + && !(rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_HW)) + { + rs6000_isa_flags |= OPTION_MASK_FLOAT128_HW; + if ((rs6000_isa_flags & OPTION_MASK_FLOAT128) != 0) + rs6000_isa_flags_explicit |= OPTION_MASK_FLOAT128_HW; + } + /* IEEE 128-bit floating point hardware instructions imply enabling __float128. */ if (TARGET_FLOAT128_HW - && (rs6000_isa_flags & (OPTION_MASK_P9_VECTOR - | OPTION_MASK_DIRECT_MOVE - | OPTION_MASK_UPPER_REGS_DI - | OPTION_MASK_UPPER_REGS_DF - | OPTION_MASK_UPPER_REGS_SF)) == 0) + && (rs6000_isa_flags & ISA_3_0_MASKS_IEEE) != ISA_3_0_MASKS_IEEE) { if ((rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_HW) != 0) error ("-mfloat128-hardware requires full ISA 3.0 support"); @@ -4396,10 +4403,6 @@ rs6000_option_override_internal (bool gl rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_HW; } - else if (TARGET_P9_VECTOR && !TARGET_FLOAT128_HW - && (rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_HW) == 0) - rs6000_isa_flags |= OPTION_MASK_FLOAT128_HW; - if (TARGET_FLOAT128_HW && (rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128) == 0) rs6000_isa_flags |= OPTION_MASK_FLOAT128; Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 238150) +++ gcc/doc/invoke.texi (working copy) @@ -20355,9 +20355,14 @@ hardware instructions. The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128} -option. The @code{-mfloat128} option only works on PowerPC 64-bit +option. The @option{-mfloat128} option only works on PowerPC 64-bit Linux systems. +If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the +@option{-mfloat128} option will also enable the generation of ISA 3.0 +IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit +floating point will be done with software emulation. + @item -mfloat128-hardware @itemx -mno-float128-hardware @opindex mfloat128-hardware @@ -20365,6 +20370,13 @@ Linux systems. Enable/disable using ISA 3.0 hardware instructions to support the @var{__float128} data type. +If you use @option{-mfloat128-hardware}, it will enable the option +@option{-mfloat128} as well. + +If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do +not use either @option{-mfloat128} or @option{-mfloat128-hardware}, +the IEEE 128-bit floating point support will not be enabled. + @item -mmodulo @itemx -mno-modulo @opindex mmodulo Index: gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-3.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-3.c (revision 238150) +++ gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-3.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile { target { powerpc64le-*-* } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O3" } */ +/* { dg-options "-mcpu=power9 -O3 -mfloat128" } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-final { scan-assembler "lxvx" } } */ /* { dg-final { scan-assembler "stxvx" } } */