On Thu, May 20, 2021 at 02:27:06PM -0500, will schmidt wrote:
> > diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> > index fdaf12aeda0..ef1ebaaee05 100644
> > --- a/gcc/config/rs6000/rs6000.c
> > +++ b/gcc/config/rs6000/rs6000.c
> > @@ -15706,8 +15706,8 @@ rs6000_emit_vector_cond_expr (rtx dest, rtx 
> > op_true, rtx op_false,
> >    return 1;
> >  }
> > 
> > -/* Possibly emit the xsmaxcdp and xsmincdp instructions to emit a maximum 
> > or
> > -   minimum with "C" semantics.
> > +/* Possibly emit the xsmaxc{dp,qp} and xsminc{dp,qp} instructions to emit a
> > +   maximum or minimum with "C" semantics.
> > 
> >     Unless you use -ffast-math, you can't use these instructions to replace
> >     conditions that implicitly reverse the condition because the comparison
> > @@ -15783,6 +15783,7 @@ rs6000_maybe_emit_fp_cmove (rtx dest, rtx op, rtx 
> > true_cond, rtx false_cond)
> >    enum rtx_code code = GET_CODE (op);
> >    rtx op0 = XEXP (op, 0);
> >    rtx op1 = XEXP (op, 1);
> > +  machine_mode compare_mode = GET_MODE (op0);
> >    machine_mode result_mode = GET_MODE (dest);
> >    rtx compare_rtx;
> >    rtx cmove_rtx;
> > @@ -15791,6 +15792,35 @@ rs6000_maybe_emit_fp_cmove (rtx dest, rtx op, rtx 
> > true_cond, rtx false_cond)
> >    if (!can_create_pseudo_p ())
> >      return 0;
> > 
> > +  /* We allow the comparison to be either SFmode/DFmode and the true/false
> > +     condition to be either SFmode/DFmode.  I.e. we allow:
> > +
> > +   float a, b;
> > +   double c, d, r;
> > +
> > +   r = (a == b) ? c : d;
> > +
> > +    and:
> > +
> > +   double a, b;
> > +   float c, d, r;
> > +
> > +   r = (a == b) ? c : d;
> 
> 
> This new comment does not seem to align with the comments in the
> description, which statee "But you can't do ..." 

Yes, the comment is perhaps a little unclear.

> > +
> > +    but we don't allow intermixing the IEEE 128-bit floating point types 
> > with
> > +    the 32/64-bit scalar types.
> > +
> > +    It gets too messy where SFmode/DFmode can use any register and 
> > TFmode/KFmode
> > +    can only use Altivec registers.  In addtion, we would need to do a 
> > XXPERMDI
> > +    if we compare SFmode/DFmode and move TFmode/KFmode.  */
> > +
> > +  if (compare_mode == result_mode
> > +      || (compare_mode == SFmode && result_mode == DFmode)
> > +      || (compare_mode == DFmode && result_mode == SFmode))
> > +    ;
> > +  else
> > +    return false;
> 
> Interesting if/else block.  May want to reverse the logic. I defer if
> this way is notably simpler than inverting it.

I originally tried inverting it, and it just got messy.

> > +++ b/gcc/testsuite/gcc.target/powerpc/float128-minmax-3.c
> > @@ -0,0 +1,15 @@
> > +/* { dg-require-effective-target ppc_float128_hw } */
> > +/* { dg-require-effective-target power10_ok } */
> > +/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
> > +
> > +#ifndef TYPE
> > +#define TYPE _Float128
> > +#endif
> > +
> > +/* Test that the fminf128/fmaxf128 functions generate if/then/else and not 
> > a
> > +   call.  */
> 
> s/"if/then/else"/"minmax"/  ?

Thanks.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797

Reply via email to