nosplit: Generate index-only EA only when a multiplier is used.
authorJin Kyu Song <jin.kyu.song@intel.com>
Thu, 19 Dec 2013 06:01:14 +0000 (22:01 -0800)
committerJin Kyu Song <jin.kyu.song@intel.com>
Thu, 19 Dec 2013 06:38:44 +0000 (22:38 -0800)
[nosplit eax] has been encoded as [eax*1+0] since 0.98.34.
But this seems like unexpected behavior.
So only when a register is multiplied, that will be treated
as an index. ([nosplit eax*1] -> [eax*1+0])
Document is updated accordingly.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
assemble.c
doc/nasmdoc.src

index fbd7caf..eeab9bb 100644 (file)
@@ -2635,9 +2635,10 @@ static enum ea_type process_ea(operand *input, ea *output, int bits,
                         bt = it, bx = ix, s--;
                     }
                     if (it == -1 && (bt & 7) != REG_NUM_ESP &&
-                        (eaflags & EAF_TIMESTWO)) {
+                        (eaflags & EAF_TIMESTWO) &&
+                        (hb == b && ht == EAH_NOTBASE)) {
                         /*
-                         * convert [NOSPLIT EAX]
+                         * convert [NOSPLIT EAX*1]
                          * to sib format with 0x0 displacement - [EAX*1+0].
                          */
                         it = bt, ix = bx, bt = -1, bx = 0, s = 1;
index 8554a34..dbf8e70 100644 (file)
@@ -1459,7 +1459,8 @@ that allows the offset field to be absent and space to be saved; in
 fact, it will also split \c{[eax*2+offset]} into
 \c{[eax+eax+offset]}. You can combat this behaviour by the use of
 the \c{NOSPLIT} keyword: \c{[nosplit eax*2]} will force
-\c{[eax*2+0]} to be generated literally.
+\c{[eax*2+0]} to be generated literally. \c{[nosplit eax*1]} also has the
+same effect. In another way, a split EA form \c{[0, eax*2]} can be used, too.
 However, \c{NOSPLIT} in \c{[nosplit eax+eax]} will be ignored because user's
 intention here is considered as \c{[eax+eax]}.