* on define_peephole2
@ 2005-07-21 10:33 Liu Haibin
2005-07-22 6:38 ` Liu Haibin
0 siblings, 1 reply; 2+ messages in thread
From: Liu Haibin @ 2005-07-21 10:33 UTC (permalink / raw)
To: gcc
Hi,
I have a problem on the define_peephole2. In nois2.md, there's such a
define_insn
(define_insn "addsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r")
(plus:SI (match_operand:SI 1 "register_operand" "%r,r")
(match_operand:SI 2 "arith_operand" "r,I")))]
""
"add%i2\\t%0, %1, %z2"
[(set_attr "type" "alu")])
I defined a peephole2 to replace this instruction.
(define_peephole2
[(set (match_operand:SI 0 "register_operand" "=r")
(plus:SI (match_operand:SI 1 "register_operand" "%r")
; (match_operand:SI 2 "arith_operand" "r")))]
(match_operand:SI 2 "register_operand" "r")))]
""
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec_volatile:SI [(match_operand:SI 4 "custom_insn_opcode" "N")
(match_operand:SI 1 "register_operand" "r")
(match_operand:SI 2 "register_operand" "r")] CUSTOM_INII))]
"
{
operands[4] = const0_rtx;
}")
Because the operand 2 in the replacing instruction must be a register,
I changed the "arith_operand" to "register_operand", hoping that it
only replaces something like, add r1, r2, r3 instead of addi r1, r2, 9
I did a test with a file, which contains
(insn/f 106 73 107 0 0x0 (set:SI (reg/f:SI 27 sp)
(plus:SI (reg/f:SI 27 sp)
(const_int -16 [0xfffffff0]))) -1 (nil)
(nil))
and it seems that it did try to replace it with the new instruct. And
I got the following error:
isqrt.c:65: error: unrecognizable insn:
(insn 123 73 107 0 0x0 (set (reg/f:SI 27 sp)
(unspec_volatile:SI [
(const_int 0 [0x0])
(reg/f:SI 27 sp)
(const_int -16 [0xfffffff0])
] 117)) -1 (nil)
(nil))
isqrt.c:65: internal compiler error: in extract_insn, at recog.c:2175
Any ideas why it still tries to replace it even when it's obviously
not a register (const_int -16)? Thanks.
Regards,
Timothy
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: on define_peephole2
2005-07-21 10:33 on define_peephole2 Liu Haibin
@ 2005-07-22 6:38 ` Liu Haibin
0 siblings, 0 replies; 2+ messages in thread
From: Liu Haibin @ 2005-07-22 6:38 UTC (permalink / raw)
To: gcc
On 7/21/05, Liu Haibin <liu.haibin@gmail.com> wrote:
> Hi,
>
> I have a problem on the define_peephole2. In nois2.md, there's such a
> define_insn
>
> (define_insn "addsi3"
> [(set (match_operand:SI 0 "register_operand" "=r,r")
> (plus:SI (match_operand:SI 1 "register_operand" "%r,r")
> (match_operand:SI 2 "arith_operand" "r,I")))]
> ""
> "add%i2\\t%0, %1, %z2"
> [(set_attr "type" "alu")])
>
> I defined a peephole2 to replace this instruction.
>
> (define_peephole2
> [(set (match_operand:SI 0 "register_operand" "=r")
> (plus:SI (match_operand:SI 1 "register_operand" "%r")
> ; (match_operand:SI 2 "arith_operand" "r")))]
> (match_operand:SI 2 "register_operand" "r")))]
> ""
> [(set (match_operand:SI 0 "register_operand" "=r")
> (unspec_volatile:SI [(match_operand:SI 4 "custom_insn_opcode" "N")
my mistake. should be match_operand:SI 3 here. Now no more error.
> (match_operand:SI 1 "register_operand" "r")
> (match_operand:SI 2 "register_operand" "r")] CUSTOM_INII))]
> "
> {
> operands[4] = const0_rtx;
> }")
>
> Because the operand 2 in the replacing instruction must be a register,
> I changed the "arith_operand" to "register_operand", hoping that it
> only replaces something like, add r1, r2, r3 instead of addi r1, r2, 9
>
> I did a test with a file, which contains
>
> (insn/f 106 73 107 0 0x0 (set:SI (reg/f:SI 27 sp)
> (plus:SI (reg/f:SI 27 sp)
> (const_int -16 [0xfffffff0]))) -1 (nil)
> (nil))
>
> and it seems that it did try to replace it with the new instruct. And
> I got the following error:
>
> isqrt.c:65: error: unrecognizable insn:
> (insn 123 73 107 0 0x0 (set (reg/f:SI 27 sp)
> (unspec_volatile:SI [
> (const_int 0 [0x0])
> (reg/f:SI 27 sp)
> (const_int -16 [0xfffffff0])
> ] 117)) -1 (nil)
> (nil))
> isqrt.c:65: internal compiler error: in extract_insn, at recog.c:2175
>
> Any ideas why it still tries to replace it even when it's obviously
> not a register (const_int -16)? Thanks.
>
>
> Regards,
> Timothy
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-07-22 6:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-21 10:33 on define_peephole2 Liu Haibin
2005-07-22 6:38 ` Liu Haibin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).