Richard Braun, on Wed 17 Aug 2016 10:43:46 +0200, wrote:
> On Wed, Aug 17, 2016 at 08:46:34AM +0200, Samuel Thibault wrote:
> > - Are we sure that the direction flag is cleared on entry of the assembly
> > snippets?
>
> Yes, gcc makes sure it's cleared on entry. See [1] for reference.
Ok :)
> > - I don't think the memcmp, strlen and strcmp snippets need a memory
> > clobber?
>
> I'm not sure. Nothing here tells the compiler that the memory
> referenced is read and I don't know what kind of side effects this
> could introduce. After a bit of research, I found this message [2]
> which seems to support this thinking.
Mmm. This is a clobber, so it's supposed to indicate what is written,
not what is read :) But I agree with the "move" rationale, let's be safe
(it doesn't really matter here, there's a memory compiler barrier at the
function call anyway).
> > - should we really use assembly snippets for strcpy and strcmp? In my
> > non-virtualized tests, a simple C loop such as
> > do { test = *dest++ = *src++; } while(test);
> > actually goes quite faster thanks to the gcc optimizer, and the
> > non-rep snippet won't buy virtualized time (and I guess we don't run
> > str functions on memory-mapped devices anyway...)
>
> Actually, assembly isn't used for these functions. Take a look at the
> ARCH_STRING_XXX macros at the beginning of the file.
Ah, ok.
Samuel