https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87763
--- Comment #6 from Richard Earnshaw <rearnsha at gcc dot gnu.org> --- (In reply to Wilco from comment #5) > (In reply to Segher Boessenkool from comment #4) > > (In reply to Wilco from comment #3) > > > IRA costing doesn't consider the possibility of a simple move being > > > removeable. > > > > Not always, yeah (only if you have matching constraints, which are silly to > > have for moves; IRA or LRA should do the work, not the machine description). > > Would it take this into account in the costs? I believe it doesn't. > > > > Neither does it consider that some variants are more expensive > > > than others - use of '?' is the only way to mark more expensive variants. > > > > ? and !, or ^ and $ if it only more expensive if it needs reloads. > > > > > The example shown is fixed when I change the w=rZ variant to ?w=rZ in > > > movsi_aarch64. > > > > Is it always more expensive than the other alternatives? Then it *should* > > have "?" modifiers! > > Today using '?' seems to be the only way to tell it to prefer certain > alternatives. However this is annoying given there are already separate > costs for moves between different register classes. So this means we end up > hardcoding microarchitecture costs in the md files instead of using the > existing cost hooks... The '?' modifiers approach is not really suitable for any case where the cost might depend on the micro-architecture. There's only one cost that can be applied this way, and if it doesn't suit all implementations, you're hosed.