[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Jan 19 09:32:55 PST 2012


On Jan 18, 2012, at 8:56 PM, Joe Groff wrote:

> 2012/1/18 Jakob Stoklund Olesen <stoklund at 2pi.dk>:
>> This should work:
>> %1 = call i64 asm "call __ftol2", "=A,{st},~{dirflag},~{fpsr},~{flags},~{st}" (double %x) nounwind
> 
> Forgive me for being slow, but what would be the best way to implement
> the equivalent of that inline asm as a custom lowering for an
> instruction? Can I just create a CallInst and tell it to lower that
> instead, or do I need to replicate the functionality manually as DAG
> nodes?

On second thought, it might not be the best approach to prodice inline asm during lowering.

How many of these libcalls do you need to implement? What exactly is the calling convention? Which registers are clobbered etc.

/jakob




More information about the llvm-dev mailing list