Mercurial > projects > dstress
changeset 658:f87ac47ffa36
added some un-commited asm tests
author | thomask |
---|---|
date | Thu, 08 Sep 2005 07:32:03 +0000 |
parents | 7bf512caec6a |
children | dd49326e9fb2 |
files | run/a/asm_loop_01.d run/a/asm_sar_01_A.d run/a/asm_sar_01_B.d run/a/asm_sar_01_C.d run/a/asm_shl_01_A.d run/a/asm_shl_01_B.d run/a/asm_shl_01_C.d run/a/asm_shr_01_A.d run/a/asm_shr_01_B.d run/a/asm_shr_01_C.d |
diffstat | 10 files changed, 227 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_loop_01.d Thu Sep 08 07:32:03 2005 +0000 @@ -0,0 +1,26 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.a.asm_loop_01; + +int main(){ + version(D_InlineAsm){ + int a; + + asm{ + mov EAX, 0; + mov ECX, 10; + start: inc EAX; + loop start; + mov a, EAX; + } + + assert(a == 10); + + return 0; + }else{ + pragma(msg, "no Inline asm support"); + static assert(0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_sar_01_A.d Thu Sep 08 07:32:03 2005 +0000 @@ -0,0 +1,23 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.a.asm_sar_01_A; + +int main(){ + version(D_InlineAsm){ + int a = int.min; + + asm{ + sar a, 1; + } + + assert(a < 0); + assert(a == a.min - (a.min/2)); + + return 0; + }else{ + pragma(msg, "no Inline asm support"); + static assert(0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_sar_01_B.d Thu Sep 08 07:32:03 2005 +0000 @@ -0,0 +1,23 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.a.asm_sar_01_B; + +int main(){ + version(D_InlineAsm){ + short a = short.min; + + asm{ + sar a, 1; + } + + assert(a < 0); + assert(a == a.min - (a.min/2)); + + return 0; + }else{ + pragma(msg, "no Inline asm support"); + static assert(0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_sar_01_C.d Thu Sep 08 07:32:03 2005 +0000 @@ -0,0 +1,23 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.a.asm_sar_01_C; + +int main(){ + version(D_InlineAsm){ + byte a = byte.min; + + asm{ + sar a, 1; + } + + assert(a < 0); + assert(a == a.min - (a.min/2)); + + return 0; + }else{ + pragma(msg, "no Inline asm support"); + static assert(0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_shl_01_A.d Thu Sep 08 07:32:03 2005 +0000 @@ -0,0 +1,22 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.a.asm_shl_01_A; + +int main(){ + version(D_InlineAsm){ + uint a = uint.max; + + asm{ + shl a, 1; + } + + assert(a == uint.max-1u); + + return 0; + }else{ + pragma(msg, "no Inline asm support"); + static assert(0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_shl_01_B.d Thu Sep 08 07:32:03 2005 +0000 @@ -0,0 +1,22 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.a.asm_shl_01_B; + +int main(){ + version(D_InlineAsm){ + ushort a = ushort.max; + + asm{ + shl a, 1; + } + + assert(a == ushort.max-1u); + + return 0; + }else{ + pragma(msg, "no Inline asm support"); + static assert(0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_shl_01_C.d Thu Sep 08 07:32:03 2005 +0000 @@ -0,0 +1,22 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.a.asm_shl_01_C; + +int main(){ + version(D_InlineAsm){ + ubyte a = ubyte.max; + + asm{ + shl a, 1; + } + + assert(a == ubyte.max-1u); + + return 0; + }else{ + pragma(msg, "no Inline asm support"); + static assert(0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_shr_01_A.d Thu Sep 08 07:32:03 2005 +0000 @@ -0,0 +1,22 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.a.asm_shr_01_A; + +int main(){ + version(D_InlineAsm){ + uint a = uint.max; + + asm{ + shr a, 1; + } + + assert(a == 0b0111_1111__1111_1111__1111_1111__1111_1111); + + return 0; + }else{ + pragma(msg, "no Inline asm support"); + static assert(0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_shr_01_B.d Thu Sep 08 07:32:03 2005 +0000 @@ -0,0 +1,22 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.a.asm_shr_01_B; + +int main(){ + version(D_InlineAsm){ + ushort a = ushort.max; + + asm{ + shr a, 1; + } + + assert(a == 0b0111_1111__1111_1111); + + return 0; + }else{ + pragma(msg, "no Inline asm support"); + static assert(0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_shr_01_C.d Thu Sep 08 07:32:03 2005 +0000 @@ -0,0 +1,22 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +module dstress.run.a.asm_shr_01_C; + +int main(){ + version(D_InlineAsm){ + ubyte a = ubyte.max; + + asm{ + shr a, 1; + } + + assert(a == 0b0111_1111); + + return 0; + }else{ + pragma(msg, "no Inline asm support"); + static assert(0); + } +} \ No newline at end of file