This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] support to flip modes in sh mode-switching
Christian Bruel wrote:
I had a brief look at the x87 mode switching, (I wanted to understand
why I never get the gcc_assert in 'merge_modes'), scared by Joern's
mail ;-). From what I've seen modes are handled thur different
identities. When it gets to the mode-switching pass there are 2
possible values for each entity (see ix86_mode_needed): i387_cw_any
(that is no_mode) or i387_cw_[trunc,ceil, ...] depending of the
entity. So I never asserted because it was not possible to have avin
set in the same time for different modes (in different entities).
No, no, we kind of misunderstood each other. I'm not talking about
current mode-switching implementation in i386.md (which is, admittely
really a bit "strange", but please look below) but I'm talking about a
patch that implements x87-mmx switching
(http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01128.html). This patch
would benefit from mode flipping.
So indeed, the mode _flipping_ patch could help flipping it. But I
think that attributes in I386.md would need to be modified, because a
"flip" must be done between 2 exclusives modes. I don't know enough
about x87 to go further but if someone wants to try I would be very
happy to participate.
Coming back to my patch, when thinking over it I have two modifications:
1) renaming 'merge_mode', too confusing, to 'set_flip_status'
2) I was too restritive with the assertion, only considering the sh
flip mode that can only be between double or float. If an entity (no
cases in gcc yet) has more than 2 values it should not assert, and the
or should be modified to a xor and force a no_flip status.
With my approach, the rule is: inside an entity, we need 2 exclusives
modes (and only 2) plus the "no_mode" to enable flipping. All others
cases will generate a setting. Since x87 modes have one mode/entity
the flip will not work as attributes and MODE macros are on today.
Please note, that not-yet-commited MMX patch is the one, that implements
2 exclusive modes. This one is waiting for your enhancement ;)
Uros.