summaryrefslogtreecommitdiff
path: root/gcc/optabs.c
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 /gcc/optabs.c
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
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c48
1 files changed, 42 insertions, 6 deletions
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.