This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 64-bit PowerPC SCC instruction generation


>>>>> Michael Meissner writes:

Michael> You should be able to change the GET_MODE tests to just look at op0, since the
Michael> compiler canonicalizes the constant to always be in the op1 position.  Also, I
Michael> don't believe that you want the mode to be SI for floating point compares in
Michael> the powerpc64 case.

	So you recommend something like this instead?

(define_expand "seq"
  [(set (match_dup 2) (match_dup 1))
   (set (match_operand:SI 0 "gpc_reg_operand" "")
        (eq:SI (match_dup 2) (const_int 0)))]
  ""
  "
{ enum machine_mode mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  operands[1] = gen_rtx_COMPARE (mode,
                                 rs6000_compare_op0, rs6000_compare_op1);
  operands[2] = gen_reg_rtx (mode);

  if (TARGET_POWERPC64
      && (GET_MODE (rs6000_compare_op0) == DImode || rs6000_compare_fp_p))
    {
      emit_insn (gen_rtx_SET (VOIDmode, operands[2], operands[1]));
      convert_move (operands[0],
                    gen_rtx_EQ (DImode, operands[2], const0_rtx), 0);
      DONE;
    }
}")

	Should I change the mode test to use the mode of op1 is op0 is
VOIDmode, as is done in mips.c:gen_int_relational()?  In other words,

(define_expand "seq"
  [(set (match_dup 2) (match_dup 1))
   (set (match_operand:SI 0 "gpc_reg_operand" "")
        (eq:SI (match_dup 2) (const_int 0)))]
  ""
  "
{ enum machine_mode opmode, mode = rs6000_compare_fp_p ? CCFPmode : CCmode;
  operands[1] = gen_rtx_COMPARE (mode,
                                 rs6000_compare_op0, rs6000_compare_op1);
  operands[2] = gen_reg_rtx (mode);

  opmode = GET_MODE (rs6000_compare_op0);
  if (opmode == VOIDmode)
    opmode = GET_MODE (rs6000_compare_op1);

  if (TARGET_POWERPC64 && (opmode == DImode || rs6000_compare_fp_p))
    {
      emit_insn (gen_rtx_SET (VOIDmode, operands[2], operands[1]));
      convert_move (operands[0],
                    gen_rtx_EQ (DImode, operands[2], const0_rtx), 0);
      DONE;
    }
}")

Thanks, David

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]