public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Michael Meissner <meissner@linux.vnet.ibm.com>,
	gcc-patches@gcc.gnu.org,
	       David Edelsohn <dje.gcc@gmail.com>,
	       Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Subject: Re: [PATCH], Add PowerPC ISA 3.0 min/max support
Date: Mon, 09 May 2016 14:31:00 -0000	[thread overview]
Message-ID: <20160509143143.GC31139@gate.crashing.org> (raw)
In-Reply-To: <20160505191839.GA7023@ibm-tiger.the-meissners.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

  reply	other threads:[~2016-05-09 14:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05 19:19 Michael Meissner
2016-05-09 14:31 ` Segher Boessenkool [this message]
2016-05-09 18:48   ` Michael Meissner
2016-05-26 17:56   ` Michael Meissner
2016-05-27  8:31     ` Segher Boessenkool
2016-05-27  9:08       ` 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=20160509143143.GC31139@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=meissner@linux.vnet.ibm.com \
    --cc=wschmidt@linux.vnet.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).