annotate run/a/asm_pextrw_01_A.d @ 1285:229e630d4b1a

partuial inline asm review
author thomask
date Tue, 26 Dec 2006 14:21:37 +0000
parents 6e5d377573e1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
1 // $HeadURL$
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
2 // $Date$
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
3 // $Author$
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
4
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
5 module dstress.run.a.asm_pextrw_01_A;
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
6
1017
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
7 version(D_InlineAsm_X86){
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
8 version = runTest;
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
9 }else version(D_InlineAsm_X86_64){
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
10 version = runTest;
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
11 }
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
12
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
13 version(runTest){
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
14 import addon.cpuinfo;
1044
03c97933de98 inline ASM review
thomask
parents: 1017
diff changeset
15
1017
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
16 int main(){
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
17 haveSSE!()();
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
18
1285
229e630d4b1a partuial inline asm review
thomask
parents: 1182
diff changeset
19 ushort[] X = [cast(ushort)1, 2, 3, 4, 5, 0xFFFF, 7, 0];
229e630d4b1a partuial inline asm review
thomask
parents: 1182
diff changeset
20 ushort* x = X.ptr;
229e630d4b1a partuial inline asm review
thomask
parents: 1182
diff changeset
21
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
22 uint a;
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
23 uint b;
1044
03c97933de98 inline ASM review
thomask
parents: 1017
diff changeset
24
1182
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
25 static if(size_t.sizeof == 4){
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
26 asm{
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
27 mov EAX, x;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
28 movdqu XMM0, [EAX];
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
29 pextrw EAX, XMM0, 5;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
30 mov a, EAX;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
31 pextrw EDX, XMM0, 1;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
32 mov b, EDX;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
33 }
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
34 }else static if(size_t.sizeof == 8){
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
35 asm{
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
36 mov RAX, x;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
37 movdqu XMM0, [RAX];
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
38 pextrw EAX, XMM0, 5;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
39 mov a, EAX;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
40 pextrw EDX, XMM0, 1;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
41 mov b, EDX;
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
42 }
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
43 }else{
6e5d377573e1 fixed 64bit inline asm issues
thomask
parents: 1164
diff changeset
44 static assert(0, "unhandled pointer size");
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
45 }
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
46
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
47 if(a != 0xFFFF){
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
48 assert(0);
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
49 }
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
50 if(b != 2){
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
51 assert(0);
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
52 }
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
53
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
54 return 0;
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
55 }
1017
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
56 }else{
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
57 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
26f680ab52cd inline ASM review
thomask
parents: 973
diff changeset
58 static assert(0);
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
59 }