From 5e04ef8f802ce92841982ef735120da1152bde20 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 9 Aug 2008 23:47:28 +0200 Subject: [PATCH] re PR target/37055 (Revision 138835 breaks -msse2 -mfpmath=sse -Os) 2008-08-09 Jan Hubicka PR target/37055 * optabs.c (maybe_emit_unop_insn): Remove produced code if expansion failed. (expand_fix): Be prepared for expansion to fail. (expand_sfix_optab): Remove instructions if expansion failed. From-SVN: r138916 --- gcc/ChangeLog | 8 ++++++++ gcc/optabs.c | 26 +++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bb607a82f7f..f1b96a7aecf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2008-08-09 Jan Hubicka + + PR target/37055 + * optabs.c (maybe_emit_unop_insn): Remove produced code if + expansion failed. + (expand_fix): Be prepared for expansion to fail. + (expand_sfix_optab): Remove instructions if expansion failed. + 2008-08-09 Anatoly Sokolov * config/avr/avr.c (avr_mcu_types): Move the AT43USB320 device to diff --git a/gcc/optabs.c b/gcc/optabs.c index 5b27720dd8c..5d2545dd3b9 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3769,6 +3769,7 @@ maybe_emit_unop_insn (int icode, rtx target, rtx op0, enum rtx_code code) rtx temp; enum machine_mode mode0 = insn_data[icode].operand[1].mode; rtx pat; + rtx last = get_last_insn (); temp = target; @@ -3782,7 +3783,10 @@ maybe_emit_unop_insn (int icode, rtx target, rtx op0, enum rtx_code code) pat = GEN_FCN (icode) (temp, op0); if (!pat) - return false; + { + delete_insns_since (last); + return false; + } if (INSN_P (pat) && NEXT_INSN (pat) != NULL_RTX && code != UNKNOWN) add_equal_note (pat, temp, code, op0, NULL_RTX); @@ -5157,6 +5161,7 @@ expand_fix (rtx to, rtx from, int unsignedp) if (icode != CODE_FOR_nothing) { + rtx last = get_last_insn (); if (fmode != GET_MODE (from)) from = convert_to_mode (fmode, from, 0); @@ -5170,11 +5175,14 @@ expand_fix (rtx to, rtx from, int unsignedp) if (imode != GET_MODE (to)) target = gen_reg_rtx (imode); - emit_unop_insn (icode, target, from, - doing_unsigned ? UNSIGNED_FIX : FIX); - if (target != to) - convert_move (to, target, unsignedp); - return; + if (maybe_emit_unop_insn (icode, target, from, + doing_unsigned ? UNSIGNED_FIX : FIX)) + { + if (target != to) + convert_move (to, target, unsignedp); + return; + } + delete_insns_since (last); } } @@ -5382,6 +5390,7 @@ expand_sfix_optab (rtx to, rtx from, convert_optab tab) icode = convert_optab_handler (tab, imode, fmode)->insn_code; if (icode != CODE_FOR_nothing) { + rtx last = get_last_insn (); if (fmode != GET_MODE (from)) from = convert_to_mode (fmode, from, 0); @@ -5389,7 +5398,10 @@ expand_sfix_optab (rtx to, rtx from, convert_optab tab) target = gen_reg_rtx (imode); if (!maybe_emit_unop_insn (icode, target, from, UNKNOWN)) - return false; + { + delete_insns_since (last); + continue; + } if (target != to) convert_move (to, target, 0); return true;