From 72a4ddf2b5f8167dd49a483888f14d34c3da582f Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Mon, 24 Mar 2014 17:38:09 +0000 Subject: re PR rtl-optimization/60501 (LRA emits add patterns which might clobber cc) 2014-03-24 Andreas Krebbel PR rtl-optimization/60501 * optabs.def (addptr3_optab): New optab. * optabs.c (gen_addptr3_insn, have_addptr3_insn): New function. * doc/md.texi ("addptrm3"): Document new RTL standard expander. * expr.h (gen_addptr3_insn, have_addptr3_insn): Add prototypes. * lra.c (emit_add3_insn): Use the addptr pattern if available. * config/s390/s390.md ("addptrdi3", "addptrsi3"): New expanders. From-SVN: r208796 --- gcc/optabs.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'gcc/optabs.c') diff --git a/gcc/optabs.c b/gcc/optabs.c index cec25a4..c4540f8 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4755,6 +4755,43 @@ have_add2_insn (rtx x, rtx y) return 1; } +/* Generate and return an insn body to add Y to X. */ + +rtx +gen_addptr3_insn (rtx x, rtx y, rtx z) +{ + enum insn_code icode = optab_handler (addptr3_optab, GET_MODE (x)); + + gcc_assert (insn_operand_matches (icode, 0, x)); + gcc_assert (insn_operand_matches (icode, 1, y)); + gcc_assert (insn_operand_matches (icode, 2, z)); + + return GEN_FCN (icode) (x, y, z); +} + +/* Return true if the target implements an addptr pattern and X, Y, + and Z are valid for the pattern predicates. */ + +int +have_addptr3_insn (rtx x, rtx y, rtx z) +{ + enum insn_code icode; + + gcc_assert (GET_MODE (x) != VOIDmode); + + icode = optab_handler (addptr3_optab, GET_MODE (x)); + + if (icode == CODE_FOR_nothing) + return 0; + + if (!insn_operand_matches (icode, 0, x) + || !insn_operand_matches (icode, 1, y) + || !insn_operand_matches (icode, 2, z)) + return 0; + + return 1; +} + /* Generate and return an insn body to subtract Y from X. */ rtx -- cgit v1.1