www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Template Arguments in inline ASM

reply John Kiro <johnkirollos yahoo.com> writes:
Hell There

I made the following example to see how far can inline asm blocks use template
args:
	========================================
	void asm_template(T)(T Tval,T* pDest)
	{
		asm{
			fld Tval;
			mov EAX,pDest;




		}//asm
	}//asm_template
		
	void main()
	{
	  float f1=4.0;
	  float f2=5.0;
	
	  asm_template!(float)(f1,&f2);
	}
	========================================
Here is the compilation result of the 4 statements marked above:






float". In other words, why would it fail if T is correctly interpreted to
float?

would be more natural).
In conclusion, I see that template args are partially (and unclearly) supported
inside ASM blocks. Me, I hope to have better support for aliases & template
args in ASM blocks.
What do you think friends?

Regards,
John
Sep 07 2007
parent reply Don Clugston <dac nospam.com.au> writes:
John Kiro wrote:
 Hell There
 
 I made the following example to see how far can inline asm blocks use template
args:
 	========================================
 	void asm_template(T)(T Tval,T* pDest)
 	{
 		asm{
 			fld Tval;
 			mov EAX,pDest;




 		}//asm
 	}//asm_template
 		
 	void main()
 	{
 	  float f1=4.0;
 	  float f2=5.0;
 	
 	  asm_template!(float)(f1,&f2);
 	}
 	========================================
 Here is the compilation result of the 4 statements marked above:




 

float". In other words, why would it fail if T is correctly interpreted to
float?

would be more natural).
 In conclusion, I see that template args are partially (and unclearly)
supported inside ASM blocks. Me, I hope to have better support for aliases &
template args in ASM blocks.
 What do you think friends?
 
 Regards,
 John
is giving me a lot of grief at the moment. And in the last DMD, there's a new bad code generation bug with using tuple parameters from asm.
Sep 09 2007
parent John Kiro <johnkirollos yahoo.com> writes:
Don Clugston Wrote:

 John Kiro wrote:
 Hell There
 
 I made the following example to see how far can inline asm blocks use template
args:
 	========================================
 	void asm_template(T)(T Tval,T* pDest)
 	{
 		asm{
 			fld Tval;
 			mov EAX,pDest;




 		}//asm
 	}//asm_template
 		
 	void main()
 	{
 	  float f1=4.0;
 	  float f2=5.0;
 	
 	  asm_template!(float)(f1,&f2);
 	}
 	========================================
 Here is the compilation result of the 4 statements marked above:




 

float". In other words, why would it fail if T is correctly interpreted to
float?

would be more natural).
 In conclusion, I see that template args are partially (and unclearly)
supported inside ASM blocks. Me, I hope to have better support for aliases &
template args in ASM blocks.
 What do you think friends?
 
 Regards,
 John
is giving me a lot of grief at the moment. And in the last DMD, there's a new bad code generation bug with using tuple parameters from asm.
Thanks Don.. that would be my first bugs to report.. I'll check how to do so. Regards, John
Sep 09 2007