This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [cond-optab] Convert cris
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 26 Mar 2009 11:38:33 -0400 (EDT)
- Subject: Re: [cond-optab] Convert cris
- References: <E1Lml40-0002NE-61@fencepost.gnu.org>
On Thu, 26 Mar 2009, Paolo Bonzini wrote:
> As a CC0 target, CRIS required a little more care because of the tst
> optabs. In particular, for this target I needed to update
> notice_update_cc; auditing other targets showed that it was not
> needed there.
> Index: gcc/config/cris/cris.md
> ===================================================================
> --- gcc/config/cris/cris.md (branch cond-optab)
> +++ gcc/config/cris/cris.md (working copy)
> @@ -212,6 +212,7 @@
> ;; Iterator definitions.
>
> ;; For the "usual" pattern size alternatives.
> +(define_mode_iterator ALL [DI SI HI QI])
I'd rather call them ALLINT (reserving ALL to include SF and DF
too).
> -(define_insn "tstsi"
> +(define_insn "*tstsi"
> [(set (cc0)
> - (match_operand:SI 0 "nonimmediate_operand" "r,Q>,m"))]
> + (compare (match_operand:SI 0 "nonimmediate_operand" "r,Q>,m")
> + (const_int 0)))]
Why not fold these into *cmpsi (similar for other modes)? I'm
guessing that left you with assembly code differences; I guess
that's acceptable as-is then and I'll investigate why myself.
> +(define_expand "cbranchdi4"
> + [(set (cc0)
> + (compare (match_operand:DI 1 "nonimmediate_operand" "")
> + (match_operand:DI 2 "general_operand" "")))
> + (set (pc)
> + (if_then_else (match_operator 0 "ordered_comparison_operator"
> + [(cc0) (const_int 0)])
> + (label_ref (match_operand 3 "" ""))
> + (pc)))]
> + ""
> +{
> + if (TARGET_V32 && !REG_P (operands[0]))
> + operands[0] = force_reg (DImode, operands[0]);
> + if (TARGET_V32 && MEM_P (operands[1]))
> + operands[1] = force_reg (DImode, operands[1]);
No, those operand numbers (operands[0]) don't look right.
(I guess non-register DI operands happen rarely enough that you
didn't notice in testing.)
> +})
> +
> +
(Please just one empty line between patterns. More than one
place.)
> ;; We suffer from the same overflow-bit-gets-in-the-way problem as
> ;; e.g. m68k, so we have to check if overflow bit is set on all "signed"
> ;; conditions.
> @@ -3634,6 +3629,18 @@
>
> ;; Set on condition: sCC.
>
> +(define_expand "cstore<mode>4"
> + [(set (cc0) (compare
> + (match_operand:ALL 2 "nonimmediate_operand")
> + (match_operand:ALL 3 "general_operand")))
> + (set (match_operand:SI 0 "register_operand")
> + (match_operator:SI 1 "ordered_comparison_operator"
> + [(cc0) (const_int 0)]))]
> + ""
> + ""
> +)
the ")" goes on the same line as the last '""'. ;)
Thanks for your work!
brgds, H-P