view run/a/asm_mov_04_A.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents e44202fdb50b
children
line wrap: on
line source

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

// @author@	Thomas Kühne <thomas-dloop@kuehne.cn>
// @date@	2007-01-09
// @uri@	http://d.puremagic.com/issues/show_bug.cgi?id=824
// @desc@	[Issue 824] "mov EAX, func;" and "lea EAX, func;" generate incorrect code

module dstress.run.a.asm_mov_04_A;

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

version(runTest){
	void func(){
	}

	int main(){
		void* a = &func;
		uint* b = cast(uint*) a;
		uint f = *b;
		uint g;

		asm{
			mov EAX, func;
			mov g, EAX;
		}

		if(f != g){
			assert(0);
		}

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