fix constraints in stosb/d/w/q inline assembler
Patch by David Wohlferd limegreensocks@yahoo.com
There are actually 4 things changed:
1) The memory clobber. This is the key change. There is an non-inline
version of __stosb elsewhere which works correctly because it's
"call"ed. But if you are using the inline asm version in winnt.h, it
must have the clobber to ensure it works correctly.
2) I have changed Dest and Count from input+output to just inputs.
Saying they are outputs when they aren't puts unnecessary constraints on
the compiler.
3) By using %z2 in the instruction template, the compiler will generate
correct assembly whether the code is compiled with -masm=att (the
default) or -masm=intel. While I expect that most people are going to
use the default, it seems like system headers should support both.
Especially in the Windows world, where people may be more used to
working with intel format. We wouldn't want to get people in a position
where someone needs to include windows.h which requires att, and some
other library header which requires intel.
4) Removed the symbolic names (ie [Dest]) since they aren't being used.
I'm a big believe in using symbolic names. I think all inline asm
should use them. But only if it, well, uses them.
I suppose a fifth thing would be that by using a macro, the code is
somewhat shorter, but that's just incidental. It made things easier to
change while I was experimenting.
git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5867 4407c894-4637-0410-b4f5-ada5f102cad1
1 file changed