On Thu, Sep 03, 2020 at 02:17:04PM -0300, Alexandre Oliva wrote: > On Sep 3, 2020, Segher Boessenkool <seg...@kernel.crashing.org> wrote: > > Oh, I meant what was in your patch. From a grep, all of mn10300, nds32, > > arm, cris, pdp11, rs6000, i386, visium, aarch64 have default clobbers. > > Hrm, what you said was the targets with inline asm flag output > > constraints? > > I found implicit cc clobbers on x86 only, and then I stumbled across the > same notation used for asm cc-setting in arm/aarch64, but that was all, > I didn't look any further (yet).
mn10300, cris, pdp11 (twice), i386, visium at least. > I'll look at the other targets with > asm_adjust hooks and see whether they need adjustments for "none", if we > agree that's the way to go. The idea is that none of them will need adjustment. This hook runs before the "none" code will run, and it can just clear all clobbers then. > > Before your change, flags could not be live through an asm. > > While implementing this patchlet, I learned that standard asms (as > opposed to GCC-extended ones) only undergo machine-dependent adjustments > if their asm pattern string is non-empty. So there is precedent. I may > even have a finger on that precedent, from very long ago. Exceptions can look reasonable and easy, until you have to document it, and then write down how it interacts with other stuff :-/ > > After your change, it can. So it does change things... > > No doubt it does change things, that's not the point. The point is how > could it break things. If the compiler can see flags are set before the > asm, and it can see the flags could be used after the asm, and the asm > has no code whatsoever in it that could possibly clobber the flags... > What could possibly go wrong? (Famous last words? :-) The user could want to use an empty asm to influence what code is generated. Yes, I know this isn't a very strong argument :-) > >> > But how about a "none" clobber? > >> > >> I like that! > > > Okay, sold! Now to convince everyone else ;-) > > Here's a prototype implementation, x86 only. (ARM and Thumb do not add > any clobbers by default, so it's already good for "none") I haven't yet > looked at other targets. It's missing documentation and tests, too. I think we can just do this in expand_asm_stmt? It makes a first pass over the clobbers as well, before actually expanding things, so we could just set a flag and not call md_asm_adjust? Maybe "nodefault" is a better name than "none" btw (must be close to getting it done, if we are picking colours for the bikeshed :-) ) Or, hrm, doing it exactly like that will disable all =@xxx as well. That doesn't matter for x86, and probably nowhere in practice, but eww. Kill all clobbers immediately after calling md_asm_adjust? Segher