This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH 1/n] Add conditional compare support


On Tue, 22 Oct 2013, Zhenqiang Chen wrote:
> ChangeLog:
> 2013-10-22  Zhenqiang Chen  <zhenqiang.chen@linaro.org>
>
> 	* config/arm/arm.c (arm_fixed_condition_code_regs, arm_ccmode_to_code,
> 	arm_select_dominance_ccmp_mode): New functions.
> 	(arm_select_dominance_cc_mode_1): New function extracted from
> 	arm_select_dominance_cc_mode.
> 	(arm_select_dominance_cc_mode): Call arm_select_dominance_cc_mode_1.
> 	* config/arm/arm.md (ccmp, cbranchcc4, ccmp_and, ccmp_ior,
> 	ccmp_ior_scc_scc, ccmp_ior_scc_scc_cmp, ccmp_and_scc_scc,
> 	ccmp_and_scc_scc_cmp): New.
> 	* config/arm/arm-protos.h (arm_select_dominance_ccmp_mode): New.
> 	* expr.c (ccmp_candidate_p, used_in_cond_stmt_p, expand_ccmp_expr_2,
> 	expand_ccmp_expr_3, expand_ccmp_expr_1, expand_ccmp_expr): New.
> 	(expand_expr_real_1): Handle ccmp.
> 	* optabs.c: Include gimple.h.
> 	(expand_ccmp_op): New.
> 	(get_rtx_code): Handle BIT_AND_EXPR and BIT_IOR_EXPR.
> 	* optabs.def (ccmp): New.
> 	* optabs.h (expand_ccmp_op): New.
> 	* doc/md.texi (ccmp): New index.

One thing I don't see other people mentioning, is that this
patch has just too much code inside #ifdef HAVE_ccmp ... #endif.

I couldn't actually find the part that *requires* that, i.e.
code that does something like gen_ccmp (...) but maybe it's there.

Where needed and where the conditioned code is more than a few
lines, such code is preferably transformed into "if (0)":d code
using constructs like that at builtins.c:5354:

#ifndef HAVE_atomic_clear
# define HAVE_atomic_clear 0
# define gen_atomic_clear(x,y) (gcc_unreachable (), NULL_RTX)
#endif

Right, this causes dead code, but for maintenance it's *much*
better than when only a fraction of the code being compiled for
other targets.  (Also, the dead code may be eliminated by gcc.)
Unfortunately the number of examples (as above) are few compared
to the pages of #if HAVE_thisorthat'd code. :(

(And IMHO that whole construct should be the default
implementation and shouldn't have to be written manually in the
first place.  But that's material for an invasive patch.)

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]