On Friday, 27 May 2016 at 09:22:49 UTC, Guillaume Piolat wrote:
On Friday, 27 May 2016 at 09:11:01 UTC, Era Scarecrow wrote:
Hmmm it just occurs to me I made a big assumption. I assumed that if the CPU supports 64bit operations, that it would be compiled to use 64bit registers when possible. I'm assuming this is not the case. As such the tests I was doing will probably be of little help _unless_ it was X86_64 code, or a check that verifies it's 64bit hardware?

You have to write your code three times, one for

version(D_InlineAsm_X86)
version (D_InlineAsm_X86_64)
and a version without assembly.

If longs are emulated, then only X86_64 and without assembly would be considered, as there would be no benefit to doing the X86 version. If i can do it, the two will be identical, except for which stack register is used. (A lot of wasted space for so little to add).

TBH I don't know how to access members in assembly, I think you shouldn't ever do that. It will depend heavily on the particular calling convention called.
Just put these fields in local variables.

<snip>

The compiler will replace with the right register-indexed stuff.
But honestly I doubt it will be any faster because on the other hand you mess with the optimizer.

Hmmm tried it as you have it listed. Still hangs. Tried it directly with qword with and without [ESP], still hangs.

The listed inline assembler here on Dlang says to use 'variableName[ESP]', which then becomes obvious it's a variable and even probably inserts type-size information as appropriate. Although I did it manually as you had listed but it still hangs. I suppose there's the requirement to have a register pointing to this, which then would be mov EAX, this, and then add lo[EAX], 1...

Reply via email to