Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Bug6652 #377

Closed
wants to merge 4 commits into from

5 participants

Martin Nowak Daniel Murphy Walter Bright Andrei Alexandrescu Hara Kenji
Martin Nowak
Collaborator

http://d.puremagic.com/issues/show_bug.cgi?id=6652

  • fixes unexpected loop index changing when using non-ref foreach argument
  • explicitly allow ref index to alter loop index
  • this is now consistent with the usual foreach args behaving like a function args

This fix breaks code that depends on this behavior.
There is an accompanying pull request for phobos, which should be merge first.

Martin Nowak
Collaborator

phobos pull:
D-Programming-Language/phobos#255

P.S.:

  • I've double checked that a simple size_t index is optimized out if unaltered
Daniel Murphy
Collaborator

This patch is causing one of the iasm tests to fail in the autotester.
The output of the test is here
Also, if you add a line like requires: phobos git://github.com/your_username/your_phobos_repo.git branch_name to the pull request description the autotester will merge that branch into phobos before testing.

Martin Nowak
Collaborator

Thanks I plainly forgot the 32-bit iasm fixes.
Will fix this soon.

Martin Nowak regression test for Bug6652 24fbc11
Martin Nowak create a copy for non-ref arg in ForeachRangeStatement
 - resolves Bug6652
 - additional variable is optimized out if unaltered
1d5e889
Martin Nowak also create a copy for non-ref key arg in ForeachStatement a9963e3
Martin Nowak fix iasm64 test
 - the stack size changed due to the foreach changes
 - moved comparison into separate function and added
   0x20 to RBP relative addresses
c44257f
Walter Bright

This one is fairly controversial - see http://d.puremagic.com/issues/show_bug.cgi?id=6652

Andrei Alexandrescu
Owner

(background: I'm doing a review of pull requests < 1000 as they tend to be controversial)

I'm against this because it changes behavior from one that compiles, runs, and has certain semantics, to one that also compiles and runs, but has different semantics. Reasonable people can be expected to disagree over the semantics, and therefore may guess wrong and be surprised at either the existing semantics, the semantics proposed by this diff, or the decision to change from one to another.

I am much more in favor of tightening the screws - either reject, to the extent possible, changes to the loop variable, or simply leave things as they are.

Hara Kenji
Collaborator

I've posted three pull requests for the bug 6652.
These changes are for the correct deprecation phases (warning -> deprecated -> changing semantics), and it's already started from 2.060. So in current, modifying non-ref foreach loop variable is warned (with -w switch).

#1008 (already merged in 2.060)
#1009
#1010

Therefore, what I want to ask is: When the warning will be changed to the deprecation?


On the other hand, this pull request has exhaustive test case, so I'd like to copy it to pull#1010 if @dawgfoto agrees.

Brad Roberts braddr referenced this pull request from a commit October 21, 2012
Commit has since been removed from the repository and is no longer available.
Brad Roberts braddr referenced this pull request from a commit October 21, 2012
Commit has since been removed from the repository and is no longer available.
Walter Bright

Is there any reason to keep this around given 94nsr's staged pull requests?

Martin Nowak MartinNowak closed this November 29, 2012
Martin Nowak
Collaborator

On the other hand, this pull request has exhaustive test case, so I'd like to copy it to pull#1010 if @dawgfoto agrees.

Please go ahead and take what you consider useful for #1010.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 4 unique commits by 1 author.

Dec 26, 2011
Martin Nowak regression test for Bug6652 24fbc11
Martin Nowak create a copy for non-ref arg in ForeachRangeStatement
 - resolves Bug6652
 - additional variable is optimized out if unaltered
1d5e889
Martin Nowak also create a copy for non-ref key arg in ForeachStatement a9963e3
Martin Nowak fix iasm64 test
 - the stack size changed due to the foreach changes
 - moved comparison into separate function and added
   0x20 to RBP relative addresses
c44257f
This page is out of date. Refresh to see the latest.
40  src/statement.c
@@ -1597,13 +1597,15 @@ Statement *ForeachStatement::semantic(Scope *sc)
1597 1597
                 Parameter *arg = arguments->tdata()[i];
1598 1598
                 Type *argtype = arg->type->semantic(loc, sc);
1599 1599
                 VarDeclaration *var;
  1600
+                int iskey = dim == 2 && i == 0;
1600 1601
 
1601  
-                var = new VarDeclaration(loc, argtype, arg->ident, NULL);
  1602
+                Identifier *id = !iskey || (arg->storageClass & STCref) ? arg->ident : Lexer::uniqueId("__key");
  1603
+                var = new VarDeclaration(loc, argtype, id, NULL);
1602 1604
                 var->storage_class |= STCforeach;
1603 1605
                 var->storage_class |= arg->storageClass & (STCin | STCout | STCref | STC_TYPECTOR);
1604 1606
                 if (var->storage_class & (STCref | STCout))
1605 1607
                     var->storage_class |= STCnodtor;
1606  
-                if (dim == 2 && i == 0)
  1608
+                if (iskey)
1607 1609
                 {   key = var;
1608 1610
                     //var->storage_class |= STCfinal;
1609 1611
                 }
@@ -1668,11 +1670,25 @@ Statement *ForeachStatement::semantic(Scope *sc)
1668 1670
                 // key += 1
1669 1671
                 increment = new AddAssignExp(loc, new VarExp(loc, key), new IntegerExp(1));
1670 1672
 
  1673
+            Statements *bodyinit = new Statements;
  1674
+            if (dim == 2 && !(arguments->tdata()[0]->storageClass & STCref))
  1675
+            {
  1676
+                // key = __key
  1677
+                bodyinit->reserve(3);
  1678
+                Parameter *arg = arguments->tdata()[0];
  1679
+                ExpInitializer *ie = new ExpInitializer(loc, new VarExp(loc, key));
  1680
+                VarDeclaration *argcopy = new VarDeclaration(loc, arg->type, arg->ident, ie);
  1681
+                bodyinit->push(new ExpStatement(loc, argcopy));
  1682
+            }
  1683
+            else
  1684
+                bodyinit->reserve(2);
  1685
+
1671 1686
             // T value = tmp[key];
1672 1687
             value->init = new ExpInitializer(loc, new IndexExp(loc, new VarExp(loc, tmp), new VarExp(loc, key)));
1673  
-            Statement *ds = new ExpStatement(loc, value);
  1688
+            bodyinit->push(new ExpStatement(loc, value));
1674 1689
 
1675  
-            body = new CompoundStatement(loc, ds, body);
  1690
+            bodyinit->push(body);
  1691
+            body = new CompoundStatement(loc, bodyinit);
1676 1692
 
1677 1693
             s = new ForStatement(loc, forinit, cond, increment, body);
1678 1694
             s = s->semantic(sc);
@@ -2270,12 +2286,13 @@ Statement *ForeachRangeStatement::semantic(Scope *sc)
2270 2286
      *  for (auto tmp = lwr, auto key = upr; key-- > tmp;)
2271 2287
      */
2272 2288
 
  2289
+    Identifier *idkey = arg->storageClass & STCref ? arg->ident : Lexer::uniqueId("__key");
2273 2290
     ExpInitializer *ie = new ExpInitializer(loc, (op == TOKforeach) ? lwr : upr);
2274  
-    key = new VarDeclaration(loc, arg->type, arg->ident, ie);
  2291
+    key = new VarDeclaration(loc, arg->type, idkey, ie);
2275 2292
 
2276  
-    Identifier *id = Lexer::uniqueId("__limit");
  2293
+    Identifier *idtmp = Lexer::uniqueId("__limit");
2277 2294
     ie = new ExpInitializer(loc, (op == TOKforeach) ? upr : lwr);
2278  
-    VarDeclaration *tmp = new VarDeclaration(loc, arg->type, id, ie);
  2295
+    VarDeclaration *tmp = new VarDeclaration(loc, arg->type, idtmp, ie);
2279 2296
 
2280 2297
     Statements *cs = new Statements();
2281 2298
     // Keep order of evaluation as lwr, then upr
@@ -2318,6 +2335,15 @@ Statement *ForeachRangeStatement::semantic(Scope *sc)
2318 2335
         //increment = new AddAssignExp(loc, new VarExp(loc, key), new IntegerExp(1));
2319 2336
         increment = new PreExp(TOKpreplusplus, loc, new VarExp(loc, key));
2320 2337
 
  2338
+    if (!(arg->storageClass & STCref))
  2339
+    {
  2340
+        ExpInitializer *ie = new ExpInitializer(loc, new VarExp(loc, key));
  2341
+        VarDeclaration *argcopy = new VarDeclaration(loc, arg->type, arg->ident, ie);
  2342
+        Statement *ds = new ExpStatement(loc, argcopy);
  2343
+
  2344
+        body = new CompoundStatement(loc, ds, body);
  2345
+    }
  2346
+
2321 2347
     ForStatement *fs = new ForStatement(loc, forinit, cond, increment, body);
2322 2348
     s = fs->semantic(sc);
2323 2349
     return s;
103  test/runnable/foreach5.d
@@ -107,6 +107,108 @@ void test7004()
107 107
 }
108 108
 
109 109
 /***************************************/
  110
+// 6652
  111
+
  112
+void test6652()
  113
+{
  114
+    size_t sum;
  115
+
  116
+    foreach (i; 0 .. 10)
  117
+        sum += i++; // 0123456789
  118
+    assert(sum == 45);
  119
+
  120
+    sum = 0;
  121
+    foreach (ref i; 0 .. 10)
  122
+        sum += i++; // 02468
  123
+    assert(sum == 20);
  124
+
  125
+    sum = 0;
  126
+    foreach_reverse (i; 0 .. 10)
  127
+        sum += i--; // 9876543210
  128
+    assert(sum == 45);
  129
+
  130
+    sum = 0;
  131
+    foreach_reverse (ref i; 0 .. 10)
  132
+        sum += i--; // 97531
  133
+    assert(sum == 25);
  134
+
  135
+    enum ary = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
  136
+    sum = 0;
  137
+    foreach (i, v; ary)
  138
+    {
  139
+        assert(i == v);
  140
+        sum += i++; // 0123456789
  141
+    }
  142
+    assert(sum == 45);
  143
+
  144
+    sum = 0;
  145
+    foreach (ref i, v; ary)
  146
+    {
  147
+        assert(i == v);
  148
+        sum += i++; // 02468
  149
+    }
  150
+    assert(sum == 20);
  151
+
  152
+    sum = 0;
  153
+    foreach_reverse (i, v; ary)
  154
+    {
  155
+        assert(i == v);
  156
+        sum += i--; // 9876543210
  157
+    }
  158
+    assert(sum == 45);
  159
+
  160
+    sum = 0;
  161
+    foreach_reverse (ref i, v; ary)
  162
+    {
  163
+        assert(i == v);
  164
+        sum += i--; // 97531
  165
+    }
  166
+    assert(sum == 25);
  167
+
  168
+    static struct Iter
  169
+    {
  170
+        ~this()
  171
+        {
  172
+            ++_dtorCount;
  173
+        }
  174
+
  175
+        bool opCmp(ref const Iter rhs)
  176
+        {
  177
+            return _pos == rhs._pos;
  178
+        }
  179
+
  180
+        void opUnary(string op)() if(op == "++" || op == "--")
  181
+        {
  182
+            mixin(op ~ q{_pos;});
  183
+        }
  184
+
  185
+        size_t _pos;
  186
+        static size_t _dtorCount;
  187
+    }
  188
+
  189
+    Iter._dtorCount = sum = 0;
  190
+    foreach (v; Iter(0) .. Iter(10))
  191
+        sum += v._pos++; // 0123456789
  192
+    assert(sum == 45 && Iter._dtorCount == 12);
  193
+
  194
+    Iter._dtorCount = sum = 0;
  195
+    foreach (ref v; Iter(0) .. Iter(10))
  196
+        sum += v._pos++; // 02468
  197
+    assert(sum == 20 && Iter._dtorCount == 2);
  198
+
  199
+    // additional dtor calls due to unnecessary postdecrements
  200
+    Iter._dtorCount = sum = 0;
  201
+    foreach_reverse (v; Iter(0) .. Iter(10))
  202
+        sum += v._pos--; // 9876543210
  203
+    assert(sum == 45 && Iter._dtorCount >= 12);
  204
+
  205
+    Iter._dtorCount = sum = 0;
  206
+    foreach_reverse (ref v; Iter(0) .. Iter(10))
  207
+        sum += v._pos--; // 97531
  208
+    assert(sum == 25 && Iter._dtorCount >= 2);
  209
+}
  210
+
  211
+/***************************************/
110 212
 
111 213
 int main()
112 214
 {
@@ -114,6 +216,7 @@ int main()
114 216
     test3187();
115 217
     test5605();
116 218
     test7004();
  219
+    test6652();
117 220
 
118 221
     printf("Success\n");
119 222
     return 0;
371  test/runnable/iasm.d
@@ -17,6 +17,27 @@ struct M64 { int a,b; };
17 17
 
18 18
 /****************************************************/
19 19
 
  20
+void compareBytes(ubyte *p, ubyte[] data, size_t line = __LINE__)
  21
+{
  22
+    if (p[0 .. data.length] != data)
  23
+    {
  24
+        import core.stdc.stdio;
  25
+
  26
+        size_t pos;
  27
+        while (pos < data.length)
  28
+        {
  29
+            if (p[pos] != data[pos])
  30
+                break;
  31
+            ++pos;
  32
+        }
  33
+        printf("iasm.d(%d): asm mismatch\n", line);
  34
+        printf("data[%d] = 0x%02x, should be 0x%02x\n", pos, p[pos], data[pos]);
  35
+        assert(0);
  36
+    }
  37
+}
  38
+
  39
+/****************************************************/
  40
+
20 41
 void test1()
21 42
 {
22 43
     int foo;
@@ -206,10 +227,8 @@ L1:
206 227
 	pop	EBX			;
207 228
 	mov	p[EBP],EBX		;
208 229
     }
209  
-    for (i = 0; i < data.length; i++)
210  
-    {
211  
-	assert(p[i] == data[i]);
212  
-    }
  230
+
  231
+    compareBytes(p, data);
213 232
 }
214 233
 
215 234
 
@@ -244,10 +263,8 @@ L1:					;
244 263
 	pop	EBX			;
245 264
 	mov	p[EBP],EBX		;
246 265
     }
247  
-    for (i = 0; i < data.length; i++)
248  
-    {
249  
-	assert(p[i] == data[i]);
250  
-    }
  266
+
  267
+    compareBytes(p, data);
251 268
 }
252 269
 
253 270
 
@@ -353,10 +370,8 @@ L1:					;
353 370
 	pop	EBX			;
354 371
 	mov	p[EBP],EBX		;
355 372
     }
356  
-    for (i = 0; i < data.length; i++)
357  
-    {
358  
-	assert(p[i] == data[i]);
359  
-    }
  373
+
  374
+    compareBytes(p, data);
360 375
 }
361 376
 
362 377
 
@@ -429,10 +444,8 @@ L1:					;
429 444
 	pop	EBX			;
430 445
 	mov	p[EBP],EBX		;
431 446
     }
432  
-    for (i = 0; i < data.length; i++)
433  
-    {
434  
-	assert(p[i] == data[i]);
435  
-    }
  447
+
  448
+    compareBytes(p, data);
436 449
 }
437 450
 
438 451
 
@@ -691,11 +704,8 @@ L1:					;
691 704
 	pop	EBX			;
692 705
 	mov	p[EBP],EBX		;
693 706
     }
694  
-    for (i = 0; i < data.length; i++)
695  
-    {
696  
-	//printf("p[%d] = x%02x, data = x%02x\n", i, p[i], data[i]);
697  
-	assert(p[i] == data[i]);
698  
-    }
  707
+
  708
+    compareBytes(p, data);
699 709
 }
700 710
 
701 711
 
@@ -1106,11 +1116,8 @@ L1:					;
1106 1116
 	pop	EBX			;
1107 1117
 	mov	p[EBP],EBX		;
1108 1118
     }
1109  
-    for (i = 0; i < data.length; i++)
1110  
-    {
1111  
-	//printf("[%d] = %02x %02x\n", i, p[i], data[i]);
1112  
-	assert(p[i] == data[i]);
1113  
-    }
  1119
+
  1120
+    compareBytes(p, data);
1114 1121
 }
1115 1122
 
1116 1123
 
@@ -1857,10 +1864,8 @@ L1:					;
1857 1864
 	pop	EBX			;
1858 1865
 	mov	p[EBP],EBX		;
1859 1866
     }
1860  
-    for (i = 0; i < data.length; i++)
1861  
-    {
1862  
-	assert(p[i] == data[i]);
1863  
-    }
  1867
+
  1868
+    compareBytes(p, data);
1864 1869
 }
1865 1870
 
1866 1871
 /****************************************************/
@@ -1978,10 +1983,8 @@ L1:					;
1978 1983
 	pop	EBX			;
1979 1984
 	mov	p[EBP],EBX		;
1980 1985
     }
1981  
-    for (i = 0; i < data.length; i++)
1982  
-    {
1983  
-	assert(p[i] == data[i]);
1984  
-    }
  1986
+
  1987
+    compareBytes(p, data);
1985 1988
 }
1986 1989
 
1987 1990
 
@@ -2020,10 +2023,8 @@ L1:
2020 2023
 	pop	EBX			;
2021 2024
 	mov	p[EBP],EBX		;
2022 2025
     }
2023  
-    for (i = 0; i < data.length; i++)
2024  
-    {
2025  
-	assert(p[i] == data[i]);
2026  
-    }
  2026
+
  2027
+    compareBytes(p, data);
2027 2028
 }
2028 2029
 
2029 2030
 
@@ -2077,10 +2078,8 @@ L1:
2077 2078
 	pop	EBX			;
2078 2079
 	mov	p[EBP],EBX		;
2079 2080
     }
2080  
-    for (i = 0; i < data.length; i++)
2081  
-    {
2082  
-	assert(p[i] == data[i]);
2083  
-    }
  2081
+
  2082
+    compareBytes(p, data);
2084 2083
 }
2085 2084
 
2086 2085
 
@@ -2149,10 +2148,8 @@ L1:
2149 2148
 	pop	EBX			;
2150 2149
 	mov	p[EBP],EBX		;
2151 2150
     }
2152  
-    for (i = 0; i < data.length; i++)
2153  
-    {
2154  
-	assert(p[i] == data[i]);
2155  
-    }
  2151
+
  2152
+    compareBytes(p, data);
2156 2153
 }
2157 2154
 
2158 2155
 
@@ -2200,10 +2197,8 @@ L1:
2200 2197
 	pop	EBX			;
2201 2198
 	mov	p[EBP],EBX		;
2202 2199
     }
2203  
-    for (i = 0; i < data.length; i++)
2204  
-    {
2205  
-	assert(p[i] == data[i]);
2206  
-    }
  2200
+
  2201
+    compareBytes(p, data);
2207 2202
 }
2208 2203
 
2209 2204
 
@@ -2229,10 +2224,8 @@ L1:
2229 2224
 	pop	EBX			;
2230 2225
 	mov	p[EBP],EBX		;
2231 2226
     }
2232  
-    for (i = 0; i < data.length; i++)
2233  
-    {
2234  
-	assert(p[i] == data[i]);
2235  
-    }
  2227
+
  2228
+    compareBytes(p, data);
2236 2229
 }
2237 2230
 
2238 2231
 
@@ -2330,10 +2323,8 @@ L1:					;
2330 2323
 	pop	EBX			;
2331 2324
 	mov	p[EBP],EBX		;
2332 2325
     }
2333  
-    for (i = 0; i < data.length; i++)
2334  
-    {
2335  
-	assert(p[i] == data[i]);
2336  
-    }
  2326
+
  2327
+    compareBytes(p, data);
2337 2328
 }
2338 2329
 
2339 2330
 /****************************************************/
@@ -2511,10 +2502,8 @@ L1:					;
2511 2502
 	pop	EBX			;
2512 2503
 	mov	p[EBP],EBX		;
2513 2504
     }
2514  
-    for (i = 0; i < data.length; i++)
2515  
-    {
2516  
-	assert(p[i] == data[i]);
2517  
-    }
  2505
+
  2506
+    compareBytes(p, data);
2518 2507
 }
2519 2508
 
2520 2509
 /****************************************************/
@@ -2678,10 +2667,8 @@ L1:					;
2678 2667
 	pop	EBX			;
2679 2668
 	mov	p[EBP],EBX		;
2680 2669
     }
2681  
-    for (i = 0; i < data.length; i++)
2682  
-    {
2683  
-	assert(p[i] == data[i]);
2684  
-    }
  2670
+
  2671
+    compareBytes(p, data);
2685 2672
 }
2686 2673
 
2687 2674
 
@@ -2961,10 +2948,8 @@ L1:					;
2961 2948
 	pop	EBX			;
2962 2949
 	mov	p[EBP],EBX		;
2963 2950
     }
2964  
-    for (i = 0; i < data.length; i++)
2965  
-    {
2966  
-	assert(p[i] == data[i]);
2967  
-    }
  2951
+
  2952
+    compareBytes(p, data);
2968 2953
 }
2969 2954
 
2970 2955
 
@@ -3058,10 +3043,8 @@ L1:					;
3058 3043
 	pop	EBX			;
3059 3044
 	mov	p[EBP],EBX		;
3060 3045
     }
3061  
-    for (i = 0; i < data.length; i++)
3062  
-    {
3063  
-	assert(p[i] == data[i]);
3064  
-    }
  3046
+
  3047
+    compareBytes(p, data);
3065 3048
 }
3066 3049
 
3067 3050
 
@@ -3098,10 +3081,8 @@ L1:					;
3098 3081
 	pop	EBX			;
3099 3082
 	mov	p[EBP],EBX		;
3100 3083
     }
3101  
-    for (i = 0; i < data.length; i++)
3102  
-    {
3103  
-	assert(p[i] == data[i]);
3104  
-    }
  3084
+
  3085
+    compareBytes(p, data);
3105 3086
 }
3106 3087
 
3107 3088
 
@@ -3575,10 +3556,8 @@ L1:					;
3575 3556
 	pop	EBX			;
3576 3557
 	mov	p[EBP],EBX		;
3577 3558
     }
3578  
-    for (i = 0; i < data.length; i++)
3579  
-    {
3580  
-	assert(p[i] == data[i]);
3581  
-    }
  3559
+
  3560
+    compareBytes(p, data);
3582 3561
 }
3583 3562
 
3584 3563
 
@@ -3827,10 +3806,8 @@ L1:					;
3827 3806
 	pop	EBX			;
3828 3807
 	mov	p[EBP],EBX		;
3829 3808
     }
3830  
-    for (i = 0; i < data.length; i++)
3831  
-    {
3832  
-	assert(p[i] == data[i]);
3833  
-    }
  3809
+
  3810
+    compareBytes(p, data);
3834 3811
 }
3835 3812
 
3836 3813
 
@@ -3857,7 +3834,7 @@ void test52()
3857 3834
 	0xF7, 0xD8,             	// neg	EAX
3858 3835
 	0xF6, 0xDC,             	// neg	AH
3859 3836
 
3860  
-	0xF7, 0x5D, 0xe8,          	// neg	dword ptr -8[EBP]
  3837
+	0xF7, 0x5D, 0xF8,          	// neg	dword ptr -8[EBP]
3861 3838
 	0xF6, 0x1B,             	// neg	byte ptr [EBX]
3862 3839
     ];
3863 3840
 
@@ -3880,11 +3857,7 @@ L1:	pop	EAX	;
3880 3857
 	mov	p[EBP],EAX ;
3881 3858
     }
3882 3859
 
3883  
-    foreach (i,b; data)
3884  
-    {
3885  
-	//printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
3886  
-	assert(p[i] == b);
3887  
-    }
  3860
+    compareBytes(p, data);
3888 3861
 }
3889 3862
 
3890 3863
 /****************************************************/
@@ -3952,11 +3925,7 @@ L1:	pop	EAX	;
3952 3925
 	mov	p[EBP],EAX ;
3953 3926
     }
3954 3927
 
3955  
-    foreach (i,b; data)
3956  
-    {
3957  
-	//printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
3958  
-	assert(p[i] == b);
3959  
-    }
  3928
+    compareBytes(p, data);
3960 3929
 }
3961 3930
 
3962 3931
 /****************************************************/
@@ -4015,11 +3984,7 @@ L1:     pop     EAX;
4015 3984
         mov     p[EBP],EAX;
4016 3985
     }
4017 3986
 
4018  
-    foreach (i,b; data)
4019  
-    {
4020  
-        //printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
4021  
-        assert(p[i] == b);
4022  
-    }
  3987
+    compareBytes(p, data);
4023 3988
 }
4024 3989
 
4025 3990
 /****************************************************/
@@ -4065,11 +4030,7 @@ L1:     pop     EAX;
4065 4030
         mov     p[EBP],EAX;
4066 4031
     }
4067 4032
 
4068  
-    foreach (i,b; data)
4069  
-    {
4070  
-        //printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
4071  
-        assert(p[i] == b);
4072  
-    }
  4033
+    compareBytes(p, data);
4073 4034
 }
4074 4035
 
4075 4036
 /****************************************************/
@@ -4113,68 +4074,68 @@ void test57()
4113 4074
     [
4114 4075
         0x0F, 0x3A, 0x0F, 0xCA,       0x03,    // palignr   MM1,  MM2, 3
4115 4076
   0x66, 0x0F, 0x3A, 0x0F, 0xCA,       0x03,    // palignr  XMM1, XMM2, 3
4116  
-        0x0F, 0x3A, 0x0F, 0x5D, 0xD8, 0x03,    // palignr   MM3, -0x28[EBP], 3
4117  
-  0x66, 0x0F, 0x3A, 0x0F, 0x5D, 0xE0, 0x03,    // palignr  XMM3, -0x20[EBP], 3
  4077
+        0x0F, 0x3A, 0x0F, 0x5D, 0xE8, 0x03,    // palignr   MM3, -0x18[EBP], 3
  4078
+  0x66, 0x0F, 0x3A, 0x0F, 0x5D, 0xF0, 0x03,    // palignr  XMM3, -0x10[EBP], 3
4118 4079
         0x0F, 0x38, 0x02, 0xCA,                // phaddd    MM1,  MM2
4119 4080
   0x66, 0x0F, 0x38, 0x02, 0xCA,                // phaddd   XMM1, XMM2
4120  
-        0x0F, 0x38, 0x02, 0x5D, 0xD8,          // phaddd    MM3, -0x28[EBP]
4121  
-  0x66, 0x0F, 0x38, 0x02, 0x5D, 0xE0,          // phaddd   XMM3, -0x20[EBP]
  4081
+        0x0F, 0x38, 0x02, 0x5D, 0xE8,          // phaddd    MM3, -0x18[EBP]
  4082
+  0x66, 0x0F, 0x38, 0x02, 0x5D, 0xF0,          // phaddd   XMM3, -0x10[EBP]
4122 4083
         0x0F, 0x38, 0x01, 0xCA,                // phaddw    MM1,  MM2
4123 4084
   0x66, 0x0F, 0x38, 0x01, 0xCA,                // phaddw   XMM1, XMM2
4124  
-        0x0F, 0x38, 0x01, 0x5D, 0xD8,          // phaddw    MM3, -0x28[EBP]
4125  
-  0x66, 0x0F, 0x38, 0x01, 0x5D, 0xE0,          // phaddw   XMM3, -0x20[EBP]
  4085
+        0x0F, 0x38, 0x01, 0x5D, 0xE8,          // phaddw    MM3, -0x18[EBP]
  4086
+  0x66, 0x0F, 0x38, 0x01, 0x5D, 0xF0,          // phaddw   XMM3, -0x10[EBP]
4126 4087
         0x0F, 0x38, 0x03, 0xCA,                // phaddsw   MM1,  MM2
4127 4088
   0x66, 0x0F, 0x38, 0x03, 0xCA,                // phaddsw  XMM1, XMM2
4128  
-        0x0F, 0x38, 0x03, 0x5D, 0xD8,          // phaddsw   MM3, -0x28[EBP]
4129  
-  0x66, 0x0F, 0x38, 0x03, 0x5D, 0xE0,          // phaddsw  XMM3, -0x20[EBP]
  4089
+        0x0F, 0x38, 0x03, 0x5D, 0xE8,          // phaddsw   MM3, -0x18[EBP]
  4090
+  0x66, 0x0F, 0x38, 0x03, 0x5D, 0xF0,          // phaddsw  XMM3, -0x10[EBP]
4130 4091
         0x0F, 0x38, 0x06, 0xCA,                // phsubd    MM1,  MM2
4131 4092
   0x66, 0x0F, 0x38, 0x06, 0xCA,                // phsubd   XMM1, XMM2
4132  
-        0x0F, 0x38, 0x06, 0x5D, 0xD8,          // phsubd    MM3, -0x28[EBP]
4133  
-  0x66, 0x0F, 0x38, 0x06, 0x5D, 0xE0,          // phsubd   XMM3, -0x20[EBP]
  4093
+        0x0F, 0x38, 0x06, 0x5D, 0xE8,          // phsubd    MM3, -0x18[EBP]
  4094
+  0x66, 0x0F, 0x38, 0x06, 0x5D, 0xF0,          // phsubd   XMM3, -0x10[EBP]
4134 4095
         0x0F, 0x38, 0x05, 0xCA,                // phsubw    MM1,  MM2
4135 4096
   0x66, 0x0F, 0x38, 0x05, 0xCA,                // phsubw   XMM1, XMM2
4136  
-        0x0F, 0x38, 0x05, 0x5D, 0xD8,          // phsubw    MM3, -0x28[EBP]
4137  
-  0x66, 0x0F, 0x38, 0x05, 0x5D, 0xE0,          // phsubw   XMM3, -0x20[EBP]
  4097
+        0x0F, 0x38, 0x05, 0x5D, 0xE8,          // phsubw    MM3, -0x18[EBP]
  4098
+  0x66, 0x0F, 0x38, 0x05, 0x5D, 0xF0,          // phsubw   XMM3, -0x10[EBP]
4138 4099
         0x0F, 0x38, 0x07, 0xCA,                // phsubsw   MM1,  MM2
4139 4100
   0x66, 0x0F, 0x38, 0x07, 0xCA,                // phsubsw  XMM1, XMM2
4140  
-        0x0F, 0x38, 0x07, 0x5D, 0xD8,          // phsubsw   MM3, -0x28[EBP]
4141  
-  0x66, 0x0F, 0x38, 0x07, 0x5D, 0xE0,          // phsubsw  XMM3, -0x20[EBP]
  4101
+        0x0F, 0x38, 0x07, 0x5D, 0xE8,          // phsubsw   MM3, -0x18[EBP]
  4102
+  0x66, 0x0F, 0x38, 0x07, 0x5D, 0xF0,          // phsubsw  XMM3, -0x10[EBP]
4142 4103
         0x0F, 0x38, 0x04, 0xCA,                // pmaddubsw  MM1,  MM2
4143 4104
   0x66, 0x0F, 0x38, 0x04, 0xCA,                // pmaddubsw XMM1, XMM2
4144  
-        0x0F, 0x38, 0x04, 0x5D, 0xD8,          // pmaddubsw  MM3, -0x28[EBP]
4145  
-  0x66, 0x0F, 0x38, 0x04, 0x5D, 0xE0,          // pmaddubsw XMM3, -0x20[EBP]
  4105
+        0x0F, 0x38, 0x04, 0x5D, 0xE8,          // pmaddubsw  MM3, -0x18[EBP]
  4106
+  0x66, 0x0F, 0x38, 0x04, 0x5D, 0xF0,          // pmaddubsw XMM3, -0x10[EBP]
4146 4107
         0x0F, 0x38, 0x0B, 0xCA,                // pmulhrsw  MM1,  MM2
4147 4108
   0x66, 0x0F, 0x38, 0x0B, 0xCA,                // pmulhrsw XMM1, XMM2
4148  
-        0x0F, 0x38, 0x0B, 0x5D, 0xD8,          // pmulhrsw  MM3, -0x28[EBP]
4149  
-  0x66, 0x0F, 0x38, 0x0B, 0x5D, 0xE0,          // pmulhrsw XMM3, -0x20[EBP]
  4109
+        0x0F, 0x38, 0x0B, 0x5D, 0xE8,          // pmulhrsw  MM3, -0x18[EBP]
  4110
+  0x66, 0x0F, 0x38, 0x0B, 0x5D, 0xF0,          // pmulhrsw XMM3, -0x10[EBP]
4150 4111
         0x0F, 0x38, 0x00, 0xCA,                // pshufb    MM1,  MM2
4151 4112
   0x66, 0x0F, 0x38, 0x00, 0xCA,                // pshufb   XMM1, XMM2
4152  
-        0x0F, 0x38, 0x00, 0x5D, 0xD8,          // pshufb    MM3, -0x28[EBP]
4153  
-  0x66, 0x0F, 0x38, 0x00, 0x5D, 0xE0,          // pshufb   XMM3, -0x20[EBP]
  4113
+        0x0F, 0x38, 0x00, 0x5D, 0xE8,          // pshufb    MM3, -0x18[EBP]
  4114
+  0x66, 0x0F, 0x38, 0x00, 0x5D, 0xF0,          // pshufb   XMM3, -0x10[EBP]
4154 4115
         0x0F, 0x38, 0x1C, 0xCA,                // pabsb     MM1,  MM2
4155 4116
   0x66, 0x0F, 0x38, 0x1C, 0xCA,                // pabsb    XMM1, XMM2
4156  
-        0x0F, 0x38, 0x1C, 0x5D, 0xD8,          // pabsb     MM3, -0x28[EBP]
4157  
-  0x66, 0x0F, 0x38, 0x1C, 0x5D, 0xE0,          // pabsb    XMM3, -0x20[EBP]
  4117
+        0x0F, 0x38, 0x1C, 0x5D, 0xE8,          // pabsb     MM3, -0x18[EBP]
  4118
+  0x66, 0x0F, 0x38, 0x1C, 0x5D, 0xF0,          // pabsb    XMM3, -0x10[EBP]
4158 4119
         0x0F, 0x38, 0x1E, 0xCA,                // pabsd     MM1,  MM2
4159 4120
   0x66, 0x0F, 0x38, 0x1E, 0xCA,                // pabsd    XMM1, XMM2
4160  
-        0x0F, 0x38, 0x1E, 0x5D, 0xD8,          // pabsd     MM3, -0x28[EBP]
4161  
-  0x66, 0x0F, 0x38, 0x1E, 0x5D, 0xE0,          // pabsd    XMM3, -0x20[EBP]
  4121
+        0x0F, 0x38, 0x1E, 0x5D, 0xE8,          // pabsd     MM3, -0x18[EBP]
  4122
+  0x66, 0x0F, 0x38, 0x1E, 0x5D, 0xF0,          // pabsd    XMM3, -0x10[EBP]
4162 4123
         0x0F, 0x38, 0x1D, 0xCA,                // pabsw     MM1,  MM2
4163 4124
   0x66, 0x0F, 0x38, 0x1D, 0xCA,                // pabsw    XMM1, XMM2
4164  
-        0x0F, 0x38, 0x1D, 0x5D, 0xD8,          // pabsw     MM3, -0x28[EBP]
4165  
-  0x66, 0x0F, 0x38, 0x1D, 0x5D, 0xE0,          // pabsw    XMM3, -0x20[EBP]
  4125
+        0x0F, 0x38, 0x1D, 0x5D, 0xE8,          // pabsw     MM3, -0x18[EBP]
  4126
+  0x66, 0x0F, 0x38, 0x1D, 0x5D, 0xF0,          // pabsw    XMM3, -0x10[EBP]
4166 4127
         0x0F, 0x38, 0x08, 0xCA,                // psignb    MM1,  MM2
4167 4128
   0x66, 0x0F, 0x38, 0x08, 0xCA,                // psignb   XMM1, XMM2
4168  
-        0x0F, 0x38, 0x08, 0x5D, 0xD8,          // psignb    MM3, -0x28[EBP]
4169  
-  0x66, 0x0F, 0x38, 0x08, 0x5D, 0xE0,          // psignb   XMM3, -0x20[EBP]
  4129
+        0x0F, 0x38, 0x08, 0x5D, 0xE8,          // psignb    MM3, -0x18[EBP]
  4130
+  0x66, 0x0F, 0x38, 0x08, 0x5D, 0xF0,          // psignb   XMM3, -0x10[EBP]
4170 4131
         0x0F, 0x38, 0x0A, 0xCA,                // psignd    MM1,  MM2
4171 4132
   0x66, 0x0F, 0x38, 0x0A, 0xCA,                // psignd   XMM1, XMM2
4172  
-        0x0F, 0x38, 0x0A, 0x5D, 0xD8,          // psignd    MM3, -0x28[EBP]
4173  
-  0x66, 0x0F, 0x38, 0x0A, 0x5D, 0xE0,          // psignd   XMM3, -0x20[EBP]
  4133
+        0x0F, 0x38, 0x0A, 0x5D, 0xE8,          // psignd    MM3, -0x18[EBP]
  4134
+  0x66, 0x0F, 0x38, 0x0A, 0x5D, 0xF0,          // psignd   XMM3, -0x10[EBP]
4174 4135
         0x0F, 0x38, 0x09, 0xCA,                // psignw    MM1,  MM2
4175 4136
   0x66, 0x0F, 0x38, 0x09, 0xCA,                // psignw   XMM1, XMM2
4176  
-        0x0F, 0x38, 0x09, 0x5D, 0xD8,          // psignw    MM3, -0x28[EBP]
4177  
-  0x66, 0x0F, 0x38, 0x09, 0x5D, 0xE0,          // psignw   XMM3, -0x20[EBP]
  4137
+        0x0F, 0x38, 0x09, 0x5D, 0xE8,          // psignw    MM3, -0x18[EBP]
  4138
+  0x66, 0x0F, 0x38, 0x09, 0x5D, 0xF0,          // psignw   XMM3, -0x10[EBP]
4178 4139
     ];
4179 4140
 
4180 4141
     asm
@@ -4265,11 +4226,7 @@ L1:     pop     EAX;
4265 4226
         mov     p[EBP],EAX;
4266 4227
     }
4267 4228
 
4268  
-    foreach (i,b; data)
4269  
-    {
4270  
-        //printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
4271  
-        assert(p[i] == b);
4272  
-    }
  4229
+    compareBytes(p, data);
4273 4230
 }
4274 4231
 
4275 4232
 /****************************************************/
@@ -4287,113 +4244,113 @@ void test58()
4287 4244
     static ubyte data[] =
4288 4245
     [
4289 4246
   0x66,       0x0F, 0x3A, 0x0D, 0xCA,        3,// blendpd  XMM1,XMM2,0x3
4290  
-  0x66,       0x0F, 0x3A, 0x0D, 0x5D, 0xE0,  3,// blendpd  XMM3,XMMWORD PTR [RBP-0x20],0x3
  4247
+  0x66,       0x0F, 0x3A, 0x0D, 0x5D, 0xF0,  3,// blendpd  XMM3,XMMWORD PTR [RBP-0x10],0x3
4291 4248
   0x66,       0x0F, 0x3A, 0x0C, 0xCA,        3,// blendps  XMM1,XMM2,0x3
4292  
-  0x66,       0x0F, 0x3A, 0x0C, 0x5D, 0xE0,  3,// blendps  XMM3,XMMWORD PTR [RBP-0x20],0x3
  4249
+  0x66,       0x0F, 0x3A, 0x0C, 0x5D, 0xF0,  3,// blendps  XMM3,XMMWORD PTR [RBP-0x10],0x3
4293 4250
   0x66,       0x0F, 0x38, 0x15, 0xCA,          // blendvpd XMM1,XMM2,XMM0
4294  
-  0x66,       0x0F, 0x38, 0x15, 0x5D, 0xE0,    // blendvpd XMM3,XMMWORD PTR [RBP-0x20],XMM0
  4251
+  0x66,       0x0F, 0x38, 0x15, 0x5D, 0xF0,    // blendvpd XMM3,XMMWORD PTR [RBP-0x10],XMM0
4295 4252
   0x66,       0x0F, 0x38, 0x14, 0xCA,          // blendvps XMM1,XMM2,XMM0
4296  
-  0x66,       0x0F, 0x38, 0x14, 0x5D, 0xE0,    // blendvps XMM3,XMMWORD PTR [RBP-0x20],XMM0
  4253
+  0x66,       0x0F, 0x38, 0x14, 0x5D, 0xF0,    // blendvps XMM3,XMMWORD PTR [RBP-0x10],XMM0
4297 4254
   0x66,       0x0F, 0x3A, 0x41, 0xCA,        3,// dppd     XMM1,XMM2,0x3
4298  
-  0x66,       0x0F, 0x3A, 0x41, 0x5D, 0xE0,  3,// dppd     XMM3,XMMWORD PTR [RBP-0x20],0x3
  4255
+  0x66,       0x0F, 0x3A, 0x41, 0x5D, 0xF0,  3,// dppd     XMM3,XMMWORD PTR [RBP-0x10],0x3
4299 4256
   0x66,       0x0F, 0x3A, 0x40, 0xCA,        3,// dpps     XMM1,XMM2,0x3
4300  
-  0x66,       0x0F, 0x3A, 0x40, 0x5D, 0xE0,  3,// dpps     XMM3,XMMWORD PTR [RBP-0x20],0x3
  4257
+  0x66,       0x0F, 0x3A, 0x40, 0x5D, 0xF0,  3,// dpps     XMM3,XMMWORD PTR [RBP-0x10],0x3
4301 4258
   0x66,       0x0F, 0x3A, 0x17, 0xD2,        3,// extractps EDX,XMM2,0x3
4302  
-  0x66,       0x0F, 0x3A, 0x17, 0x55, 0xC8,  3,// extractps DWORD PTR [RBP-0x38],XMM2,0x3
  4259
+  0x66,       0x0F, 0x3A, 0x17, 0x55, 0xD8,  3,// extractps DWORD PTR [RBP-0x28],XMM2,0x3
4303 4260
   0x66,       0x0F, 0x3A, 0x21, 0xCA,        3,// insertps XMM1,XMM2,0x3
4304  
-  0x66,       0x0F, 0x3A, 0x21, 0x5D, 0xC8,  3,// insertps XMM3,DWORD PTR [RBP-0x38],0x3
4305  
-  0x66,       0x0F, 0x38, 0x2A, 0x4D, 0xE0,    // movntdqa XMM1,XMMWORD PTR [RBP-0x20]
  4261
+  0x66,       0x0F, 0x3A, 0x21, 0x5D, 0xD8,  3,// insertps XMM3,DWORD PTR [RBP-0x28],0x3
  4262
+  0x66,       0x0F, 0x38, 0x2A, 0x4D, 0xF0,    // movntdqa XMM1,XMMWORD PTR [RBP-0x10]
4306 4263
   0x66,       0x0F, 0x3A, 0x42, 0xCA,        3,// mpsadbw  XMM1,XMM2,0x3
4307  
-  0x66,       0x0F, 0x3A, 0x42, 0x5D, 0xE0,  3,// mpsadbw  XMM3,XMMWORD PTR [RBP-0x20],0x3
  4264
+  0x66,       0x0F, 0x3A, 0x42, 0x5D, 0xF0,  3,// mpsadbw  XMM3,XMMWORD PTR [RBP-0x10],0x3
4308 4265
   0x66,       0x0F, 0x38, 0x2B, 0xCA,          // packusdw XMM1,XMM2
4309  
-  0x66,       0x0F, 0x38, 0x2B, 0x5D, 0xE0,    // packusdw XMM3,XMMWORD PTR [RBP-0x20]
  4266
+  0x66,       0x0F, 0x38, 0x2B, 0x5D, 0xF0,    // packusdw XMM3,XMMWORD PTR [RBP-0x10]
4310 4267
   0x66,       0x0F, 0x38, 0x10, 0xCA,          // pblendvb XMM1,XMM2,XMM0
4311  
-  0x66,       0x0F, 0x38, 0x10, 0x5D, 0xE0,    // pblendvb XMM3,XMMWORD PTR [RBP-0x20],XMM0
  4268
+  0x66,       0x0F, 0x38, 0x10, 0x5D, 0xF0,    // pblendvb XMM3,XMMWORD PTR [RBP-0x10],XMM0
4312 4269
   0x66,       0x0F, 0x3A, 0x0E, 0xCA,        3,// pblendw  XMM1,XMM2,0x3
4313  
-  0x66,       0x0F, 0x3A, 0x0E, 0x5D, 0xE0,  3,// pblendw  XMM3,XMMWORD PTR [RBP-0x20],0x3
  4270
+  0x66,       0x0F, 0x3A, 0x0E, 0x5D, 0xF0,  3,// pblendw  XMM3,XMMWORD PTR [RBP-0x10],0x3
4314 4271
   0x66,       0x0F, 0x38, 0x29, 0xCA,          // pcmpeqq  XMM1,XMM2
4315  
-  0x66,       0x0F, 0x38, 0x29, 0x5D, 0xE0,    // pcmpeqq  XMM3,XMMWORD PTR [RBP-0x20]
  4272
+  0x66,       0x0F, 0x38, 0x29, 0x5D, 0xF0,    // pcmpeqq  XMM3,XMMWORD PTR [RBP-0x10]
4316 4273
   0x66,       0x0F, 0x3A, 0x14, 0xD0,        3,// pextrb EAX,XMM2,0x3
4317 4274
   0x66,       0x0F, 0x3A, 0x14, 0xD3,        3,// pextrb EBX,XMM2,0x3
4318 4275
   0x66,       0x0F, 0x3A, 0x14, 0xD1,        3,// pextrb ECX,XMM2,0x3
4319 4276
   0x66,       0x0F, 0x3A, 0x14, 0xD2,        3,// pextrb EDX,XMM2,0x3
4320  
-  0x66,       0x0F, 0x3A, 0x14, 0x5D, 0xC4,  3,// pextrb BYTE PTR [RBP-0x3C],XMM3,0x3
  4277
+  0x66,       0x0F, 0x3A, 0x14, 0x5D, 0xD4,  3,// pextrb BYTE PTR [RBP-0x2C],XMM3,0x3
4321 4278
   0x66,       0x0F, 0x3A, 0x16, 0xD0,        3,// pextrd EAX,XMM2,0x3
4322 4279
   0x66,       0x0F, 0x3A, 0x16, 0xD3,        3,// pextrd EBX,XMM2,0x3
4323 4280
   0x66,       0x0F, 0x3A, 0x16, 0xD1,        3,// pextrd ECX,XMM2,0x3
4324 4281
   0x66,       0x0F, 0x3A, 0x16, 0xD2,        3,// pextrd EDX,XMM2,0x3
4325  
-  0x66,       0x0F, 0x3A, 0x16, 0x5D, 0xC8,  3,// pextrd DWORD PTR [RBP-0x38],XMM3,0x3
  4282
+  0x66,       0x0F, 0x3A, 0x16, 0x5D, 0xD8,  3,// pextrd DWORD PTR [RBP-0x28],XMM3,0x3
4326 4283
   0x66,       0x0F, 0xC5, 0xC2,              3,// pextrw EAX,XMM2,0x3
4327 4284
   0x66,       0x0F, 0xC5, 0xDA,              3,// pextrw EBX,XMM2,0x3
4328 4285
   0x66,       0x0F, 0xC5, 0xCA,              3,// pextrw ECX,XMM2,0x3
4329 4286
   0x66,       0x0F, 0xC5, 0xD2,              3,// pextrw EDX,XMM2,0x3
4330  
-  0x66,       0x0F, 0x3A, 0x15, 0x5D, 0xC6,  3,// pextrw WORD PTR [RBP-0x3A],XMM3,0x3
  4287
+  0x66,       0x0F, 0x3A, 0x15, 0x5D, 0xD6,  3,// pextrw WORD PTR [RBP-0x2A],XMM3,0x3
4331 4288
   0x66,       0x0F, 0x38, 0x41, 0xCA,          // phminposuw XMM1,XMM2
4332  
-  0x66,       0x0F, 0x38, 0x41, 0x5D, 0xE0,    // phminposuw XMM3,XMMWORD PTR [RBP-0x20]
  4289
+  0x66,       0x0F, 0x38, 0x41, 0x5D, 0xF0,    // phminposuw XMM3,XMMWORD PTR [RBP-0x10]
4333 4290
   0x66,       0x0F, 0x3A, 0x20, 0xC8,        3,// pinsrb  XMM1,EAX,0x3
4334 4291
   0x66,       0x0F, 0x3A, 0x20, 0xCB,        3,// pinsrb  XMM1,EBX,0x3
4335 4292
   0x66,       0x0F, 0x3A, 0x20, 0xC9,        3,// pinsrb  XMM1,ECX,0x3
4336 4293
   0x66,       0x0F, 0x3A, 0x20, 0xCA,        3,// pinsrb  XMM1,EDX,0x3
4337  
-  0x66,       0x0F, 0x3A, 0x20, 0x5D, 0xC4,  3,// pinsrb  XMM3,BYTE PTR [RBP-0x3C],0x3
  4294
+  0x66,       0x0F, 0x3A, 0x20, 0x5D, 0xD4,  3,// pinsrb  XMM3,BYTE PTR [RBP-0x2C],0x3
4338 4295
   0x66,       0x0F, 0x3A, 0x22, 0xC8,        3,// pinsrd  XMM1,EAX,0x3
4339 4296
   0x66,       0x0F, 0x3A, 0x22, 0xCB,        3,// pinsrd  XMM1,EBX,0x3
4340 4297
   0x66,       0x0F, 0x3A, 0x22, 0xC9,        3,// pinsrd  XMM1,ECX,0x3
4341 4298
   0x66,       0x0F, 0x3A, 0x22, 0xCA,        3,// pinsrd  XMM1,EDX,0x3
4342  
-  0x66,       0x0F, 0x3A, 0x22, 0x5D, 0xC8,  3,// pinsrd  XMM3,DWORD PTR [RBP-0x38],0x3
  4299
+  0x66,       0x0F, 0x3A, 0x22, 0x5D, 0xD8,  3,// pinsrd  XMM3,DWORD PTR [RBP-0x28],0x3
4343 4300
   0x66,       0x0F, 0x38, 0x3C, 0xCA,          // pmaxsb  XMM1,XMM2
4344  
-  0x66,       0x0F, 0x38, 0x3C, 0x5D, 0xE0,    // pmaxsb  XMM3,XMMWORD PTR [RBP-0x20]
  4301
+  0x66,       0x0F, 0x38, 0x3C, 0x5D, 0xF0,    // pmaxsb  XMM3,XMMWORD PTR [RBP-0x10]
4345 4302
   0x66,       0x0F, 0x38, 0x3D, 0xCA,          // pmaxsd  XMM1,XMM2
4346  
-  0x66,       0x0F, 0x38, 0x3D, 0x5D, 0xE0,    // pmaxsd  XMM3,XMMWORD PTR [RBP-0x20]
  4303
+  0x66,       0x0F, 0x38, 0x3D, 0x5D, 0xF0,    // pmaxsd  XMM3,XMMWORD PTR [RBP-0x10]
4347 4304
   0x66,       0x0F, 0x38, 0x3F, 0xCA,          // pmaxud  XMM1,XMM2
4348  
-  0x66,       0x0F, 0x38, 0x3F, 0x5D, 0xE0,    // pmaxud  XMM3,XMMWORD PTR [RBP-0x20]
  4305
+  0x66,       0x0F, 0x38, 0x3F, 0x5D, 0xF0,    // pmaxud  XMM3,XMMWORD PTR [RBP-0x10]
4349 4306
   0x66,       0x0F, 0x38, 0x3E, 0xCA,          // pmaxuw  XMM1,XMM2
4350  
-  0x66,       0x0F, 0x38, 0x3E, 0x5D, 0xE0,    // pmaxuw  XMM3,XMMWORD PTR [RBP-0x20]
  4307
+  0x66,       0x0F, 0x38, 0x3E, 0x5D, 0xF0,    // pmaxuw  XMM3,XMMWORD PTR [RBP-0x10]
4351 4308
   0x66,       0x0F, 0x38, 0x38, 0xCA,          // pminsb  XMM1,XMM2
4352  
-  0x66,       0x0F, 0x38, 0x38, 0x5D, 0xE0,    // pminsb  XMM3,XMMWORD PTR [RBP-0x20]
  4309
+  0x66,       0x0F, 0x38, 0x38, 0x5D, 0xF0,    // pminsb  XMM3,XMMWORD PTR [RBP-0x10]
4353 4310
   0x66,       0x0F, 0x38, 0x39, 0xCA,          // pminsd  XMM1,XMM2
4354  
-  0x66,       0x0F, 0x38, 0x39, 0x5D, 0xE0,    // pminsd  XMM3,XMMWORD PTR [RBP-0x20]
  4311
+  0x66,       0x0F, 0x38, 0x39, 0x5D, 0xF0,    // pminsd  XMM3,XMMWORD PTR [RBP-0x10]
4355 4312
   0x66,       0x0F, 0x38, 0x3B, 0xCA,          // pminud  XMM1,XMM2
4356  
-  0x66,       0x0F, 0x38, 0x3B, 0x5D, 0xE0,    // pminud  XMM3,XMMWORD PTR [RBP-0x20]
  4313
+  0x66,       0x0F, 0x38, 0x3B, 0x5D, 0xF0,    // pminud  XMM3,XMMWORD PTR [RBP-0x10]
4357 4314
   0x66,       0x0F, 0x38, 0x3A, 0xCA,          // pminuw  XMM1,XMM2
4358  
-  0x66,       0x0F, 0x38, 0x3A, 0x5D, 0xE0,    // pminuw  XMM3,XMMWORD PTR [RBP-0x20]
  4315
+  0x66,       0x0F, 0x38, 0x3A, 0x5D, 0xF0,    // pminuw  XMM3,XMMWORD PTR [RBP-0x10]
4359 4316
   0x66,       0x0F, 0x38, 0x20, 0xCA,          // pmovsxbw XMM1,XMM2
4360  
-  0x66,       0x0F, 0x38, 0x20, 0x5D, 0xD0,    // pmovsxbw XMM3,QWORD PTR [RBP-0x30]
  4317
+  0x66,       0x0F, 0x38, 0x20, 0x5D, 0xE0,    // pmovsxbw XMM3,QWORD PTR [RBP-0x20]
4361 4318
   0x66,       0x0F, 0x38, 0x21, 0xCA,          // pmovsxbd XMM1,XMM2
4362  
-  0x66,       0x0F, 0x38, 0x21, 0x5D, 0xC8,    // pmovsxbd XMM3,DWORD PTR [RBP-0x38]
  4319
+  0x66,       0x0F, 0x38, 0x21, 0x5D, 0xD8,    // pmovsxbd XMM3,DWORD PTR [RBP-0x28]
4363 4320
   0x66,       0x0F, 0x38, 0x22, 0xCA,          // pmovsxbq XMM1,XMM2
4364  
-  0x66,       0x0F, 0x38, 0x22, 0x5D, 0xC6,    // pmovsxbq XMM3,WORD PTR [RBP-0x3A]
  4321
+  0x66,       0x0F, 0x38, 0x22, 0x5D, 0xD6,    // pmovsxbq XMM3,WORD PTR [RBP-0x2A]
4365 4322
   0x66,       0x0F, 0x38, 0x23, 0xCA,          // pmovsxwd XMM1,XMM2
4366  
-  0x66,       0x0F, 0x38, 0x23, 0x5D, 0xD0,    // pmovsxwd XMM3,QWORD PTR [RBP-0x30]
  4323
+  0x66,       0x0F, 0x38, 0x23, 0x5D, 0xE0,    // pmovsxwd XMM3,QWORD PTR [RBP-0x20]
4367 4324
   0x66,       0x0F, 0x38, 0x24, 0xCA,          // pmovsxwq XMM1,XMM2
4368  
-  0x66,       0x0F, 0x38, 0x24, 0x5D, 0xC8,    // pmovsxwq XMM3,DWORD PTR [RBP-0x38]
  4325
+  0x66,       0x0F, 0x38, 0x24, 0x5D, 0xD8,    // pmovsxwq XMM3,DWORD PTR [RBP-0x28]
4369 4326
   0x66,       0x0F, 0x38, 0x25, 0xCA,          // pmovsxdq XMM1,XMM2
4370  
-  0x66,       0x0F, 0x38, 0x25, 0x5D, 0xD0,    // pmovsxdq XMM3,QWORD PTR [RBP-0x30]
  4327
+  0x66,       0x0F, 0x38, 0x25, 0x5D, 0xE0,    // pmovsxdq XMM3,QWORD PTR [RBP-0x20]
4371 4328
   0x66,       0x0F, 0x38, 0x30, 0xCA,          // pmovzxbw XMM1,XMM2
4372  
-  0x66,       0x0F, 0x38, 0x30, 0x5D, 0xD0,    // pmovzxbw XMM3,QWORD PTR [RBP-0x30]
  4329
+  0x66,       0x0F, 0x38, 0x30, 0x5D, 0xE0,    // pmovzxbw XMM3,QWORD PTR [RBP-0x20]
4373 4330
   0x66,       0x0F, 0x38, 0x31, 0xCA,          // pmovzxbd XMM1,XMM2
4374  
-  0x66,       0x0F, 0x38, 0x31, 0x5D, 0xC8,    // pmovzxbd XMM3,DWORD PTR [RBP-0x38]
  4331
+  0x66,       0x0F, 0x38, 0x31, 0x5D, 0xD8,    // pmovzxbd XMM3,DWORD PTR [RBP-0x28]
4375 4332
   0x66,       0x0F, 0x38, 0x32, 0xCA,          // pmovzxbq XMM1,XMM2
4376  
-  0x66,       0x0F, 0x38, 0x32, 0x5D, 0xC6,    // pmovzxbq XMM3,WORD PTR [RBP-0x3A]
  4333
+  0x66,       0x0F, 0x38, 0x32, 0x5D, 0xD6,    // pmovzxbq XMM3,WORD PTR [RBP-0x2A]
4377 4334
   0x66,       0x0F, 0x38, 0x33, 0xCA,          // pmovzxwd XMM1,XMM2
4378  
-  0x66,       0x0F, 0x38, 0x33, 0x5D, 0xD0,    // pmovzxwd XMM3,QWORD PTR [RBP-0x30]
  4335
+  0x66,       0x0F, 0x38, 0x33, 0x5D, 0xE0,    // pmovzxwd XMM3,QWORD PTR [RBP-0x20]
4379 4336
   0x66,       0x0F, 0x38, 0x34, 0xCA,          // pmovzxwq XMM1,XMM2
4380  
-  0x66,       0x0F, 0x38, 0x34, 0x5D, 0xC8,    // pmovzxwq XMM3,DWORD PTR [RBP-0x38]
  4337
+  0x66,       0x0F, 0x38, 0x34, 0x5D, 0xD8,    // pmovzxwq XMM3,DWORD PTR [RBP-0x28]
4381 4338
   0x66,       0x0F, 0x38, 0x35, 0xCA,          // pmovzxdq XMM1,XMM2
4382  
-  0x66,       0x0F, 0x38, 0x35, 0x5D, 0xD0,    // pmovzxdq XMM3,QWORD PTR [RBP-0x30]
  4339
+  0x66,       0x0F, 0x38, 0x35, 0x5D, 0xE0,    // pmovzxdq XMM3,QWORD PTR [RBP-0x20]
4383 4340
   0x66,       0x0F, 0x38, 0x28, 0xCA,          // pmuldq  XMM1,XMM2
4384  
-  0x66,       0x0F, 0x38, 0x28, 0x5D, 0xE0,    // pmuldq  XMM3,XMMWORD PTR [RBP-0x20]
  4341
+  0x66,       0x0F, 0x38, 0x28, 0x5D, 0xF0,    // pmuldq  XMM3,XMMWORD PTR [RBP-0x10]
4385 4342
   0x66,       0x0F, 0x38, 0x40, 0xCA,          // pmulld  XMM1,XMM2
4386  
-  0x66,       0x0F, 0x38, 0x40, 0x5D, 0xE0,    // pmulld  XMM3,XMMWORD PTR [RBP-0x20]
  4343
+  0x66,       0x0F, 0x38, 0x40, 0x5D, 0xF0,    // pmulld  XMM3,XMMWORD PTR [RBP-0x10]
4387 4344
   0x66,       0x0F, 0x38, 0x17, 0xCA,          // ptest   XMM1,XMM2
4388  
-  0x66,       0x0F, 0x38, 0x17, 0x5D, 0xE0,    // ptest   XMM3,XMMWORD PTR [RBP-0x20]
  4345
+  0x66,       0x0F, 0x38, 0x17, 0x5D, 0xF0,    // ptest   XMM3,XMMWORD PTR [RBP-0x10]
4389 4346
   0x66,       0x0F, 0x3A, 0x09, 0xCA,        3,// roundpd XMM1,XMM2,0x3
4390  
-  0x66,       0x0F, 0x3A, 0x09, 0x5D, 0xE0,  3,// roundpd XMM3,XMMWORD PTR [RBP-0x20],0x3
  4347
+  0x66,       0x0F, 0x3A, 0x09, 0x5D, 0xF0,  3,// roundpd XMM3,XMMWORD PTR [RBP-0x10],0x3
4391 4348
   0x66,       0x0F, 0x3A, 0x08, 0xCA,        3,// roundps XMM1,XMM2,0x3
4392  
-  0x66,       0x0F, 0x3A, 0x08, 0x5D, 0xE0,  3,// roundps XMM3,XMMWORD PTR [RBP-0x20],0x3
  4349
+  0x66,       0x0F, 0x3A, 0x08, 0x5D, 0xF0,  3,// roundps XMM3,XMMWORD PTR [RBP-0x10],0x3
4393 4350
   0x66,       0x0F, 0x3A, 0x0B, 0xCA,        3,// roundsd XMM1,XMM2,0x3
4394  
-  0x66,       0x0F, 0x3A, 0x0B, 0x5D, 0xD0,  3,// roundsd XMM3,QWORD PTR [RBP-0x30],0x3
  4351
+  0x66,       0x0F, 0x3A, 0x0B, 0x5D, 0xE0,  3,// roundsd XMM3,QWORD PTR [RBP-0x20],0x3
4395 4352
   0x66,       0x0F, 0x3A, 0x0A, 0xCA,        3,// roundss XMM1,XMM2,0x3
4396  
-  0x66,       0x0F, 0x3A, 0x0A, 0x4D, 0xC8,  3,// roundss xmm1,dword ptr [rbp-0x38],0x3
  4353
+  0x66,       0x0F, 0x3A, 0x0A, 0x4D, 0xD8,  3,// roundss xmm1,dword ptr [rbp-0x28],0x3
4397 4354
     ];
4398 4355
 
4399 4356
     asm
@@ -4559,11 +4516,7 @@ L1:     pop     EAX;
4559 4516
         mov     p[EBP],EAX;
4560 4517
     }
4561 4518
 
4562  
-    foreach (i,b; data)
4563  
-    {
4564  
-        //printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
4565  
-        assert(p[i] == b);
4566  
-    }
  4519
+    compareBytes(p, data);
4567 4520
 }
4568 4521
 
4569 4522
 /****************************************************/
@@ -4583,23 +4536,23 @@ void test59()
4583 4536
 0xF2,       0x0F, 0x38, 0xF0, 0xC1,           // crc32   EAX,  CL
4584 4537
 0x66, 0xF2, 0x0F, 0x38, 0xF1, 0xC1,           // crc32   EAX,  CX
4585 4538
 0xF2,       0x0F, 0x38, 0xF1, 0xC1,           // crc32   EAX, ECX
4586  
-0xF2,       0x0F, 0x38, 0xF0, 0x55, 0xC4,     // crc32   EDX, byte ptr [RBP-0x3C]
4587  
-0x66, 0xF2, 0x0F, 0x38, 0xF1, 0x55, 0xC6,     // crc32   EDX, word ptr [RBP-0x3A]
4588  
-0xF2,       0x0F, 0x38, 0xF1, 0x55, 0xC8,     // crc32   EDX,dword ptr [RBP-0x38]
  4539
+0xF2,       0x0F, 0x38, 0xF0, 0x55, 0xD4,     // crc32   EDX, byte ptr [RBP-0x2C]
  4540
+0x66, 0xF2, 0x0F, 0x38, 0xF1, 0x55, 0xD6,     // crc32   EDX, word ptr [RBP-0x2A]
  4541
+0xF2,       0x0F, 0x38, 0xF1, 0x55, 0xD8,     // crc32   EDX,dword ptr [RBP-0x28]
4589 4542
 0x66,       0x0F, 0x3A, 0x61, 0xCA,        2, // pcmpestri XMM1,XMM2, 2
4590  
-0x66,       0x0F, 0x3A, 0x61, 0x5D, 0xE0,  2, // pcmpestri XMM3,xmmword ptr [RBP-0x20], 2
  4543
+0x66,       0x0F, 0x3A, 0x61, 0x5D, 0xF0,  2, // pcmpestri XMM3,xmmword ptr [RBP-0x10], 2
4591 4544
 0x66,       0x0F, 0x3A, 0x60, 0xCA,        2, // pcmpestrm XMM1,XMM2, 2
4592  
-0x66,       0x0F, 0x3A, 0x60, 0x5D, 0xE0,  2, // pcmpestrm XMM3,xmmword ptr [RBP-0x20], 2
  4545
+0x66,       0x0F, 0x3A, 0x60, 0x5D, 0xF0,  2, // pcmpestrm XMM3,xmmword ptr [RBP-0x10], 2
4593 4546
 0x66,       0x0F, 0x3A, 0x63, 0xCA,        2, // pcmpistri XMM1,XMM2, 2
4594  
-0x66,       0x0F, 0x3A, 0x63, 0x5D, 0xE0,  2, // pcmpistri XMM3,xmmword ptr [RBP-0x20], 2
  4547
+0x66,       0x0F, 0x3A, 0x63, 0x5D, 0xF0,  2, // pcmpistri XMM3,xmmword ptr [RBP-0x10], 2
4595 4548
 0x66,       0x0F, 0x3A, 0x62, 0xCA,        2, // pcmpistrm XMM1,XMM2, 2
4596  
-0x66,       0x0F, 0x3A, 0x62, 0x5D, 0xE0,  2, // pcmpistrm XMM3,xmmword ptr [RBP-0x20], 2
  4549
+0x66,       0x0F, 0x3A, 0x62, 0x5D, 0xF0,  2, // pcmpistrm XMM3,xmmword ptr [RBP-0x10], 2
4597 4550
 0x66,       0x0F, 0x38, 0x37, 0xCA,           // pcmpgtq   XMM1,XMM2
4598  
-0x66,       0x0F, 0x38, 0x37, 0x5D, 0xE0,     // pcmpgtq   XMM3,xmmword ptr [RBP-0x20]
  4551
+0x66,       0x0F, 0x38, 0x37, 0x5D, 0xF0,     // pcmpgtq   XMM3,xmmword ptr [RBP-0x10]
4599 4552
 0x66, 0xF3, 0x0F, 0xB8, 0xC1,                 // popcnt   AX, CX
4600 4553
 0xF3,       0x0F, 0xB8, 0xC1,                 // popcnt  EAX, ECX
4601  
-0x66, 0xF3, 0x0F, 0xB8, 0x55, 0xC6,           // popcnt   DX, word ptr [RBP-0x3A]
4602  
-0xF3,       0x0F, 0xB8, 0x55, 0xC8,           // popcnt  EDX,dword ptr [RBP-0x38]
  4554
+0x66, 0xF3, 0x0F, 0xB8, 0x55, 0xD6,           // popcnt   DX, word ptr [RBP-0x2A]
  4555
+0xF3,       0x0F, 0xB8, 0x55, 0xD8,           // popcnt  EDX,dword ptr [RBP-0x28]
4603 4556
     ];
4604 4557
 
4605 4558
     asm
@@ -4637,11 +4590,7 @@ L1:     pop     EAX;
4637 4590
         mov     p[EBP],EAX;
4638 4591
     }
4639 4592
 
4640  
-    foreach (i,b; data)
4641  
-    {
4642  
-        //printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
4643  
-        assert(p[i] == b);
4644  
-    }
  4593
+    compareBytes(p, data);
4645 4594
 }
4646 4595
 
4647 4596
 /****************************************************/
283  test/runnable/iasm64.d
@@ -3003,6 +3003,27 @@ void test44()
3003 3003
 
3004 3004
 /****************************************************/
3005 3005
 
  3006
+void compareBytes(ubyte *p, ubyte[] data, size_t line = __LINE__)
  3007
+{
  3008
+    if (p[0 .. data.length] != data)
  3009
+    {
  3010
+        import core.stdc.stdio;
  3011
+
  3012
+        size_t pos;
  3013
+        while (pos < data.length)
  3014
+        {
  3015
+            if (p[pos] != data[pos])
  3016
+                break;
  3017
+            ++pos;
  3018
+        }
  3019
+        printf("iasm64.d(%d): asm mismatch\n", line);
  3020
+        printf("data[%d] = 0x%02x, should be 0x%02x\n", pos, p[pos], data[pos]);
  3021
+        assert(0);
  3022
+    }
  3023
+}
  3024
+
  3025
+/****************************************************/
  3026
+
3006 3027
 void test45()
3007 3028
 {
3008 3029
     ubyte *p;
@@ -3038,10 +3059,8 @@ L1:					;
3038 3059
 	pop	RBX			;
3039 3060
 	mov	p[RBP],RBX		;
3040 3061
     }
3041  
-    for (i = 0; i < data.length; i++)
3042  
-    {
3043  
-	assert(p[i] == data[i]);
3044  
-    }
  3062
+
  3063
+    compareBytes(p, data);
3045 3064
 }
3046 3065
 
3047 3066
 /****************************************************/
@@ -3077,10 +3096,8 @@ L1:					;
3077 3096
 	pop	RBX			;
3078 3097
 	mov	p[RBP],RBX		;
3079 3098
     }
3080  
-    for (i = 0; i < data.length; i++)
3081  
-    {
3082  
-	assert(p[i] == data[i]);
3083  
-    }
  3099
+
  3100
+    compareBytes(p, data);
3084 3101
 }
3085 3102
 
3086 3103
 /****************************************************/
@@ -3554,10 +3571,8 @@ L1:					;
3554 3571
 	pop	RBX			;
3555 3572
 	mov	p[RBP],RBX		;
3556 3573
     }
3557  
-    for (i = 0; i < data.length; i++)
3558  
-    {
3559  
-	assert(p[i] == data[i]);
3560  
-    }
  3574
+
  3575
+    compareBytes(p, data);
3561 3576
 }
3562 3577
 
3563 3578
 
@@ -3809,10 +3824,8 @@ L1:					;
3809 3824
 	pop	RBX			;
3810 3825
 	mov	p[RBP],RBX		;
3811 3826
     }
3812  
-    for (i = 0; i < data.length; i++)
3813  
-    {
3814  
-	assert(p[i] == data[i]);
3815  
-    }
  3827
+
  3828
+    compareBytes(p, data);
3816 3829
 }
3817 3830
 
3818 3831
 
@@ -3847,7 +3860,7 @@ void test52()
3847 3860
 //0x66, 	0xF7, 0x1D, 0x00, 0x00, 0x00, 0x00, 	// neg	word ptr _D6iasm641ws@PC32[RIP]
3848 3861
 //	0xF7, 0x1D, 0x00, 0x00, 0x00, 0x00, 	// neg	dword ptr _D6iasm641ii@PC32[RIP]
3849 3862
 //	0x48, 0xF7, 0x1D, 0x00, 0x00, 0x00, 0x00, 	// neg	qword ptr _D6iasm641ll@PC32[RIP]
3850  
-	0xF7, 0x5D, 0xD0,          	// neg	dword ptr -8[RBP]
  3863
+	0xF7, 0x5D, 0xF0,          	// neg	dword ptr -16[RBP]
3851 3864
 	0xF6, 0x1B,             	// neg	byte ptr [RBX]
3852 3865
 	0xF6, 0x1B,             	// neg	byte ptr [RBX]
3853 3866
 	0x49, 0xF7, 0xD8,          	// neg	R8
@@ -3879,11 +3892,7 @@ L1:	pop	RAX	;
3879 3892
 	mov	p[RBP],RAX ;
3880 3893
     }
3881 3894
 
3882  
-    foreach (i,b; data)
3883  
-    {
3884  
-	//printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
3885  
-	assert(p[i] == b);
3886  
-    }
  3895
+    compareBytes(p, data);
3887 3896
 }
3888 3897
 
3889 3898
 /****************************************************/
@@ -4008,11 +4017,7 @@ L1:	pop	RAX	;
4008 4017
 	mov	p[RBP],RAX ;
4009 4018
     }
4010 4019
 
4011  
-    foreach (i,b; data)
4012  
-    {
4013  
-	//printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
4014  
-	assert(p[i] == b);
4015  
-    }
  4020
+    compareBytes(p, data);
4016 4021
 }
4017 4022
 
4018 4023
 /****************************************************/
@@ -4087,11 +4092,7 @@ L1:     pop     RAX;
4087 4092
         mov     p[RBP],RAX;
4088 4093
     }
4089 4094
 
4090  
-    foreach (i,b; data)
4091  
-    {
4092  
-        //printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
4093  
-        assert(p[i] == b);
4094  
-    }
  4095
+    compareBytes(p, data);
4095 4096
 }
4096 4097
 
4097 4098
 /****************************************************/
@@ -4137,11 +4138,7 @@ L1:     pop     RAX;
4137 4138
         mov     p[RBP],RAX;
4138 4139
     }
4139 4140
 
4140  
-    foreach (i,b; data)
4141  
-    {
4142  
-        //printf("data[%d] = 0x%02x, should be 0x%02x\n", i, p[i], b);
4143  
-        assert(p[i] == b);
4144  
-    }
  4141
+    compareBytes(p, data);
4145 4142
 }
4146 4143
 
4147 4144
 /****************************************************/
@@ -4185,68 +4182,68 @@ void test57()
4185 4182
     [