* canonical condition branch
@ 2010-09-29 15:26 Mike Stump
2010-10-03 9:29 ` Eric Botcazou
0 siblings, 1 reply; 2+ messages in thread
From: Mike Stump @ 2010-09-29 15:26 UTC (permalink / raw)
To: GCC Patches
I have a port with a pattern like:
(define_insn "*branch_if_bit_set"
[(set (pc)
(if_then_else
(zero_extract:DI (match_operand:DI 0 "register_operand" "r")
(const_int 1)
(match_operand 1 "immediate" ""))
(label_ref (match_operand 2 "" ""))
(pc)))]
""
"branch_if_bit_set\t%0,%1,%2")
I used that pattern as that is what I saw combine looking for and failing to find... but, in rtlanal.c (canonicalize_condition), we have:
Index: gcc/gcc/rtlanal.c
===================================================================
--- gcc/gcc/rtlanal.c (revision 850)
+++ gcc/gcc/rtlanal.c (working copy)
@@ -4933,6 +4933,9 @@
if (CC0_P (op0))
return 0;
+ if (GET_RTX_LENGTH (code) != 2)
+ return 0;
+
return gen_rtx_fmt_ee (code, VOIDmode, op0, op1);
}
which drops op2 because zero_extract is a 3 operand code, not a 2 operand code. So, then question is, should we add the above patch to avoid building bad rtl code?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: canonical condition branch
2010-09-29 15:26 canonical condition branch Mike Stump
@ 2010-10-03 9:29 ` Eric Botcazou
0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2010-10-03 9:29 UTC (permalink / raw)
To: Mike Stump; +Cc: gcc-patches
> I used that pattern as that is what I saw combine looking for and failing
> to find... but, in rtlanal.c (canonicalize_condition), we have:
>
> Index: gcc/gcc/rtlanal.c
> ===================================================================
> --- gcc/gcc/rtlanal.c (revision 850)
> +++ gcc/gcc/rtlanal.c (working copy)
> @@ -4933,6 +4933,9 @@
> if (CC0_P (op0))
> return 0;
>
> + if (GET_RTX_LENGTH (code) != 2)
> + return 0;
> +
> return gen_rtx_fmt_ee (code, VOIDmode, op0, op1);
> }
>
> which drops op2 because zero_extract is a 3 operand code, not a 2 operand
> code. So, then question is, should we add the above patch to avoid
> building bad rtl code?
I think other places could expect the first operand of if_then_else to be a
condition. You should try and rewrite the pattern to make it use a condition
operator, see *jcc_bt in the i386 port for example.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-03 9:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-29 15:26 canonical condition branch Mike Stump
2010-10-03 9:29 ` Eric Botcazou
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).