On 06/12/14 08:34, Christian Bruel wrote:
On 06/11/2014 02:00 PM, Christian Bruel wrote:
>On 06/11/2014 06:17 AM, Joern Rennecke wrote:
>>>>Joern, is this new target macro interface OK with you ?
>>Yes, this interface should allow me to do switches between rounding
>>and truncating
>>floating-point modes with an add/subtract immediate.
>>
>>However, the implentation, as posted, doesn't work - it causes memory
>>corruption.
>>
>>It appears to work with the attached amendment patch.
>>
>Indeed,  thanks for pointing out the bad reusing of the aux field
>between multiple entities.
>
>In fact rereading this part of the implementation, I find the allocation
>of aux*n_entities awkward. A simpler setting in the entity loop to carry
>the mode directly into eg->aux is possible without array allocation
>(which also fixes a memory leak by the way).
>
Here is the revised version fixing the aforementioned issue found by
Joern on Epiphany. It also simplifies the allocation of the aux edges
field to carry the modes.

Now that everyone agrees on the interface, is this OK for trunk ?

bootstrapped/regtested for X86 and SH4a.

thanks,

Christian







toggle.patch


2014-06-12  Christian Bruel<christian.br...@st.com>

        * 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.

2014-06-12  Christian Bruel<christian.br...@st.com>

        * gcc.target/sh/fpchg.c: New test.
This is fine for the trunk.

Thanks for your patience,
Jeff

Reply via email to