Re: [PATCH 1/2] x86: optimize XCHG to MOV for same-register forms
Sam James <[email protected]>
| Newsgroups | gmane.comp.debugging.valgrind.devel,gmane.comp.gnu.binutils |
|---|---|
| Organization | Gentoo |
| Message-ID | <[email protected]> |
Jan Beulich <jbeulich-IBi9RG/[email protected]> writes: > On 03.07.2026 08:09, Paul Floyd wrote: >> On 2026-07-03 08:00, Jan Beulich wrote: >>> On 03.07.2026 06:55, Paul Floyd wrote: >>>> Would it be possible for gas to only do this transformation if the source and destination registers are different? >>> When the registers are different, this transformation is invalid to do. >> >> OK so you are optimising a no-op. Does GCC use it as a no-op? > > I don't expect so. In fact, my take is that -O... should not be used on > compiler generated code. The compiler should do whatever optimizations > are possible / sensible, and it should not emit code which can (easily) > further be optimized. (Easily because the assembler really only does > very simple and pretty obvious transformations.) Yes, that's reasonable. We should document it though. > > I can see that there may be a desire to optimize asm()-generated code. > That imo shouldn't be done by passing -Wa,-O... but rather by some > other, to be invented machinery. (We could tie it to the #APP / #NO_APP > markers that the compiler emits, for example.) > > Jan _______________________________________________ Valgrind-developers mailing list Valgrind-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/valgrind-developers
signature.asc
(application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE----- iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmpHiS4bFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkO9s AQDirKe3HaCKqFaq0agUy7wsZVlh9EAjnX1Cb1YaKgC33wEAlNtIxSmAZu4DjyKS zrX1i39akgdUSlcsz5cqkTSFxQ0= =jDeR -----END PGP SIGNATURE-----