view run/a/asm_pextrw_01_A.d @ 1017:26f680ab52cd

inline ASM review
author thomask
date Mon, 22 May 2006 20:15:24 +0000
parents 8c327aff56f3
children 03c97933de98
line wrap: on
line source

// $HeadURL$
// $Date$
// $Author$

module dstress.run.a.asm_pextrw_01_A;

version(D_InlineAsm_X86){
	version = runTest;
}else version(D_InlineAsm_X86_64){
	version = runTest;
}

version(runTest){
	import addon.cpuinfo;
	
	int main(){
		haveSSE!()();

		static ushort[8] x = [1, 2, 3, 4, 5, 0xFFFF, 7, 0];
		uint a;
		uint b;
		
		asm{
			movdqu XMM0, x;
			pextrw EAX, XMM0, 5;
			mov a, EAX;
			pextrw EDX, XMM0, 1;
			mov b, EDX;
		}

		if(a != 0xFFFF){
			assert(0);
		}
		if(b != 2){
			assert(0);
		}

		return 0;
	}
}else{
	pragma(msg, "DSTRESS{XFAIL}: no inline ASM support");
	static assert(0);
}