Mercurial > projects > dstress
annotate run/mini/asm10.d @ 1628:c6ef09dfba4d
add mini test set from ldc project
author | Moritz Warning <moritzwarning@web.de> |
---|---|
date | Mon, 10 Jan 2011 19:47:18 +0100 |
parents | |
children |
rev | line source |
---|---|
1628
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
1 module asm10; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
2 |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
3 struct S { |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
4 ushort first; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
5 ushort second; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
6 int unaccessed; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
7 } |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
8 |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
9 void main() { |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
10 auto s = S(512, 42, -1); |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
11 ushort x = 0; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
12 version(D_InlineAsm_X86) { |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
13 asm { |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
14 lea EAX, s; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
15 mov CX, S.second[EAX]; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
16 mov x, CX; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
17 mov S.first[EAX], 640; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
18 } |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
19 } else version(D_InlineAsm_X86_64) { |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
20 asm { |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
21 lea RAX, s; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
22 mov CX, S.second[RAX]; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
23 mov x, CX; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
24 mov S.first[RAX], 640; |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
25 } |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
26 } |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
27 assert(x == 42); |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
28 assert(s.first == 640); |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
29 assert(s.second == 42); |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
30 assert(s.unaccessed == -1); |
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
diff
changeset
|
31 } |