This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR target/37055
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Jan Hubicka" <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 9 Aug 2008 19:23:40 +0200
- Subject: Re: PR target/37055
- References: <20080809072410.GH9952@kam.mff.cuni.cz>
On Sat, Aug 9, 2008 at 9:24 AM, Jan Hubicka <jh@suse.cz> wrote:
>
> Hi,
> this patch makes expand_fix to be prepared for expansion to fail as now happens
> on some SSE conversions. I've also added code to remove generated junk, since
> we do this from loop and produce some unnecessary instructions and noticed
> that my previous expand_sfix_optab was wrong in a way terminating loop before
> all options was tested.
>
> Bootstrapped/regtested i686-linux, OK?
Ok.
Thanks,
Richard.
> Honza
>
> 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.
> Index: optabs.c
> ===================================================================
> *** optabs.c (revision 138862)
> --- optabs.c (working copy)
> *************** maybe_emit_unop_insn (int icode, rtx tar
> *** 3769,3774 ****
> --- 3769,3775 ----
> rtx temp;
> enum machine_mode mode0 = insn_data[icode].operand[1].mode;
> rtx pat;
> + rtx last = get_last_insn ();
>
> temp = target;
>
> *************** maybe_emit_unop_insn (int icode, rtx tar
> *** 3782,3788 ****
>
> pat = GEN_FCN (icode) (temp, op0);
> if (!pat)
> ! return false;
>
> if (INSN_P (pat) && NEXT_INSN (pat) != NULL_RTX && code != UNKNOWN)
> add_equal_note (pat, temp, code, op0, NULL_RTX);
> --- 3783,3792 ----
>
> pat = GEN_FCN (icode) (temp, op0);
> if (!pat)
> ! {
> ! 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);
> *************** expand_fix (rtx to, rtx from, int unsign
> *** 5157,5162 ****
> --- 5161,5167 ----
>
> if (icode != CODE_FOR_nothing)
> {
> + rtx last = get_last_insn ();
> if (fmode != GET_MODE (from))
> from = convert_to_mode (fmode, from, 0);
>
> *************** expand_fix (rtx to, rtx from, int unsign
> *** 5170,5180 ****
> 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;
> }
> }
>
> --- 5175,5188 ----
> if (imode != GET_MODE (to))
> target = gen_reg_rtx (imode);
>
> ! 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);
> }
> }
>
> *************** expand_sfix_optab (rtx to, rtx from, con
> *** 5382,5387 ****
> --- 5390,5396 ----
> 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);
>
> *************** expand_sfix_optab (rtx to, rtx from, con
> *** 5389,5395 ****
> target = gen_reg_rtx (imode);
>
> if (!maybe_emit_unop_insn (icode, target, from, UNKNOWN))
> ! return false;
> if (target != to)
> convert_move (to, target, 0);
> return true;
> --- 5398,5407 ----
> target = gen_reg_rtx (imode);
>
> if (!maybe_emit_unop_insn (icode, target, from, UNKNOWN))
> ! {
> ! delete_insns_since (last);
> ! continue;
> ! }
> if (target != to)
> convert_move (to, target, 0);
> return true;
>