From 9503f3d1cf1dc057b95d2f53fb4378ae5d9aae99 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 9 Jan 2002 13:01:11 -0800 Subject: [PATCH] arm.c (arm_gen_constant): Use trunc_int_for_mode. * config/arm/arm.c (arm_gen_constant): Use trunc_int_for_mode. Unify code from various alternatives. From-SVN: r48690 --- gcc/ChangeLog | 5 +++++ gcc/config/arm/arm.c | 51 +++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 95ed9eb7ad1..3b5deaa929a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-01-09 Richard Henderson + + * config/arm/arm.c (arm_gen_constant): Use trunc_int_for_mode. + Unify code from various alternatives. + 2002-01-09 Richard Henderson * regrename.c (copy_value): Ignore the copy if the source register diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 275eaa0575e..76ce21c6b5a 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1626,34 +1626,37 @@ arm_gen_constant (code, mode, val, target, source, subtargets, generate) if (generate) { - rtx new_src; + rtx new_src, temp1_rtx; + + if (code == SET || code == MINUS) + { + new_src = (subtargets ? gen_reg_rtx (mode) : target); + if (can_invert) + temp1 = ~temp1; + } + else + { + if (remainder || !subtargets) + new_src = target; + else + new_src = gen_reg_rtx (mode); + if (can_invert) + temp1 = ~temp1; + else if (can_negate) + temp1 = -temp1; + } + + temp1 = trunc_int_for_mode (temp1, mode); + temp1_rtx = GEN_INT (temp1); if (code == SET) - emit_insn (gen_rtx_SET (VOIDmode, - new_src = (subtargets - ? gen_reg_rtx (mode) - : target), - GEN_INT (can_invert - ? ~temp1 : temp1))); + ; else if (code == MINUS) - emit_insn (gen_rtx_SET (VOIDmode, - new_src = (subtargets - ? gen_reg_rtx (mode) - : target), - gen_rtx (code, mode, GEN_INT (temp1), - source))); + temp1_rtx = gen_rtx_MINUS (mode, temp1_rtx, source); else - emit_insn (gen_rtx_SET (VOIDmode, - new_src = (remainder - ? (subtargets - ? gen_reg_rtx (mode) - : target) - : target), - gen_rtx (code, mode, source, - GEN_INT (can_invert ? ~temp1 - : (can_negate - ? -temp1 - : temp1))))); + temp1_rtx = gen_rtx_fmt_ee (code, mode, source, temp1_rtx); + + emit_insn (gen_rtx_SET (VOIDmode, new_src, temp1_rtx)); source = new_src; }