annotate run/a/asm_movhlps_01_A.d @ 1329:1c8652b3795a

inline asm review
author thomask
date Fri, 12 Jan 2007 23:07:17 +0000
parents 81222734adf3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
1 // $HeadURL$
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
2 // $Date$
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
3 // $Author$
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
4
979
ee58e47a69b7 <thomas-dloop@kuehne.cn>
thomask
parents: 978
diff changeset
5 // @author@ <thomas-dloop@kuehne.cn>
ee58e47a69b7 <thomas-dloop@kuehne.cn>
thomask
parents: 978
diff changeset
6 // @date@ 2006-04-28
1319
81222734adf3 sed'ed replacement of new:...http.d.puremagic.co... with http://d.puremagic.com/issues/show_bug.cgi?...
thomask
parents: 1085
diff changeset
7 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=118
979
ee58e47a69b7 <thomas-dloop@kuehne.cn>
thomask
parents: 978
diff changeset
8
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
9 module dstress.run.a.asm_movhlps_01_A;
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
10
1002
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
11 version(D_InlineAsm_X86){
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
12 version = runTest;
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
13 }else version(D_InlineAsm_X86_64){
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
14 version = runTest;
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
15 }
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
16
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
17 version(runTest){
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
18 import addon.cpuinfo;
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
19
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
20 int main(){
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
21 haveSSE!()();
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
22
1329
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
23 float* a = (new float[4]).ptr;
1084
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
24 a[0] = 3.0f;
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
25 a[1] = 4.0f;
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
26 a[2] = 5.0f;
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
27 a[3] = 6.0f;
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
28
1329
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
29 float* b = (new float[4]).ptr;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
30 b[0] = 10.0f;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
31 b[1] = 20.0f;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
32 b[2] = 30.0f;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
33 b[3] = 40.0f;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
34
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
35 float* c = (new float[4]).ptr;
1084
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
36
1329
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
37 static if(size_t.sizeof == 4){
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
38 asm{
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
39 mov EAX, a;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
40 movups XMM0, [EAX];
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
41 mov EAX, b;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
42 movups XMM1, [EAX];
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
43 movlhps XMM0, XMM1;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
44 mov EAX, c;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
45 movups [EAX], XMM0;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
46 }
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
47 }else static if(size_t.sizeof == 8){
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
48 asm{
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
49 mov RAX, a;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
50 movups XMM0, [RAX];
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
51 mov RAX, b;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
52 movups XMM1, [RAX];
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
53 movlhps XMM0, XMM1;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
54 mov RAX, c;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
55 movups [RAX], XMM0;
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
56 }
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
57 }else{
1c8652b3795a inline asm review
thomask
parents: 1319
diff changeset
58 static assert(0, "unhandled pointer size");
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
59 }
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
60
1084
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
61 if(c[0] != a[0]){
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
62 assert(0);
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
63 }
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
64
1084
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
65 if(c[1] != a[1]){
979
ee58e47a69b7 <thomas-dloop@kuehne.cn>
thomask
parents: 978
diff changeset
66 assert(0);
ee58e47a69b7 <thomas-dloop@kuehne.cn>
thomask
parents: 978
diff changeset
67 }
1044
03c97933de98 inline ASM review
thomask
parents: 1002
diff changeset
68
1084
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
69 if(c[2] != b[0]){
979
ee58e47a69b7 <thomas-dloop@kuehne.cn>
thomask
parents: 978
diff changeset
70 assert(0);
ee58e47a69b7 <thomas-dloop@kuehne.cn>
thomask
parents: 978
diff changeset
71 }
ee58e47a69b7 <thomas-dloop@kuehne.cn>
thomask
parents: 978
diff changeset
72
1084
91ff3e405be5 -fPIC fixes
thomask
parents: 1044
diff changeset
73 if(c[3] != b[1]){
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
74 assert(0);
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
75 }
1044
03c97933de98 inline ASM review
thomask
parents: 1002
diff changeset
76
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
77 return 0;
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
78 }
1002
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
79 }else{
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
80 pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
a7310ceac844 inline ASM review
thomask
parents: 979
diff changeset
81 static assert(0);
978
4c5ccd0d4947 extended SSE asm tests
thomask
parents:
diff changeset
82 }