From: will schmidt <will_schmidt@vnet.ibm.com>
To: Michael Meissner <meissner@linux.ibm.com>,
gcc-patches@gcc.gnu.org,
Segher Boessenkool <segher@kernel.crashing.org>,
David Edelsohn <dje.gcc@gmail.com>,
Bill Schmidt <wschmidt@linux.ibm.com>,
Peter Bergner <bergner@linux.ibm.com>
Subject: Re: [PATCH 1/2] Add IEEE 128-bit min/max support on PowerPC.
Date: Thu, 20 May 2021 14:25:58 -0500 [thread overview]
Message-ID: <cd34783a6820c7e47acc6aba47f90b55a8fcf2f2.camel@vnet.ibm.com> (raw)
In-Reply-To: <20210518202606.GA14382@ibm-toto.the-meissners.org>
On Tue, 2021-05-18 at 16:26 -0400, Michael Meissner wrote:
> [PATCH 1/2] Add IEEE 128-bit min/max support on PowerPC.
>
Hi,
> This patch adds the support for the IEEE 128-bit floating point C minimum and
> maximum instructions. The next patch will add the support for using the
> compare and set mask instruction to implement conditional moves.
>
> This patch does not try to re-use the code used for SF/DF min/max
> support. It defines a separate insn for the IEEE 128-bit support. It
> uses the code iterator <minmax> to simplify adding both operations.
>
> GCC will not convert ?: operations into using min/max instructions provided in
I'd throw the ternary term in there, easier to search for later.
s/?: operations/ternary (?:) operations /
> this patch unless the user uses -Ofast or similar switches due to issues with
> NaNs. The next patch that adds conditional move instructions will enable the
> ?: conversion in many cases.
>
> I have done bootstrap builds with this patch on the following 3 systems:
> 1) power9 running LE Linux using --with-cpu=power9
> 2) power8 running BE Linux using --with-cpu=power8, testing both
> 32/64-bit.
> 3) power10 prototype running LE Linux using --with-cpu=power10.
>
> There were no regressions to the tests, and the new test added passed. Can I
> check these patches into trunk branch for GCC 12?
>
> I would like to check these patches into GCC 11 after a cooling off period, but
> I can also not do the backport if desired.
>
> gcc/
> 2021-05-18 Michael Meissner <meissner@linux.ibm.com>
>
> * config/rs6000/rs6000.c (rs6000_emit_minmax): Add support for ISA
> 3.1 IEEE 128-bit floating point xsmaxcqp and xsmincqp
> instructions.
> * config/rs6000/rs6000.md (s<minmax><mode>3, IEEE128 iterator):
> New insns.
ok
>
> gcc/testsuite/
> 2021-05-18 Michael Meissner <meissner@linux.ibm.com>
>
> * gcc.target/powerpc/float128-minmax-2.c: New test.
> * gcc.target/powerpc/float128-minmax.c: Turn off power10 code
> generation.
So, presumably the float128-minmax-2.c test adds/replaces the power10
code gen tests that were removed or disabled from float128-minmax.c.
> ---
> gcc/config/rs6000/rs6000.c | 3 ++-
> gcc/config/rs6000/rs6000.md | 11 +++++++++++
> .../gcc.target/powerpc/float128-minmax-2.c | 15 +++++++++++++++
> .../gcc.target/powerpc/float128-minmax.c | 7 +++++++
> 4 files changed, 35 insertions(+), 1 deletion(-)
> create mode 100644 gcc/testsuite/gcc.target/powerpc/float128-minmax-2.c
>
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 0d0595dddd6..fdaf12aeda0 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -16111,7 +16111,8 @@ rs6000_emit_minmax (rtx dest, enum rtx_code code, rtx op0, rtx op1)
> /* VSX/altivec have direct min/max insns. */
> if ((code == SMAX || code == SMIN)
> && (VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode)
> - || (mode == SFmode && VECTOR_UNIT_VSX_P (DFmode))))
> + || (mode == SFmode && VECTOR_UNIT_VSX_P (DFmode))
> + || (TARGET_POWER10 && TARGET_FLOAT128_HW && FLOAT128_IEEE_P (mode))))
> {
> emit_insn (gen_rtx_SET (dest, gen_rtx_fmt_ee (code, mode, op0, op1)));
> return;
> diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
> index 0bfeb24d9e8..3a1bc1f8547 100644
> --- a/gcc/config/rs6000/rs6000.md
> +++ b/gcc/config/rs6000/rs6000.md
> @@ -5196,6 +5196,17 @@ (define_insn "*s<minmax><mode>3_vsx"
> }
> [(set_attr "type" "fp")])
>
> +;; Min/max for ISA 3.1 IEEE 128-bit floating point
> +(define_insn "s<minmax><mode>3"
> + [(set (match_operand:IEEE128 0 "altivec_register_operand" "=v")
> + (fp_minmax:IEEE128
> + (match_operand:IEEE128 1 "altivec_register_operand" "v")
> + (match_operand:IEEE128 2 "altivec_register_operand" "v")))]
> + "TARGET_POWER10"
> + "xs<minmax>cqp %0,%1,%2"
> + [(set_attr "type" "vecfloat")
> + (set_attr "size" "128")])
> +
> ;; The conditional move instructions allow us to perform max and min operations
> ;; even when we don't have the appropriate max/min instruction using the FSEL
> ;; instruction.
ok
> diff --git a/gcc/testsuite/gcc.target/powerpc/float128-minmax-2.c b/gcc/testsuite/gcc.target/powerpc/float128-minmax-2.c
> new file mode 100644
> index 00000000000..c71ba08c9f8
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/float128-minmax-2.c
> @@ -0,0 +1,15 @@
> +/* { dg-require-effective-target ppc_float128_hw } */
> +/* { dg-require-effective-target power10_ok } */
> +/* { dg-options "-mdejagnu-cpu=power10 -O2 -ffast-math" } */
> +
> +#ifndef TYPE
> +#define TYPE _Float128
> +#endif
> +
> +/* Test that the fminf128/fmaxf128 functions generate if/then/else and not a
> + call. */
> +TYPE f128_min (TYPE a, TYPE b) { return __builtin_fminf128 (a, b); }
> +TYPE f128_max (TYPE a, TYPE b) { return __builtin_fmaxf128 (a, b); }
> +
> +/* { dg-final { scan-assembler {\mxsmaxcqp\M} } } */
> +/* { dg-final { scan-assembler {\mxsmincqp\M} } } */
ok
> diff --git a/gcc/testsuite/gcc.target/powerpc/float128-minmax.c b/gcc/testsuite/gcc.target/powerpc/float128-minmax.c
> index fe397518f2f..c3af759c0b9 100644
> --- a/gcc/testsuite/gcc.target/powerpc/float128-minmax.c
> +++ b/gcc/testsuite/gcc.target/powerpc/float128-minmax.c
> @@ -3,6 +3,13 @@
> /* { dg-require-effective-target float128 } */
> /* { dg-options "-mpower9-vector -O2 -ffast-math" } */
>
> +/* If the compiler was configured to automatically generate power10 support with
> + --with-cpu=power10, turn it off. Otherwise, it will generate XXMAXCQP and
> + XXMINCQP instructions. */
> +#ifdef _ARCH_PWR10
> +#pragma GCC target ("cpu=power9")
> +#endif
Probably fine.. It's good to exercise the pragma target stuff, thoguh
I wonder if it would be better to just specify -mcpu=power9 in the
options since we are already specifying (redundant?) -mpower9-vector.
I see similar changes in a later patch, probably OK there since those
tests do not appear to be specifying -mcpu=foo options that are already
pointed at power9 features...
> +
> #ifndef TYPE
> #define TYPE _Float128
> #endif
> --
> 2.31.1
lgtm,
thanks
-Will
>
>
next prev parent reply other threads:[~2021-05-20 19:26 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 20:22 [PATCH 0/2] Add power10 IEEE 128-bit min/max/conditional move support Michael Meissner
2021-05-18 20:26 ` [PATCH 1/2] Add IEEE 128-bit min/max support on PowerPC Michael Meissner
2021-05-20 19:25 ` will schmidt [this message]
2021-05-21 1:38 ` Michael Meissner
2021-06-07 20:08 ` Segher Boessenkool
2021-05-24 15:47 ` Ping " Michael Meissner
2021-06-01 23:38 ` Ping #2: " Michael Meissner
2021-06-07 20:25 ` Segher Boessenkool
2021-06-08 23:52 ` Michael Meissner
2021-05-18 20:28 ` [PATCH 2/2] Add IEEE 128-bit fp conditional move " Michael Meissner
2021-05-20 19:27 ` will schmidt
2021-05-21 1:45 ` Michael Meissner
2021-06-07 21:29 ` Segher Boessenkool
2021-05-24 15:49 ` Ping " Michael Meissner
2021-06-01 23:39 ` Ping #2: " Michael Meissner
2021-06-07 22:31 ` Segher Boessenkool
2021-06-09 0:05 ` Michael Meissner
-- strict thread matches above, loose matches on Subject: below --
2021-04-15 15:57 [PATCH 0/2] Add IEEE 128-bit min/max/conditional move Michael Meissner
2021-04-15 16:00 ` [PATCH 1/2] Add IEEE 128-bit min/max support on PowerPC Michael Meissner
2021-04-09 14:38 [PATCH 0/2] " Michael Meissner
2021-04-09 14:42 ` [PATCH 1/2] " Michael Meissner
2021-04-09 16:54 ` will schmidt
2021-04-13 17:57 ` Segher Boessenkool
2021-04-13 22:19 ` Segher Boessenkool
2021-04-14 19:09 ` Michael Meissner
2021-04-14 19:15 ` Segher Boessenkool
2021-04-14 20:51 ` Michael Meissner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd34783a6820c7e47acc6aba47f90b55a8fcf2f2.camel@vnet.ibm.com \
--to=will_schmidt@vnet.ibm.com \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=meissner@linux.ibm.com \
--cc=segher@kernel.crashing.org \
--cc=wschmidt@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).