This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH], Add PowerPC ISA 3.0 min/max support
- From: Michael Meissner <meissner at linux dot vnet dot ibm dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: Michael Meissner <meissner at linux dot vnet dot ibm dot com>, gcc-patches at gcc dot gnu dot org, David Edelsohn <dje dot gcc at gmail dot com>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- Date: Mon, 9 May 2016 14:48:34 -0400
- Subject: Re: [PATCH], Add PowerPC ISA 3.0 min/max support
- Authentication-results: sourceware.org; auth=none
- References: <20160505191839 dot GA7023 at ibm-tiger dot the-meissners dot org> <20160509143143 dot GC31139 at gate dot crashing dot org>
On Mon, May 09, 2016 at 09:31:43AM -0500, Segher Boessenkool wrote:
> On Thu, May 05, 2016 at 03:18:39PM -0400, Michael Meissner wrote:
> > At the present time, the code does not support comparisons involving >= and <=
> > unless the -ffast-math option is used. I hope eventually to support generating
> > these instructions without having -ffast-math used.
> >
> > The underlying reason is when fast math is not used, we change the condition
> > from:
> >
> > (ge:SI (reg:CCFP <reg>) (const_int 0))
> >
> > to:
> >
> > (ior:SI (gt:SI (reg:CCFP <reg>) (const_int 0))
> > (eq:SI (reg:CCFP <reg>) (const_int 0)))
> >
> > The machine independent portion of the compiler does not recognize this when
> > trying to generate conditional moves.
> >
> > I would imagine the 'fix' is to generate GE/LE all of the time, and then have a
> > splitter that converts it to IOR of GT/EQ if it is not a conditional move with
> > ISA 3.0 instructions.
>
> That sounds like a plan :-)
Sure, but at the moment it is lower priority to do it than all of the other
things that I'm doing at the moment. Patches by other people are welcome.
> > -;; Return true if operand is MIN or MAX operator.
> > +;; Return true if operand is MIN or MAX operator. Since this is only used to
> > +;; convert floating point MIN/MAX operations into FSEL on pre-vsx systems,
> > +;; don't include UMIN or UMAX.
> > (define_predicate "min_max_operator"
> > - (match_code "smin,smax,umin,umax"))
> > + (match_code "smin,smax"))
>
> Please name it signed_min_max_operator instead?
>
> > --- gcc/config/rs6000/rs6000.c (.../svn+ssh://meissner@gcc.gnu.org/svn/gcc/trunk/gcc/config/rs6000) (revision 235831)
> > +++ gcc/config/rs6000/rs6000.c (.../gcc/config/rs6000) (working copy)
> > @@ -20534,6 +20534,12 @@ print_operand (FILE *file, rtx x, int co
> > "local dynamic TLS references");
> > return;
> >
> > + case '@':
> > + /* If -mpower9-minmax, use xsmaxcpdp instead of xsmaxdp. */
> > + if (TARGET_P9_MINMAX)
> > + putc ('c', file);
> > + return;
>
> I don't think @ is very mnemonic, nor is this special enough for such
> a nice letter.
I don't care what punctuation letter is used, but it needs to be one. What do
you prefer?
>
> Form looking at how it is used, it seems you can make it part of code_attr
> minmax (and give that a better name, minmax_fp or such)?
It is used to distinguish between generating
XSMAXDP on power7 with -ffast-math
and XSMAXCDP on power9 with/without -ffast-math
I would prefer not to have to change this to C code, hence the use of a
punctuation print operand code. But if you insist, I can just do it with if's.
> > + rs6000_emit_minmax (dest, (max_p) ? SMAX : SMIN, op0, op1);
>
> Superfluous parentheses.
>
> > +rs6000_emit_power9_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond)
>
> Maybe put some "fp" in the name? For "minmax" as well.
Sigh, ok.
> > + if (swap_p)
> > + compare_rtx = gen_rtx_fmt_ee (code, CCFPmode, op1, op0);
> > + else
> > + compare_rtx = gen_rtx_fmt_ee (code, CCFPmode, op0, op1);
>
> if (swap_p)
> std::swap (op0, op1);
I'll look into it.
--
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797