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

Displaying 20 results from an estimated 4000 matches similar to: "[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?"

2012 Jan 19
0
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
On Jan 18, 2012, at 3:50 PM, Joe Groff wrote: > Hi everyone. On i386--win32 targets, LLVM tries to use the MSVCRT > routine _ftol2 for floating-point to unsigned conversions, but this > function has a nonstandard calling convention LLVM doesn't understand. > It takes its input operand on the x87 stack as ST0, which it pops off > of the stack before returning. The return value
2012 Jan 19
2
[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) nounwind Thanks Jakob, the ~{st} constraint does the trick. It wasn't clear to me that "clobbers" means "pops" for x87 registers. -Joe
2012 Jan 19
2
[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
2012 Jan 19
0
[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) 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
2012 Jan 19
0
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
2012/1/19 Jakob Stoklund Olesen <stoklund at 2pi.dk>: > How many of these libcalls do you need to implement? What exactly is the calling convention? Which registers are clobbered etc. There is only one (that I know about so far). The MSVCRT `_ftol2` function implements floating-point-to-unsigned conversion for i386 targets, and LLVM 3.0 calls it with the cdecl calling convention for
2012 Jan 19
2
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
On Jan 19, 2012, at 10:12 AM, Joe Groff wrote: > 2012/1/19 Jakob Stoklund Olesen <stoklund at 2pi.dk>: >> How many of these libcalls do you need to implement? What exactly is the calling convention? Which registers are clobbered etc. > > There is only one (that I know about so far). The MSVCRT `_ftol2` > function implements floating-point-to-unsigned conversion for i386
2012 Jan 25
2
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
On Jan 24, 2012, at 2:30 PM, Joe Groff wrote: > On Fri, Jan 20, 2012 at 2:10 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote: >> X86FloatingPoint.cpp with comments is all you get. > > Thanks for your help, Jakob. Attached is a first-pass attempt at a > patch. I don't want to post to -commits yet because I have no idea if > this is fully correct, but it seems
2012 Jan 20
2
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
On Jan 20, 2012, at 1:58 PM, Joe Groff wrote: > The integer runtime functions (_allmul, _alldiv, etc. for 64-bit > integer arithmetic) all appear to be straight-up stdcall. _ftol2 is > the only weird one. (There is an _ftol routine with the same calling > convention as _ftol2, but AFAIK it's only for backward compatibility > with older MSVC runtimes.) I'm far from an MSVC
2012 Jan 20
0
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
On Thu, Jan 19, 2012 at 10:39 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote: > Alright.  We definitely don't want to model it as a general call, then.  Normal calls clobber lots of registers. > > The options are: > > 1. Use a pseudo-instruction that X86FloatingPoint understands and turns into a call after arranging for the argument to be in ST0. >   You should
2012 Jan 25
0
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
On Tue, Jan 24, 2012 at 4:32 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote: > Yes, your definition of the new instruction looks sane. > > However, you shouldn't expand the instruction right away in EmitInstrWithCustomInserter(), and leaving the pseudo and call instructions side by side is not going to work. > > Just leave the pseudo-instruction alone until it hits
2012 Jan 24
0
[LLVMdev] Best way to interface with MSVC _ftol2 runtime function for fptoui?
On Fri, Jan 20, 2012 at 2:10 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote: > X86FloatingPoint.cpp with comments is all you get. Thanks for your help, Jakob. Attached is a first-pass attempt at a patch. I don't want to post to -commits yet because I have no idea if this is fully correct, but it seems to work in simple test cases. Am I on the right track? Could this patch ever
2013 Feb 13
1
[LLVMdev] Using MSVC _ftol2 runtime function for fptoui on Win32
Hi Joe & Michael, In rev. 151382 you have changed the fptoui implementation of the x86 codegen for win32. Before the change fptoui was lowered to flds 16(%esp) fisttpll 8(%esp) movl 8(%esp), %eax After the change fptoui is lowered to flds 40(%esp) calll _ftol2 Please note that the assumption that _ftol2 doesn't modify ECX isn't true on sandybridge platform.
2009 Aug 03
2
[LLVMdev] inline asm question
Eli Friedman wrote: > 2009/8/2 Richard Pennington <rich at pennware.com>: >> The following fails on x86_64 because of the output constraint '0'. >> My question is, is this legal. LLVM complains about the size difference >> (32 vs 64), but it is the same register (ax). >> Works on x86. >> >> %42 = call i64 asm sideeffect
2009 Jul 31
2
[LLVMdev] Inserting Instructions (pass)
Hi, I' am trying to insert an InlineAsm Instruction in my pass, which FunctionType do I need for Inlineasm? If I understand it right, I need a call instruction to insert the new produced InlineAsm? Thanks for help, Michael for (BasicBlock::iterator bi = i->begin(), be = i->end(); bi != be; ++bi){ std::vector<const Type*> asm_arguments;
2009 Aug 03
2
[LLVMdev] inline asm question
The following fails on x86_64 because of the output constraint '0'. My question is, is this legal. LLVM complains about the size difference (32 vs 64), but it is the same register (ax). Works on x86. %42 = call i64 asm sideeffect "syscall\0A\09", "={ax},0,{di},~{dirflag},~{fpsr},~{flags}"(i64 231, i64 %41) nounwind ; <i64> [#uses=2] -Rich
2009 Jul 31
0
[LLVMdev] Inserting Instructions (pass)
On Jul 31, 2009, at 10:24 AM, Michael Graumann wrote: > Hi, > I’ am trying to insert an InlineAsm Instruction in my pass, which > FunctionType do I need for Inlineasm? > If I understand it right, I need a call instruction to insert the > new produced InlineAsm? > > Thanks for help Inline asm works like a "callee". So for: call void asm sideeffect
2009 Aug 03
0
[LLVMdev] inline asm question
2009/8/2 Richard Pennington <rich at pennware.com>: > Eli Friedman wrote: >> 2009/8/2 Richard Pennington <rich at pennware.com>: >>> The following fails on x86_64 because of the output constraint '0'. >>> My question is, is this legal. LLVM complains about the size difference >>> (32 vs 64), but it is the same register (ax). >>>
2019 Dec 09
4
IR inline assembly: the x86 Intel "offset" operator
Hi all, I'm trying to land (a rebased version of) http://llvm.org/D37461 - which should make it possible to handle x86 Intel assembly like mov eax, offset Foo::ptr + 1 (Currently, omitting the +1 works... but offset doesn't work in compound expressions.) I'm having trouble figuring out what inline assembly I can emit into the LLVM IR that will work properly. So far, the closest
2020 Jan 07
2
Inline assembly in intel syntax mishandling i constraint
Hi all, I'm getting rather odd behavior from a call asm inteldialect(). TL;DR is "mov reg, $0" with a "i" constraint on $0 is behaving identical to "mov reg, dword ptr [$0]" and differently from "movl $0, reg" in AT&T syntax. I'm not sure how to get clang to emit an inteldialect, so for this example, I'm emitting llvm and then modifying
2009 Aug 03
0
[LLVMdev] inline asm question
2009/8/2 Richard Pennington <rich at pennware.com>: > The following fails on x86_64 because of the output constraint '0'. > My question is, is this legal. LLVM complains about the size difference > (32 vs 64), but it is the same register (ax). > Works on x86. > > %42 = call i64 asm sideeffect "syscall\0A\09", >