diff mbox series

[02/18] rs6000: Move __builtin_mffsl to the [always] stanza

Message ID b2693bf80cdfcd9fd6980b16e2093b3f14b08bff.1630511334.git.wschmidt@linux.ibm.com
State New
Headers show
Series Replace the Power target-specific builtin machinery | expand

Commit Message

Bill Schmidt Sept. 1, 2021, 4:13 p.m. UTC
I over-restricted use of __builtin_mffsl, since I was unaware that it
automatically uses mffs when mffsl is not available.  Paul Clarke pointed
this out in discussion of his SSE 4.1 compatibility patches.

2021-08-31  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (__builtin_mffsl): Move from [power9]
	to [always].
---
 gcc/config/rs6000/rs6000-builtin-new.def | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

will schmidt Sept. 13, 2021, 5:53 p.m. UTC | #1
On Wed, 2021-09-01 at 11:13 -0500, Bill Schmidt via Gcc-patches wrote:
> I over-restricted use of __builtin_mffsl, since I was unaware that it
> automatically uses mffs when mffsl is not available.  Paul Clarke
> pointed
> this out in discussion of his SSE 4.1 compatibility patches.
> 
> 2021-08-31  Bill Schmidt  <wschmidt@linux.ibm.com>
> 
> gcc/
> 	* config/rs6000/rs6000-call.c (__builtin_mffsl): Move from
> [power9]
> 	to [always].
> ---
>  gcc/config/rs6000/rs6000-builtin-new.def | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/config/rs6000/rs6000-builtin-new.def
> b/gcc/config/rs6000/rs6000-builtin-new.def
> index 6a28d5189f8..a8c6b9e988f 100644
> --- a/gcc/config/rs6000/rs6000-builtin-new.def
> +++ b/gcc/config/rs6000/rs6000-builtin-new.def
> @@ -208,6 +208,12 @@
>    double __builtin_mffs ();
>      MFFS rs6000_mffs {}
> 
> +; Although the mffsl instruction is only available on POWER9 and
> later
> +; processors, this builtin automatically falls back to mffs on older
> +; platforms.  Thus it appears here in the [always] stanza.
> +  double __builtin_mffsl ();
> +    MFFSL rs6000_mffsl {}
> +
>  ; This thing really assumes long double == __ibm128, and I'm told it
> has
>  ; been used as such within libgcc.  Given that __builtin_pack_ibm128
>  ; exists for the same purpose, this should really not be used at
> all.
> @@ -2784,9 +2790,6 @@
>    signed long long __builtin_darn_raw ();
>      DARN_RAW darn_raw {}
> 
> -  double __builtin_mffsl ();
> -    MFFSL rs6000_mffsl {}
> -
>    const signed int __builtin_dtstsfi_eq_dd (const int<6>,
> _Decimal64);
>      TSTSFI_EQ_DD dfptstsfi_eq_dd {}
> 


Looks reasonable,
Thanks
-Will
Segher Boessenkool Sept. 16, 2021, 10:52 p.m. UTC | #2
On Wed, Sep 01, 2021 at 11:13:38AM -0500, Bill Schmidt wrote:
> I over-restricted use of __builtin_mffsl, since I was unaware that it
> automatically uses mffs when mffsl is not available.  Paul Clarke pointed
> this out in discussion of his SSE 4.1 compatibility patches.

Right.  Do we need to document this better?  There are more builtins
that can generate code for older archs than you might expect (like,
set_fpscr_rn).

Hrm, it *is* documented, but in a big wall of text.  Not sure we can do
much better though, there simply are this many builtins, but maybe you
have an idea how to arrange things better?

Anyway: okay for trunk.  Thanks!


Segher
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000-builtin-new.def b/gcc/config/rs6000/rs6000-builtin-new.def
index 6a28d5189f8..a8c6b9e988f 100644
--- a/gcc/config/rs6000/rs6000-builtin-new.def
+++ b/gcc/config/rs6000/rs6000-builtin-new.def
@@ -208,6 +208,12 @@ 
   double __builtin_mffs ();
     MFFS rs6000_mffs {}
 
+; Although the mffsl instruction is only available on POWER9 and later
+; processors, this builtin automatically falls back to mffs on older
+; platforms.  Thus it appears here in the [always] stanza.
+  double __builtin_mffsl ();
+    MFFSL rs6000_mffsl {}
+
 ; This thing really assumes long double == __ibm128, and I'm told it has
 ; been used as such within libgcc.  Given that __builtin_pack_ibm128
 ; exists for the same purpose, this should really not be used at all.
@@ -2784,9 +2790,6 @@ 
   signed long long __builtin_darn_raw ();
     DARN_RAW darn_raw {}
 
-  double __builtin_mffsl ();
-    MFFSL rs6000_mffsl {}
-
   const signed int __builtin_dtstsfi_eq_dd (const int<6>, _Decimal64);
     TSTSFI_EQ_DD dfptstsfi_eq_dd {}