aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorToon Moene <toon@moene.indiv.nluug.nl>2001-07-09 22:21:48 +0200
committerToon Moene <toon@gcc.gnu.org>2001-07-09 20:21:48 +0000
commitfb7e77d7dc2d25794f2c62d8c4f2f751dc772bf4 (patch)
treef132186c449f146f89d29ae60d9f337ae0f18f38 /gcc/optabs.c
parent44cec3004a3519037c88ae0d464f9790ac998053 (diff)
downloadgcc-fb7e77d7dc2d25794f2c62d8c4f2f751dc772bf4.zip
gcc-fb7e77d7dc2d25794f2c62d8c4f2f751dc772bf4.tar.gz
gcc-fb7e77d7dc2d25794f2c62d8c4f2f751dc772bf4.tar.bz2
expr.h: Adjust prototypes for have_add2_insn, have_sub2_insn.
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. From-SVN: r43874
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 16e1b08..57c87fa 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.