On 04/15/2014 01:13 PM, Joern Rennecke wrote: > On 15 April 2014 10:20, Christian Bruel <[email protected]> wrote: >> Hello, >> >> I guess it's for RTL maintainers. Also interested by mode-switching.c >> last contributors (from past ChangeLog entries) comments, >> >> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00196.html > This only helps if there are exactly two modes for an entity. > An interface which extends EMIT_MODE_SET with a parameter for the known > mode would be more versatile. I.e. if you need to manipulate a control > register > with an AND and OR to set a specific mode with no knowledge of the previous > mode, having the known previous mode allows to use a single add or xor > to make the desired switch. An unknown mode could be represented by no_mode > or -1.
yes, I didn't have a 3 state (or more) toggling in mind. My implementation only works for 2 states entities (flip on/off a bit). More than that would require not using a XOR and should expose the test/set_toggle_status machinery to a machine description part. This is a limitation of my proposal, If this will be a missing extension for a target, we will need to move the test/set toggle machinery out of the machine independent part. Maybe overkill as of today. I agree that extending the current EMIT_MODE_SET might be more flexible than a new EMIT_TOGGLE. I was balancing between the two interfaces... thanks for this point. > While you are at it, you should also hookize the thing. OK, > > FWIW, I have noted down some weaknesses/improvement opportunities of > the mode switching pass in: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29349 > . > This also touches the fpchg issue Thanks, I have also some example where this can be improved, hoping to resurrect this problem one day.
