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: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: 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 09:31:43 -0500
- 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>
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 :-)
> -;; 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.
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)?
> + 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.
> + 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);
and then just generate the one form?
Segher