Re: [PATCHv2q, rs6000] Add minimum __float128 built-in support required for glib

2016-06-24 Thread Segher Boessenkool
On Thu, Jun 23, 2016 at 09:32:13PM -0500, Bill Schmidt wrote:
> (I've had some possible mailer problems with previous patches, so
> I will try both inserting the patch and providing an attachment.  Please
> let me know which (if either) is preferable.)

Both are quoted-printable, which is just awful.  The attachment is worse.

> Index: gcc/config/rs6000/rs6000-builtin.def
> ===
> --- gcc/config/rs6000/rs6000-builtin.def  (revision 237619)
> +++ gcc/config/rs6000/rs6000-builtin.def  (working copy)
> @@ -652,7 +652,23 @@
>| RS6000_BTC_BINARY),  \
>   CODE_FOR_ ## ICODE) /* ICODE */
>  
> +/* IEEE 128-bit floating-point builtins.  */
> +#define BU_FLOAT128_2(ENUM, NAME, ATTR, ICODE)  \
> +  RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM,  /* ENUM */  \
> +"__builtin_" NAME,  /* NAME */  \

This last line still is indented with spaces.  Similar elsewhere.  But
looking at the original file, it is a mess as well, so I'll ignore this
file.

> @@ -35569,6 +35639,7 @@ static struct rs6000_opt_mask const rs6000_builtin
>{ "hard-dfp",   RS6000_BTM_DFP,false, false },
>{ "hard-float", RS6000_BTM_HARD_FLOAT, false, false },
>{ "long-double-128",RS6000_BTM_LDBL128,false, false },
> +  { "float128",   RS6000_BTM_FLOAT128,   false, false },

Still has spaces instead of a tab before that "false, false".

> @@ -2705,7 +2706,8 @@ extern int frame_pointer_needed;
>| RS6000_BTM_CELL  \
>| RS6000_BTM_DFP   \
>| RS6000_BTM_HARD_FLOAT\
> -  | RS6000_BTM_LDBL128)
> +  | RS6000_BTM_LDBL128   \
> +  | RS6000_BTM_FLOAT128)

Same here, before the "\".

The user documentation should probably say Altivec instead of VMX, to
reduce confusion.

Okay for trunk with those fixes.  Thanks!

Please see if the existing float128 tests are usable for us before
doing a backport.


Segher


Re: [PATCHv2q, rs6000] Add minimum __float128 built-in support required for glib

2016-06-24 Thread Joseph Myers
On Fri, 24 Jun 2016, Uros Bizjak wrote:

> On Fri, Jun 24, 2016 at 9:12 AM, Uros Bizjak  wrote:
> 
> >> Once more with feeling...  I've revised my v2 patch to rename the
> >> functions to __builtin_q rather than __builtin_f128 to avoid
> >> the collision with Joseph's work.  I've also corrected the formatting
> >> problems that Segher noted with my previous attempt.
> >>
> >> Bootstrapped and tested on powerpc64le-unknown-linux-gnu with
> >> no regressions.  Is this ok for trunk, and eventually for 6.2?
> >
> > I'd like to point out that there are several tests in
> > gcc.dg/torture/*float128*.c that can be enabled for powerpc.
> 
> .. and also in gcc.dg/*float128*.c.
> 
> Maybe we should add a check for float128 effective target in
> lib/target-supports.exp that would list all __float128 capable
> targets?

There's such an effective target, for _Float128, in my _FloatN / _FloatNx 
patch.

Note that some of the __float128 tests are not appropriate for powerpc 
because they are specific to architectures with after-rounding tininess 
detection.  Also note that powerpc needs extra options to enable float128 
/ has limitations on what hardware is supported, so optimal enabling of 
such tests requires something like dg-add-options float128.

-- 
Joseph S. Myers
jos...@codesourcery.com


Re: [PATCHv2q, rs6000] Add minimum __float128 built-in support required for glib

2016-06-24 Thread Uros Bizjak
On Fri, Jun 24, 2016 at 9:12 AM, Uros Bizjak  wrote:

>> Once more with feeling...  I've revised my v2 patch to rename the
>> functions to __builtin_q rather than __builtin_f128 to avoid
>> the collision with Joseph's work.  I've also corrected the formatting
>> problems that Segher noted with my previous attempt.
>>
>> Bootstrapped and tested on powerpc64le-unknown-linux-gnu with
>> no regressions.  Is this ok for trunk, and eventually for 6.2?
>
> I'd like to point out that there are several tests in
> gcc.dg/torture/*float128*.c that can be enabled for powerpc.

.. and also in gcc.dg/*float128*.c.

Maybe we should add a check for float128 effective target in
lib/target-supports.exp that would list all __float128 capable
targets?

Uros.


Re: [PATCHv2q, rs6000] Add minimum __float128 built-in support required for glib

2016-06-24 Thread Uros Bizjak
Hello!

> Once more with feeling...  I've revised my v2 patch to rename the
> functions to __builtin_q rather than __builtin_f128 to avoid
> the collision with Joseph's work.  I've also corrected the formatting
> problems that Segher noted with my previous attempt.
>
> Bootstrapped and tested on powerpc64le-unknown-linux-gnu with
> no regressions.  Is this ok for trunk, and eventually for 6.2?

I'd like to point out that there are several tests in
gcc.dg/torture/*float128*.c that can be enabled for powerpc.

Uros.


[PATCHv2q, rs6000] Add minimum __float128 built-in support required for glib

2016-06-23 Thread Bill Schmidt
Hi,

Once more with feeling...  I've revised my v2 patch to rename the
functions to __builtin_q rather than __builtin_f128 to avoid
the collision with Joseph's work.  I've also corrected the formatting
problems that Segher noted with my previous attempt.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu with
no regressions.  Is this ok for trunk, and eventually for 6.2?

Thanks for your patience as we worked through the details of getting
this right for GCC 6 and 7!

(I've had some possible mailer problems with previous patches, so
I will try both inserting the patch and providing an attachment.  Please
let me know which (if either) is preferable.)

Thanks,
BIll


[gcc]

2016-06-23  Bill Schmidt  

* config/rs6000/rs6000-builtin.def (BU_FLOAT128_2): New #define.
(BU_FLOAT128_1): Likewise.
(FABSQ): Likewise.
(COPYSIGNQ): Likewise.
(RS6000_BUILTIN_NANQ): Likewise.
(RS6000_BUILTIN_NANSQ): Likewise.
(RS6000_BUILTIN_INFQ): Likewise.
(RS6000_BUILTIN_HUGE_VALQ): Likewise.
* config/rs6000/rs6000.c (rs6000_fold_builtin): New prototype.
(TARGET_FOLD_BUILTIN): New #define.
(rs6000_builtin_mask_calculate): Add TARGET_FLOAT128 entry.
(rs6000_invalid_builtin): Add handling for RS6000_BTM_FLOAT128.
(rs6000_fold_builtin): New target hook implementation, handling
folding of 128-bit NaNs and infinities.
(rs6000_init_builtins): Initialize const_str_type_node; ensure all
entries are filled in to avoid problems during bootstrap
self-test; define builtins for 128-bit NaNs and infinities.
(rs6000_opt_mask): Add entry for float128.
* config/rs6000/rs6000.h (RS6000_BTM_FLOAT128): New #define.
(RS6000_BTM_COMMON): Include RS6000_BTM_FLOAT128.
(rs6000_builtin_type_index): Add RS6000_BTI_const_str.
(const_str_type_node): New #define.
* config/rs6000/rs6000.md (copysign3 for IEEE128): Convert
to a define_expand that dispatches to either copysign3_soft
or copysign3_hard.
(copysign3_hard): Rename from copysign3.
(copysign3_soft): New define_insn.
* doc/extend.texi: Document new builtins.

[gcc/testsuite]

2016-06-23  Bill Schmidt  

* gcc.target/powerpc/abs128-1.c: New.
* gcc.target/powerpc/copysign128-1.c: New.
* gcc.target/powerpc/inf128-1.c: New.
* gcc.target/powerpc/nan128-1.c: New.


Index: gcc/config/rs6000/rs6000-builtin.def
===
--- gcc/config/rs6000/rs6000-builtin.def(revision 237619)
+++ gcc/config/rs6000/rs6000-builtin.def(working copy)
@@ -652,7 +652,23 @@
 | RS6000_BTC_BINARY),  \
CODE_FOR_ ## ICODE) /* ICODE */
 
+/* IEEE 128-bit floating-point builtins.  */
+#define BU_FLOAT128_2(ENUM, NAME, ATTR, ICODE)  \
+  RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM,  /* ENUM */  \
+"__builtin_" NAME,  /* NAME */  \
+   RS6000_BTM_FLOAT128,/* MASK */  \
+   (RS6000_BTC_ ## ATTR/* ATTR */  \
+| RS6000_BTC_BINARY),  \
+   CODE_FOR_ ## ICODE) /* ICODE */
 
+#define BU_FLOAT128_1(ENUM, NAME, ATTR, ICODE)  \
+  RS6000_BUILTIN_1 (MISC_BUILTIN_ ## ENUM,  /* ENUM */  \
+"__builtin_" NAME,  /* NAME */  \
+   RS6000_BTM_FLOAT128,/* MASK */  \
+   (RS6000_BTC_ ## ATTR/* ATTR */  \
+| RS6000_BTC_UNARY),   \
+   CODE_FOR_ ## ICODE) /* ICODE */
+
 /* Miscellaneous builtins for instructions added in ISA 3.0.  These
instructions don't require either the DFP or VSX options, just the basic
ISA 3.0 enablement since they operate on general purpose registers.  */
@@ -1814,6 +1830,11 @@ BU_P9V_OVERLOAD_1 (VPRTYBD,  "vprtybd")
 BU_P9V_OVERLOAD_1 (VPRTYBQ,"vprtybq")
 BU_P9V_OVERLOAD_1 (VPRTYBW,"vprtybw")
 
+/* 1 argument IEEE 128-bit floating-point functions.  */
+BU_FLOAT128_1 (FABSQ,  "fabsq",   CONST, abskf2)
+
+/* 2 argument IEEE 128-bit floating-point functions.  */
+BU_FLOAT128_2 (COPYSIGNQ,  "copysignq",   CONST, copysignkf3)
 
 /* 1 argument crypto functions.  */
 BU_CRYPTO_1 (VSBOX,"vsbox",  CONST, crypto_vsbox)
@@ -2191,6 +2212,18 @@ BU_SPECIAL_X (RS6000_BUILTIN_CPU_IS, "__builtin_cp
 BU_SPECIAL_X (RS6000_BUILTIN_CPU_SUPPORTS, "__builtin_cpu_supports",
  RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
 
+BU_SPECIAL_X (RS6000_BUILTIN_NANQ, "__builtin_nanq",
+