This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with ColdFire restricted addressing modes (mode5.6combination)
>> Any other suggestions?
>
>You don't seem to have included the testcase, so my only options seem to
>be to explain how to debug reload.
I've reported this a bug #17114, testcase included.
I tried modifying the code to be:
(define_insn ""
[(set (match_operand:HI 0 "nonimmediate_operand" "=r<Q>,g,U")
(match_operand:HI 1 "general_operand" "g,r<Q>,U"))]
"TARGET_COLDFIRE && m68k_valid_move_operands(operands[0], operands[1], HImode)"
"* return output_move_himode (operands);")
where the 'Q' constraint is:
(((C) == 'Q') \
? (GET_CODE (OP) == MEM \
&& GET_CODE (XEXP (OP, 0)) == REG \
&& (!reload_in_progress || ((REGNO (XEXP (OP, 0))) < FIRST_PSEUDO_REGISTER))) \
and m68k_valid_move_operands is:
int
m68k_valid_move_operands(rtx dst, rtx src, enum machine_mode mode)
{
if (mode != HImode)
return 1;
/* Reject dest mode6, src mode6 */
if ((GET_CODE (src) == MEM
&& GET_CODE (XEXP (src, 0)) == PLUS
&& GET_CODE (XEXP (XEXP (src, 0), 0)) == REG
&& GET_CODE (XEXP (XEXP (src, 0), 1)) == CONST_INT)
&& m68k_valid_mode6_operand(dst)) {
printf("m68k_valid_move_operands: return 0!\n");
return 0;
}
return 1;
}
And m68k_valid_mode6_operands() is:
/* Return true if a valid mode 6 operand */
int
m68k_valid_mode6_operand(rtx op)
{
rtx op1, op2;
if (GET_CODE (op) != MEM)
return 0;
op = XEXP(op, 0);
if (GET_CODE (op) != PLUS || GET_MODE(op) != SImode)
return 0;
op1 = XEXP(op, 0);
if (GET_CODE(op1) != REG)
return 0;
op2 = XEXP(op, 1);
if (GET_CODE(op2) == CONST_INT)
return 0; /* (mem (plus:si (reg) (const_int))) */
debug_rtx(op);
if (GET_CODE(op2) == REG)
{
return 1; /* (mem (plus:si (reg) (reg))) */
}
return 0;
}
This is some code I whipped up to see if I can fend off the illegal
combination of operands for the move, but it doesn't fire. I see the
debug_rtx, but not the 'm68k_valid_move_operands: return 0!', and
still dies:
(plus:SI (reg/v/f:SI 39 [ uch ])
(reg/v:SI 34 [ i ]))
(plus:SI (reg/v/f:SI 39 [ uch ])
(reg/v:SI 34 [ i ]))
(plus:SI (reg/v/f:SI 39 [ uch ])
(reg/v:SI 34 [ i ]))
(plus:SI (reg/v/f:SI 39 [ uch ])
(reg/v:SI 34 [ i ]))
(plus:SI (reg/v/f:SI 39 [ uch ])
(reg/v:SI 34 [ i ]))
(plus:SI (reg/v/f:SI 39 [ uch ])
(reg/v:SI 34 [ i ]))
(plus:SI (reg/v/f:SI 9 %a1 [orig:39 uch ] [39])
(reg/v:SI 3 %d3 [orig:34 i ] [34]))
(plus:SI (reg/v/f:SI 9 %a1 [orig:39 uch ] [39])
(reg/v:SI 3 %d3 [orig:34 i ] [34]))
(plus:SI (reg/v/f:SI 9 %a1 [orig:39 uch ] [39])
(reg/v:SI 3 %d3 [orig:34 i ] [34]))
(plus:SI (reg/v/f:SI 9 %a1 [orig:39 uch ] [39])
(reg/v:SI 3 %d3 [orig:34 i ] [34]))
(plus:SI (reg/f:SI 14 %a6)
(reg:SI 9 %a1))
(plus:SI (reg/f:SI 14 %a6)
(reg:SI 9 %a1))
(plus:SI (reg/f:SI 14 %a6)
(reg:SI 9 %a1))
I'm thinking that recog() is not called for the instruction that reload
has cobbled together to see if its actually legal....
bug4.c.lreg has the following:
(insn 154 147 155 6 ./bug4.c:203 (set (mem/s:HI (plus:SI (reg/f:SI 200)
(const_int 20 [0x14])) [4 <variable>.FAT_cnt+0 S2 A16])
(subreg:HI (reg/v:SI 42 [ file_cnt ]) 2)) 29 {*m68k.md:790} (nil)
(nil))
bug4.c.greg has the following snippets in it:
Spilling for insn 154.
Using reg 8 for reload 0
Using reg 0 for reload 1
Reloads for insn # 154
Reload 0: reload_in (SI) = (reg/f:SI 7 %d7 [200])
ADDR_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 0)
reload_in_reg: (reg/f:SI 7 %d7 [200])
reload_reg_rtx: (reg:SI 9 %a1)
Reload 1: reload_in (SI) = (const_int -1458016 [0xffe9c0a0])
GENERAL_REGS, RELOAD_FOR_OPADDR_ADDR (opnum = 1)
reload_in_reg: (const_int -1458016 [0xffe9c0a0])
reload_reg_rtx: (reg:SI 9 %a1)
Reload 2: reload_out (HI) = (mem/s:HI (plus:SI (reg/f:SI 7 %d7 [200])
(const_int 20 [0x14])) [4 <variable>.FAT_cnt+0 S2 A16])
NO_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
reload_out_reg: (mem/s:HI (plus:SI (reg/f:SI 7 %d7 [200])
(const_int 20 [0x14])) [4 <variable>.FAT_cnt+0 S2 A16])
(insn 154 471 155 6 ./bug4.c:203 (set (mem/s:HI (plus:SI (reg:SI 9 %a1)
(const_int 20 [0x14])) [4 <variable>.FAT_cnt+0 S2 A16])
(mem:HI (plus:SI (reg/f:SI 14 %a6)
(reg:SI 9 %a1)) [45 file_cnt+0 S4 A16])) 29 {*m68k.md:790} (nil)
(nil))
--
Peter Barada
peter@the-baradas.com