Menu

#5 NOSPLIT should work for *1 case

closed
None
1
2004-02-13
2002-05-27
Anonymous
No

Currently NOSPLIT only works for the *2 case.

It should also work for the *1 case:

bits 32
mov eax,[nosplit eax]

results in

8B00 ; mov eax,[eax]

instead of

8B040500000000 ; mov eax,[00000000h+eax*1]

Discussion

  • Debbie Wiles

    Debbie Wiles - 2002-06-05

    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).

     
  • Nobody/Anonymous

    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?

     
  • Debbie Wiles

    Debbie Wiles - 2002-06-07

    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.

     
  • Debbie Wiles

    Debbie Wiles - 2002-06-08

    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.

     
  • Debbie Wiles

    Debbie Wiles - 2002-06-08
    • assigned_to: nobody --> debs3759
     
  • Debbie Wiles

    Debbie Wiles - 2002-06-08

    Logged In: YES
    user_id=363603

    I've uploaded a patch to CVS now, so this feature will be
    available for the next release.

     
  • Debbie Wiles

    Debbie Wiles - 2002-06-08
    • status: open --> closed
     
  • nasm64developer

    nasm64developer - 2004-02-13
    • priority: 5 --> 1
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.