On 25/03/2005, at 12:16 PM, David Edelsohn wrote: >>>>>> Andrew Pinski writes: > > Andrew> I was wondering the same thing until I notice that some > Andrew> of the functions used in EXTRA_CONSTRAINT are only defined > Andrew> in rs6000.c. > > Most of them now are defined in predicates.md. > word_offset_memrf_operand and indexed_or_indirect_operand should be > moved > to predicates.md as a C block with (match_operand 0 "memory_operand"). > I'll look into it this weekend after the initial patch settles. Like this? word_offset_memref_operand is somewhat tricky. I'm pretty sure, but not 100%, that I'm doing the same as the original code, but am not at all sure that the original code is right. *** predicates.md.~1.8.~ Thu Mar 24 18:52:44 2005 --- predicates.md Fri Mar 25 16:16:22 2005 *************** *** 358,363 **** --- 358,379 ---- || reload_in_progress, mode, XEXP (op, 0))"))) + ;; Return 1 if the operand is an indexed or indirect memory operand. + (define_predicate "indexed_or_indirect_operand" + (and (match_operand 0 "memory_operand") + (match_test "REG_P (XEXP (op, 0)) + || (GET_CODE (XEXP (op, 0)) == PLUS + && REG_P (XEXP (XEXP (op, 0), 0)) + && REG_P (XEXP (XEXP (op, 0), 1)))"))) + + ;; Return 1 if the operand is a memory operand with an address divisible by 4 + (define_predicate "word_offset_memref_operand" + (and (match_operand 0 "memory_operand") + (match_test "GET_CODE (XEXP (op, 0)) != PLUS + || ! REG_P (XEXP (XEXP (op, 0), 0)) + || GET_CODE (XEXP (XEXP (op, 0), 1)) != CONST_INT + || INTVAL (XEXP (XEXP (op, 0), 1)) % 4 == 0"))) + ;; Return 1 if the operand is either a non-special register or can be used ;; as the operand of a `mode' add insn. (define_predicate "add_operand"