Right : A way to work around this would be to hold to not match this
instruction until reload has been completed and have a define_split to
convert this to a cmp , bne when its a memory operand matching . Look at
rs6000.md or mt.md for a sample implementation.
What I am saying is the following.
1. Add an extra scratch register with a clobber pattern in your bcounter
insn .
2. Have a define_insn which matches this if the 'q' register could be
given for this .
3. Have a define_split pattern for the case where your first operand is
a memory_operand in which case you take care of loading this into a
register and then generate equivalent cmp and jmp instructions.
My 2 cents .
HTH
cheers
Ramana
On Thu, 2006-04-13 at 21:17 +0800, Ching-Hua Chang wrote:
> Hi,
> I had wrote doloop_end instruction to support hwloop.
> When try to compile linux kernel, I meet a reload problem,
> the error message as follow.
>
> What kinds of instuction pattern should I add to support
> the reload that compiler need ?
>
> Thanks,
> Aladdin
>
>
> the constrant 'q' mean the non-general "counter" register
> ========================================================
> (define_expand "doloop_end"
> [(use (match_operand:SI 0 "register_operand" ""))
> (use (match_operand:SI 1 "const_int_operand" ""))
> (use (match_operand:SI 2 "const_int_operand" ""))
> (use (match_operand:SI 3 "const_int_operand" ""))
> (use (label_ref (match_operand 4 "" "")))]
> ""
> {
> if(operands[3] != const1_rtx || flag_unroll_loops ||
> flag_unroll_all_loops)
> FAIL;
> emit_jump_insn(gen_bcounter(operands[0], operands[4]));
> DONE;
> })
>
> (define_insn "bcounter"
> [(set(pc) (if_then_else
> (ge (match_operand:SI 0 "register_operand" "=q") (const_int
> 0))
> (label_ref (match_operand 1 "" ""))
> (pc)))
> (set(match_dup 0)
> (plus:SI (match_dup 0)
> (const_int -1)))]
> ""
> "bcnz %1"
> [(set_attr "type" "branch")])
>
>
> Error message
> ===================================================================
> panic.c: In function `panic':
> panic.c:104: error: unable to generate reloads for:
> (jump_insn 222 152 158 7 (parallel [
> (set (pc)
> (if_then_else (ge (reg:SI 5 r5 [orig:199 msec ] [199])
> (const_int 0 [0x0]))
> (label_ref 224)
> (pc)))
> (set (reg:SI 5 r5 [orig:199 msec ] [199])
> (plus:SI (reg:SI 5 r5 [orig:199 msec ] [199])
> (const_int -1 [0xffffffff])))
> ]) 0 {bcounter} (nil)
> (expr_list:REG_BR_PROB (const_int 8900 [0x22c4])
> (nil)))
> panic.c:104: internal compiler error: in find_reloads, at reload.c:3672
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://gcc.gnu.org/bugs.html> for instructions.
--
Ramana Radhakrishnan
GNU Tools
codito ergo sum (http://www.codito.com)