Joe Groff
2012-Jan-19 02:37 UTC
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
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) nounwindThanks Jakob, the ~{st} constraint does the trick. It wasn't clear to me that "clobbers" means "pops" for x87 registers. -Joe
Joe Groff
2012-Jan-19 04:56 UTC
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
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) nounwindForgive 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? -Joe
Jakob Stoklund Olesen
2012-Jan-19 17:32 UTC
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
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
Apparently Analagous Threads
- [LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
- [LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
- [LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
- [LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
- [LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?