aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJ"orn Rennecke <amylaar@cygnus.co.uk>1998-05-21 22:34:06 +0000
committerJeff Law <law@gcc.gnu.org>1998-05-21 16:34:06 -0600
commit1a29f703bf52e140ee76cb550951557c0777cbfd (patch)
tree6da8e87404024d9ecb238bedd191d7d916d1bce7 /gcc
parent05930232f1ccf2ea94e57b600eddb7ca81d92063 (diff)
downloadgcc-1a29f703bf52e140ee76cb550951557c0777cbfd.zip
gcc-1a29f703bf52e140ee76cb550951557c0777cbfd.tar.gz
gcc-1a29f703bf52e140ee76cb550951557c0777cbfd.tar.bz2
regmove.c (gen_add3_insn): New function.
* regmove.c (gen_add3_insn): New function. (fixup_match_2): Use it instead of calling gen_addsi3. From-SVN: r19938
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/regmove.c23
2 files changed, 26 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 75ae748..192fa09 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Thu May 21 19:50:13 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * regmove.c (gen_add3_insn): New function.
+ (fixup_match_2): Use it instead of calling gen_addsi3.
+
Thu May 21 23:09:50 1998 Jeffrey A Law (law@cygnus.com)
* alias.c (rtx_equal_for_memref_p): Handle SCRATCH as a memory
diff --git a/gcc/regmove.c b/gcc/regmove.c
index 75798b0..ee56db5 100644
--- a/gcc/regmove.c
+++ b/gcc/regmove.c
@@ -47,6 +47,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
static int optimize_reg_copy_1 PROTO((rtx, rtx, rtx));
static void optimize_reg_copy_2 PROTO((rtx, rtx, rtx));
static void optimize_reg_copy_3 PROTO((rtx, rtx, rtx));
+static rtx gen_add3_insn PROTO((rtx, rtx, rtx));
struct match {
int with[MAX_RECOG_OPERANDS];
@@ -65,6 +66,23 @@ static int reg_is_remote_constant_p PROTO((rtx, rtx, rtx));
static int stable_but_for_p PROTO((rtx, rtx, rtx));
static int loop_depth;
+/* Generate and return an insn body to add r1 and c,
+ storing the result in r0. */
+static rtx
+gen_add3_insn (r0, r1, c)
+ rtx r0, r1, c;
+{
+ int icode = (int) add_optab->handlers[(int) GET_MODE (r0)].insn_code;
+
+ if (icode == CODE_FOR_nothing
+ || ! (*insn_operand_predicate[icode][0]) (r0, insn_operand_mode[icode][0])
+ || ! (*insn_operand_predicate[icode][1]) (r1, insn_operand_mode[icode][1])
+ || ! (*insn_operand_predicate[icode][2]) (c, insn_operand_mode[icode][2]))
+ return NULL_RTX;
+
+ return (GEN_FCN (icode) (r0, r1, c));
+}
+
#ifdef AUTO_INC_DEC
/* INC_INSN is an instruction that adds INCREMENT to REG.
@@ -639,8 +657,9 @@ fixup_match_2 (insn, dst, src, offset, regmove_dump_file)
{
HOST_WIDE_INT newconst
= INTVAL (offset) - INTVAL (XEXP (SET_SRC (pset), 1));
- if (validate_change (insn, &PATTERN (insn),
- gen_addsi3 (dst, dst, GEN_INT (newconst)), 0))
+ rtx add = gen_add3_insn (dst, dst, GEN_INT (newconst));
+
+ if (add && validate_change (insn, &PATTERN (insn), add, 0))
{
/* Remove the death note for DST from DST_DEATH. */
if (dst_death)