Mercurial > projects > dstress
view run/a/asm_pfrcp_01_A.d @ 1611:9f94be6a5ace
Fix typo in last commit.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 10 May 2009 10:56:43 +0200 |
parents | 61d7e32e70a8 |
children |
line wrap: on
line source
// $HeadURL$ // $Date$ // $Author$ module dstress.run.a.asm_pfrcp_01_A; version(D_InlineAsm_X86){ version = runTest; }else version(D_InlineAsm_X86_64){ version = runTest; } version(runTest){ import addon.cpuinfo; int main(){ haveMMX!()(); float[] A = [2.0f, 3.3f]; float* a = A.ptr; float* c = (new float[2]).ptr; static if(size_t.sizeof == 4){ asm{ mov EAX, a; pfrcp MM0, [EAX]; mov EAX, c; movq [EAX], MM0; emms; } }else static if(size_t.sizeof == 8){ asm{ mov RAX, a; pfrcp MM0, [RAX]; mov RAX, c; movq [RAX], MM0; emms; } }else{ static assert(0, "unhandled pointer size"); } c[0] -= 0.5f; if(c[0] < 0.0f){ c[0] = -c[0]; } if(c[0] > float.epsilon * (1 << 11)){ assert(0); } c[1] -= 0.5f; if(c[1] < 0.0f){ c[1] = -c[1]; } if(c[1] > float.epsilon * (1 << 11)){ assert(0); } return 0; } }else{ pragma(msg, "DSTRESS{XFAIL}: no inline ASM support"); static assert(0); }