From cbb1e3d98c5f18f82c1b733aa6338fab78fb891b Mon Sep 17 00:00:00 2001 From: Christian Bruel Date: Wed, 2 Jul 2014 15:03:14 +0200 Subject: Support mode toggle. * mode-switching.c (struct bb_info): Add mode_out, mode_in caches. (make_preds_opaque): Delete. (clear_mode_bit, mode_bit_p, set_mode_bit): New macros. (commit_mode_sets): New function. (optimize_mode_switching): Handle current_mode to mode_switching_emit. Process all modes at once. * basic-block.h (pre_edge_lcm_avs): Declare. * lcm.c (pre_edge_lcm_avs): Renamed from pre_edge_lcm. Call clear_aux_for_edges. Fix comments. (pre_edge_lcm): New wrapper function to call pre_edge_lcm_avs. (pre_edge_rev_lcm): Idem. * config/epiphany/epiphany.c (emit_set_fp_mode): Add prev_mode parameter. * config/epiphany/epiphany-protos.h (emit_set_fp_mode): Idem. * config/epiphany/resolve-sw-modes.c (pass_resolve_sw_modes::execute): Idem. * config/i386/i386.c (x96_emit_mode_set): Idem. * config/sh/sh.c (sh_emit_mode_set): Likewise. Handle PR toggle. * config/sh/sh.md (toggle_pr): Defined if TARGET_FPU_SINGLE. (fpscr_toggle) Disallow from delay slot. * target.def (emit_mode_set): Add prev_mode parameter. * doc/tm.texi: Regenerate. From-SVN: r212230 --- gcc/config/sh/sh.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'gcc/config/sh/sh.c') diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index ac157e4..02468da 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -203,7 +203,7 @@ static void push_regs (HARD_REG_SET *, int); static int calc_live_regs (HARD_REG_SET *); static HOST_WIDE_INT rounded_frame_size (int); static bool sh_frame_pointer_required (void); -static void sh_emit_mode_set (int, int, HARD_REG_SET); +static void sh_emit_mode_set (int, int, int, HARD_REG_SET); static int sh_mode_needed (int, rtx); static int sh_mode_after (int, int, rtx); static int sh_mode_entry (int); @@ -13583,9 +13583,17 @@ sh_try_omit_signzero_extend (rtx extended_op, rtx insn) static void sh_emit_mode_set (int entity ATTRIBUTE_UNUSED, int mode, - HARD_REG_SET regs_live) + int prev_mode, HARD_REG_SET regs_live) { - fpscr_set_from_mem (mode, regs_live); + if ((TARGET_SH4A_FP || TARGET_SH4_300) + && prev_mode != FP_MODE_NONE && prev_mode != mode) + { + emit_insn (gen_toggle_pr ()); + if (TARGET_FMOVD) + emit_insn (gen_toggle_sz ()); + } + else + fpscr_set_from_mem (mode, regs_live); } static int -- cgit v1.1