This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PPro patch for egcs
- To: john at feith dot com (John Wehle)
- Subject: Re: PPro patch for egcs
- From: hjl at lucon dot org (H.J. Lu)
- Date: Wed, 3 Jun 1998 11:02:35 -0700 (PDT)
- Cc: law at cygnus dot com, egcs at cygnus dot com
>
> > * config/i386/i386.c (output_fp_conditional_move): New function
> > to output floating point conditional move.
> > (output_int_conditional_move): New function to output integer
> > conditional move.
> >
> > * config/i386/i386.md (movsicci+5, movhicc+5, movdicc+5): Call
> > output_int_conditional_move () to output int conditional move.
> > (movsfcc+5, movdfcc+5, movxfcc+5): Call
> > output_fp_conditional_move () to output floating point
> > conditional move.
>
> I don't understand why you are checking for which_alternative == 3
> in output_fp_conditional_move. The define_insn for the floating
> point conditional moves should only result in which_alternative
> equaling 0, 1, or 2. Any other value should cause an abort.
I forgot to remove 3.
>
> The special case handling of DImode in output_int_conditional_move
> seems more complicated than the original code associated with the
> define_insn for the DImode integer conditional move. What is the
> advantage of creating a complicated function?
>
Ok, I simplified output_int_conditional_move. We have to handle some
special cases for integer conditional move. It is better to do it
in one place.
Here are new output_fp_conditional_move and output_int_conditional_move.
Thanks.
H.J.
------
char *
output_fp_conditional_move (which_alternative, operands)
int which_alternative;
rtx operands[];
{
if (which_alternative == 0)
{
/* r <- cond ? arg : r */
output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
}
else if (which_alternative == 1)
{
/* r <- cond ? r : arg */
output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
}
else if (which_alternative == 2)
{
/* r <- cond ? r : arg */
output_asm_insn (AS2 (fcmov%F1,%2,%0), operands);
output_asm_insn (AS2 (fcmov%f1,%3,%0), operands);
}
else
abort ();
return "";
}
char *
output_int_conditional_move (which_alternative, operands)
int which_alternative;
rtx operands[];
{
int code = GET_CODE (operands[1]);
enum machine_mode mode;
rtx xops[4];
if ((code == GT || code == LE)
&& (cc_prev_status.flags & CC_NO_OVERFLOW))
return NULL_PTR;
mode = GET_MODE (operands [0]);
if (mode == DImode)
{
xops [0] = gen_rtx_SUBREG (SImode, operands [0], 1);
xops [1] = operands [1];
xops [2] = gen_rtx_SUBREG (SImode, operands [2], 1);
xops [3] = gen_rtx_SUBREG (SImode, operands [3], 1);
}
if (which_alternative == 0)
{
/* r <- cond ? arg : r */
output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
if (mode == DImode)
output_asm_insn (AS2 (cmov%C1,%2,%0), xops);
}
else if (which_alternative == 1)
{
/* r <- cond ? r : arg */
output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
if (mode == DImode)
output_asm_insn (AS2 (cmov%c1,%3,%0), xops);
}
else if (which_alternative == 2)
{
/* rm <- cond ? arg1 : arg2 */
output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
if (mode == DImode)
{
output_asm_insn (AS2 (cmov%C1,%2,%0), xops);
output_asm_insn (AS2 (cmov%c1,%3,%0), xops);
}
}
else
abort ();
return "";
}