summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoon <toon@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-09 20:21:48 +0000
committertoon <toon@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-09 20:21:48 +0000
commitc299d9c8173940c984442c30a1601fc2381c1121 (patch)
treef132186c449f146f89d29ae60d9f337ae0f18f38
parent6c8740519f939dc8724c7d146e0463824ab465bb (diff)
downloadgcc-c299d9c8173940c984442c30a1601fc2381c1121.tar.gz
2001-07-09 Toon Moene <toon@moene.indiv.nluug.nl>
* expr.h: Adjust prototypes for have_add2_insn, have_sub2_insn. * optabs.c (have_add2_insn): Check whether the add insn chosen really accepts the operands. (have_sub2_insn): Ditto for sub insn. * reload1.c (reload_cse_move2add): Adjust calls of have_add2_insn. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43874 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/expr.h4
-rw-r--r--gcc/optabs.c48
-rw-r--r--gcc/reload1.c4
4 files changed, 54 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b7b60912c84..12165fad5ce 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2001-07-09 Toon Moene <toon@moene.indiv.nluug.nl>
+
+ * expr.h: Adjust prototypes for have_add2_insn, have_sub2_insn.
+ * optabs.c (have_add2_insn): Check whether the add insn chosen
+ really accepts the operands. (have_sub2_insn): Ditto for sub insn.
+ * reload1.c (reload_cse_move2add): Adjust calls of have_add2_insn.
+
+*************** extern rtx gen_add2_insn PARAMS ((rtx, r
Mon Jul 9 13:26:40 2001 Jeffrey A Law (law@cygnus.com)
* Makefile.in (OBJS): Add ssa-ccp.o
diff --git a/gcc/expr.h b/gcc/expr.h
index 4808dc342c0..cf2cb268ef3 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -841,8 +841,8 @@ int can_conditionally_move_p PARAMS ((enum machine_mode mode));
extern rtx gen_add2_insn PARAMS ((rtx, rtx));
extern rtx gen_sub2_insn PARAMS ((rtx, rtx));
extern rtx gen_move_insn PARAMS ((rtx, rtx));
-extern int have_add2_insn PARAMS ((enum machine_mode));
-extern int have_sub2_insn PARAMS ((enum machine_mode));
+extern int have_add2_insn PARAMS ((rtx, rtx));
+extern int have_sub2_insn PARAMS ((rtx, rtx));
/* Return the INSN_CODE to use for an extend operation. */
extern enum insn_code can_extend_p PARAMS ((enum machine_mode,
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 16e1b08d87c..57c87fad16d 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3765,10 +3765,28 @@ gen_add2_insn (x, y)
}
int
-have_add2_insn (mode)
- enum machine_mode mode;
+have_add2_insn (x, y)
+ rtx x, y;
{
- return add_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
+ int icode;
+
+ if (GET_MODE (x) == VOIDmode)
+ abort ();
+
+ icode = (int) add_optab->handlers[(int) GET_MODE (x)].insn_code;
+
+ if (icode == CODE_FOR_nothing)
+ return 0;
+
+ if (! ((*insn_data[icode].operand[0].predicate)
+ (x, insn_data[icode].operand[0].mode))
+ || ! ((*insn_data[icode].operand[1].predicate)
+ (x, insn_data[icode].operand[1].mode))
+ || ! ((*insn_data[icode].operand[2].predicate)
+ (y, insn_data[icode].operand[2].mode)))
+ return 0;
+
+ return 1;
}
/* Generate and return an insn body to subtract Y from X. */
@@ -3791,10 +3809,28 @@ gen_sub2_insn (x, y)
}
int
-have_sub2_insn (mode)
- enum machine_mode mode;
+have_sub2_insn (x, y)
+ rtx x, y;
{
- return sub_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
+ int icode;
+
+ if (GET_MODE (x) == VOIDmode)
+ abort ();
+
+ icode = (int) sub_optab->handlers[(int) GET_MODE (x)].insn_code;
+
+ if (icode == CODE_FOR_nothing)
+ return 0;
+
+ if (! ((*insn_data[icode].operand[0].predicate)
+ (x, insn_data[icode].operand[0].mode))
+ || ! ((*insn_data[icode].operand[1].predicate)
+ (x, insn_data[icode].operand[1].mode))
+ || ! ((*insn_data[icode].operand[2].predicate)
+ (y, insn_data[icode].operand[2].mode)))
+ return 0;
+
+ return 1;
}
/* Generate the body of an instruction to copy Y into X.
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 78851c0a147..c6a5c238548 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -9161,7 +9161,7 @@ reload_cse_move2add (first)
if (new_src == const0_rtx)
success = validate_change (insn, &SET_SRC (pat), reg, 0);
else if (rtx_cost (new_src, PLUS) < rtx_cost (src, SET)
- && have_add2_insn (GET_MODE (reg)))
+ && have_add2_insn (reg, new_src))
success = validate_change (insn, &PATTERN (insn),
gen_add2_insn (reg, new_src), 0);
reg_set_luid[regno] = move2add_luid;
@@ -9212,7 +9212,7 @@ reload_cse_move2add (first)
= validate_change (next, &SET_SRC (set), reg, 0);
else if ((rtx_cost (new_src, PLUS)
< COSTS_N_INSNS (1) + rtx_cost (src3, SET))
- && have_add2_insn (GET_MODE (reg)))
+ && have_add2_insn (reg, new_src))
success
= validate_change (next, &PATTERN (next),
gen_add2_insn (reg, new_src), 0);