annotate run/a/asm_pmovmskb_01_A.d @ 1290:e3d0dea394ab

partial inline asm review
author thomask
date Wed, 27 Dec 2006 11:59:48 +0000
parents 1b6d9acddb76
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_pmovmskb_01_A;
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
6
1018
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
7
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
8 version(D_InlineAsm_X86){
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
9 version = runTest;
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
10 }else version(D_InlineAsm_X86_64){
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
11 version = runTest;
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
12 }
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
13
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
14 version(runTest){
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
15 import addon.cpuinfo;
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
16
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
17 int main(){
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
18 haveSSE2!()();
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
19
1290
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
20 ubyte Y = 0b1000_0000;
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
21 ubyte N = 0b0111_1111;
1018
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
22
1290
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
23 ubyte[] A = [Y, N, Y, Y, N, N, Y, Y, Y, N, N, N, Y, N, N, Y];
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
24 ubyte* a = A.ptr;
1018
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
25
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
26 int b;
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
27
1290
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
28 static if(size_t.sizeof == 4){
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
29 asm{
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
30 mov EAX, 0x1234_5678;
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
31 mov EAX, a;
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
32 movdqu XMM0, [EAX];
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
33 pmovmskb EAX, XMM0;
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
34 mov b, EAX;
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
35 }
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
36 }else static if(size_t.sizeof == 8){
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
37 asm{
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
38 mov EAX, 0x1234_5678;
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
39 mov RAX, a;
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
40 movdqu XMM0, [RAX];
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
41 pmovmskb EAX, XMM0;
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
42 mov b, EAX;
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
43 }
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
44 }else{
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
45 static assert(0, "unhandled pointer size");
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
46 }
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
47
1290
e3d0dea394ab partial inline asm review
thomask
parents: 1018
diff changeset
48 if(b != 0b1001_0001_1100_1101){
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
49 assert(0);
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
50 }
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
51
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
52 return 0;
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
53 }
1018
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
54 }else{
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
55 pragma(msg, "DSTRESS{XFAIL}: No inline ASM support");
1b6d9acddb76 fixed asm_pmovmskb test
thomask
parents: 973
diff changeset
56 static assert(0);
973
8c327aff56f3 extended asm tests
thomask
parents:
diff changeset
57 }