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]
Other format: [Raw text]

Troubles reloading in gcc-2.95.3



I'm trying to get the 'btst' instruction to be supported by GCC for
coldfire, and I'm having trouble with gcc not being able to reload.

I've cloned one of the simple patterns for zero_extract:

(define_insn "btst_qi_mem"
  [(set (cc0) (zero_extract (match_operand:QI 0 "btst_imm_addr_operand" "QS")
			    (const_int 1)
			    (match_operand:SI 1 "const_int_operand" "n")))]
  "(unsigned) INTVAL (operands[1]) < 8 && TARGET_5200"
  "*
{
  operands[1] = GEN_INT (7 - INTVAL (operands[1]));
  return output_btst (operands, operands[1], operands[0], insn, 7);
}")

Since the ColdFire can not deal with a absolute address as an operand
to btst if the bit number is constant, I couldn't use 'general_operand
"m"' in the match_operand for the first operand.  I created 
'btst_imm_addr_operand' which rejects any operand that isn't memory and is
not either address intdirect or register offset addressing(two of the
adressing modes that btst *can* handle):

int
btst_imm_addr_operand(op, mode)
     rtx op;
     enum machine_mode mode;
{
  if (EXTRA_CONSTRAINT(op, 'Q'))
    return 1;
  else if (EXTRA_CONSTRAINT(op, 'S'))
    return 1;
  else
    return 0;
}

and EXTRA_CONSTRAINTS is now:

#define EXTRA_CONSTRAINT(OP, C)	\
  ((C) == 'Q' ? (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG) : \
   (C) == 'S' ? (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == PLUS   \
		 && (GET_CODE (XEXP(XEXP(OP, 0),0)) == REG  		   \
		     && GET_CODE (XEXP(XEXP(OP, 0),1)) == CONST_INT	   \
		   || GET_CODE (XEXP(XEXP(OP, 0),0)) == CONST_INT	   \
		     && GET_CODE (XEXP(XEXP(OP, 0),1)) == REG)) :	   \
   0 )


When I run the compiler over a large chunk of code that I have with
-m5200, I get the following error:

../spaceball/engstatus.c:4653: Unable to generate reloads for:
(insn:QI 246 4859 247 (set (cc0)
        (zero_extract:SI (mem/s:QI (const:SI (plus:SI (symbol_ref:SI ("dbgtrace"))
                        (const_int 7 [0x7]))) 0)
            (const_int 1 [0x1])
            (const_int 7 [0x7]))) 39 {btst_qi_mem} (nil)
    (nil))


I can understand why the btst_qi_mem pattern rejects this because the
first operand is the symbol 'dbgtrace' plus 7.  I placed a breakpoint
in recog(), and indeed, this pattern is rejected when the first
operand is a symbolic memory address.

I waded over the dumps from -da, and I didn't see anywhere a
btst_qi_mem instruction that has a symbolic expression as the first
operand. 

1) Does the pattern an constraints I've added look correct.
2) Does anybody have an idea of how I can track this down?

Thanks for any advice!

-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)


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