diff options
author | Andreas Krebbel <Andreas.Krebbel@de.ibm.com> | 2014-03-24 17:38:09 +0000 |
---|---|---|
committer | Andreas Krebbel <krebbel@gcc.gnu.org> | 2014-03-24 17:38:09 +0000 |
commit | 72a4ddf2b5f8167dd49a483888f14d34c3da582f (patch) | |
tree | aeae7ffed74971f9fea144af390f17c819a9157c /gcc/optabs.c | |
parent | 2b2384e8c11ac54f8add062584ada9480079a25b (diff) | |
download | gcc-72a4ddf2b5f8167dd49a483888f14d34c3da582f.zip gcc-72a4ddf2b5f8167dd49a483888f14d34c3da582f.tar.gz gcc-72a4ddf2b5f8167dd49a483888f14d34c3da582f.tar.bz2 |
re PR rtl-optimization/60501 (LRA emits add patterns which might clobber cc)
2014-03-24 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
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
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r-- | gcc/optabs.c | 37 |
1 files changed, 37 insertions, 0 deletions
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 |