aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-01-09 13:01:11 -0800
committerRichard Henderson <rth@gcc.gnu.org>2002-01-09 13:01:11 -0800
commit9503f3d1cf1dc057b95d2f53fb4378ae5d9aae99 (patch)
treec7d66e05ecd0b268cfeca92eeb9e33270cb57224
parent42bd17b7fc6af8d4239ff6925bc0697a84545c6a (diff)
downloadgcc-9503f3d1cf1dc057b95d2f53fb4378ae5d9aae99.zip
gcc-9503f3d1cf1dc057b95d2f53fb4378ae5d9aae99.tar.gz
gcc-9503f3d1cf1dc057b95d2f53fb4378ae5d9aae99.tar.bz2
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
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/arm/arm.c51
2 files changed, 32 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 95ed9eb..3b5deaa 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2002-01-09 Richard Henderson <rth@redhat.com>
+ * config/arm/arm.c (arm_gen_constant): Use trunc_int_for_mode.
+ Unify code from various alternatives.
+
+2002-01-09 Richard Henderson <rth@redhat.com>
+
* regrename.c (copy_value): Ignore the copy if the source register
is present in the value chain with a narrower mode.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 275eaa0..76ce21c 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;
}