NOSPLIT is documented as being deisgned to prevent the
shortening of an instruction, rather than to cause a longer
form to be generated.
As [eax] can't be split, nasm doesn't know that [nosplit eax]
means you want it to generate [eax + 0]. It's my
understanding that if you want to generate [eax+0] then you
have to specifically code it that way (the docs don't have
nosplit down as being usable to force a long form of the
instruction, just to prevent the short form being generated
when the operand can be split).
As such, I'd consider this more of a feature request than a
bug (ie, you are asking for a new feature to be added -
probably a valid feature for some cases, although I would
consider it easier to write [eax+ dword 0] than [nosplit eax],
as it's more specific).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As you can see, NOSPLIT prevents EAX*2 from being optimizing
into EAX+EAX -- just as documented. And yes, it should also
prevent EAX*1 from being optimized into the no-SIB byte form:
OK, I misunderstood exactly what you were looking for. I
agree that it would be useful to be able to code it this way. In
fact, itfits with what I'vesaid a fewtimes about needing to be
able to generate code a specific way sometimes when the
code may double as data or be SMC.
I'll look into it. It looks fairly obvious which part of the code
needs to be changed, I just have to figure out whether I need
to alter something that's there or add a new case (ie when
NOSPLIT has no scale on the register).
I'll have to see if this is considered urgent enough to be done
for 0.99 or if it should be left until after 0.99 is released. Either
way it may take a while to get it done, as I'm still working out
how different parts of the sources affect each other, but
ultimately it shouldn't be too difficult to sort out.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a patch that I'm about to post on the mailing list for
comments. Hopefully it will be accepted by all concerned and
checked into cvs over the weekend, as it does everything that
your example shows.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=363603
NOSPLIT is documented as being deisgned to prevent the
shortening of an instruction, rather than to cause a longer
form to be generated.
As [eax] can't be split, nasm doesn't know that [nosplit eax]
means you want it to generate [eax + 0]. It's my
understanding that if you want to generate [eax+0] then you
have to specifically code it that way (the docs don't have
nosplit down as being usable to force a long form of the
instruction, just to prevent the short form being generated
when the operand can be split).
As such, I'd consider this more of a feature request than a
bug (ie, you are asking for a new feature to be added -
probably a valid feature for some cases, although I would
consider it easier to write [eax+ dword 0] than [nosplit eax],
as it's more specific).
Logged In: NO
NASM currently does:
bits 32
00 8B00 mov eax,[eax]
02 8B00 mov eax,[eax*1]
04 8B0400 mov eax,[eax*2]
07 8B00 mov eax,[nosplit eax]
09 8B00 mov eax,[nosplit eax*1]
0B 8B044500000000 mov eax,[nosplit eax*2]
12 8B00 mov eax,[00000000h+eax*1]
14 8B0400 mov eax,[00000000h+eax*2]
17 8B00 mov eax,[nosplit 00000000h+eax*1]
19 8B044500000000 mov eax,[nosplit 00000000h+eax*2]
As you can see, NOSPLIT prevents EAX*2 from being optimizing
into EAX+EAX -- just as documented. And yes, it should also
prevent EAX*1 from being optimized into the no-SIB byte form:
bits 32
00 8B00 mov eax,[eax]
02 8B00 mov eax,[eax*1]
04 8B0400 mov eax,[eax*2]
07 8B040500000000 mov eax,[nosplit eax]
0E 8B040500000000 mov eax,[nosplit eax*1]
15 8B044500000000 mov eax,[nosplit eax*2]
1C 8B00 mov eax,[00000000h+eax*1]
1E 8B0400 mov eax,[00000000h+eax*2]
21 8B040500000000 mov eax,[nosplit 00000000h+eax*1]
28 8B044500000000 mov eax,[nosplit 00000000h+eax*2]
How else is a NASM user supposed to code the SIB form of
the EAX*1 case?
Logged In: YES
user_id=363603
OK, I misunderstood exactly what you were looking for. I
agree that it would be useful to be able to code it this way. In
fact, itfits with what I'vesaid a fewtimes about needing to be
able to generate code a specific way sometimes when the
code may double as data or be SMC.
I'll look into it. It looks fairly obvious which part of the code
needs to be changed, I just have to figure out whether I need
to alter something that's there or add a new case (ie when
NOSPLIT has no scale on the register).
I'll have to see if this is considered urgent enough to be done
for 0.99 or if it should be left until after 0.99 is released. Either
way it may take a while to get it done, as I'm still working out
how different parts of the sources affect each other, but
ultimately it shouldn't be too difficult to sort out.
Logged In: YES
user_id=363603
I have a patch that I'm about to post on the mailing list for
comments. Hopefully it will be accepted by all concerned and
checked into cvs over the weekend, as it does everything that
your example shows.
Logged In: YES
user_id=363603
I've uploaded a patch to CVS now, so this feature will be
available for the next release.