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.
> - 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.
> - 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. These are used in
X15 to select between machine specific and generic versions, which we
could also use later.
--
Richard Braun
[1] https://gcc.gnu.org/ml/gcc/2008-03/msg00330.html
[2] https://lkml.org/lkml/2011/8/11/356