comparison tests/mini/asm10.d @ 1109:97d80437cb80

Fix field access from inline asm. See tests/mini/asm10.d
author Frits van Bommel <fvbommel wxs.nl>
date Thu, 12 Mar 2009 23:48:43 +0100
parents
children
comparison
equal deleted inserted replaced
1108:d03814546977 1109:97d80437cb80
1 module asm10;
2
3 struct S {
4 ushort first;
5 ushort second;
6 int unaccessed;
7 }
8
9 void main() {
10 auto s = S(512, 42, -1);
11 ushort x = 0;
12 version(D_InlineAsm_X86) {
13 asm {
14 lea EAX, s;
15 mov CX, S.second[EAX];
16 mov x, CX;
17 mov S.first[EAX], 640;
18 }
19 } else version(D_InlineAsm_X86_64) {
20 asm {
21 lea RAX, s;
22 mov CX, S.second[RAX];
23 mov x, CX;
24 mov S.first[RAX], 640;
25 }
26 }
27 assert(x == 42);
28 assert(s.first == 640);
29 assert(s.second == 42);
30 assert(s.unaccessed == -1);
31 }