similar to: [LLVMdev] x86 rounding mode question

Displaying 20 results from an estimated 1100 matches similar to: "[LLVMdev] x86 rounding mode question"

2012 Feb 15
2
[LLVMdev] ASM appears to be incorrect from llc
Hi, I'm trying to compile an intermediate representation file to ASM (intel style), and I believe that the resultant ASM is invalid. The IR is: ; ModuleID = 'test.u' %vec2 = type { float, float } @t = global %vec2 zeroinitializer @x = global i32 0 define i32 @main__i__v() nounwind { locals: %0 = load float* getelementptr inbounds (%vec2* @t, i32 0, i32 0) %1 = fptosi float %0
2012 Feb 16
0
[LLVMdev] ASM appears to be incorrect from llc
On Wed, Feb 15, 2012 at 3:36 PM, Matthew Huck <matthew.huck at gmail.com> wrote: > Hi, >   I'm trying to compile an intermediate representation file to ASM (intel > style), and I believe that the resultant ASM is invalid. The IR is: > > ; ModuleID = 'test.u' > > %vec2 = type { float, float } > @t = global %vec2 zeroinitializer > @x = global i32 0 >
2011 Sep 22
2
[LLVMdev] Need help in converting int to double
On Thu, Sep 22, 2011 at 3:46 PM, sarath chandra <sarathcse19 at gmail.com>wrote: > Hi James, > > First i converted the void * to int* and then did FPToSI...then did SHL...( > because CreateShl only accepts integers... i pointer casted it to int64 type > first)... Below is the code snippet.... > > > lhs = mBuilder.CreateStructGEP(firstArg, 0); > lhs =
2011 Sep 22
0
[LLVMdev] Need help in converting int to double
Hi Sarath, It would have really helped if you had removed the commented out code and inlined the calls to your homemade helper functions before sending it... You are doing this, in LLVM IR: %0 = getelementptr %Value* %firstArg, i32 0 ; i8** %1 = load i8** %0 ; i8* %2 = bitcast i8* %1 to i64* %3 = getelementptr %Value* %secondArg, i32 0 ; i8** %4 = load i8** %3; i8* %5 = bitcast i8* %4 to i64*
2011 Sep 22
1
[LLVMdev] Need help in converting int to double
Yeah, that's the fault...got the answer...... Thanks James for the help... Struggling with this for so many days....... On Thu, Sep 22, 2011 at 4:02 PM, James Molloy <James.Molloy at arm.com> wrote: > Hi Sarath,**** > > ** ** > > It would have really helped if you had removed the commented out code and > inlined the calls to your homemade helper functions before
2011 Sep 22
3
[LLVMdev] Need help in converting int to double
Hi, I'm pursuing M.Tech course. As a part of the project work i'm using LLVM as back-end. My project area is "Enhancing the performance of V8 javascript engine using LLVM as a back-end". Now i'm writing code for shift left(SHL) operator. I had my own Value Structure .. it's like this Struct Value { void *val ; char type; } The "char type" holds
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
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.
2011 Sep 22
0
[LLVMdev] FW: Need help in converting int to double
Re-cc'ing list. Please direct all responses to the mailing list, so others can see it! Cheers, James -----Original Message----- From: James Molloy Sent: 22 September 2011 11:11 To: 'sarath chandra' Subject: RE: [LLVMdev] Need help in converting int to double Hi Sarath, Your example will break. If the values are held internally as doubles casted to void* (which incidentally will
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 Feb 16
3
[LLVMdev] ASM appears to be incorrect from llc
Hi, It doesn't compile with yasm, or nasm (reports invalid combination of opcode and operands), and mov _x,EAX is meaningless as _x is just a label (an numeric constant that happens to be an address), so it would have to be dereferenced to get to the memory at that address, otherwise it's like saying mov 0x12341234, EAX Now, my asm skills are not that great, so I'm prepared to be
2018 Nov 05
3
Safe fptoui/fptosi casts
Hi everyone! The fptoui/fptosi instructions are currently specified to return a poison value if the rounded-towards-zero floating point number cannot be represented by the target integer type. The motivation for this behavior is that overflowing float to int casts in C are undefined behavior. However, many newer languages prefer to have a float to integer cast that is well-defined for all input
2020 Sep 04
4
Misleading documentation on FP to integer conversion instructions?
If fptosi takes 0.9 -> 0, then that is not 'rounding' in any sense I'm aware of (IEEE754 or otherwise). Rounding (in the IEE754 sense) determines how a number is converted when it is halfway between two candidate results. (see round(), ceil(), floor()). fptosi seems to model the behavior of a C cast from float to int, which truncates the fractional bits (as in trunc()). Steve
2020 Sep 04
2
Misleading documentation on FP to integer conversion instructions?
The LLVM IR reference manual states, for fptosi: "The ‘fptosi’ instruction converts its floating-point <http://llvm.org/docs/LangRef.html#t-floating> operand into the nearest (rounding towards zero) signed integer value." I interpreted this to mean that it rounds: The nearest integer to 0.3 is 0. The nearest integer to 0.9 is 1. The nearest integer to 0.5 is either 0 or 1. And
2016 Jan 22
2
fptosi undefined behaviour
Hi all, Consider the following snippet, the aim of which is to convert a double to a signed i16, returning 0 if not exactly representable: define i16 @foo(double) { top: %1 = fptosi double %0 to i16 %2 = sitofp i16 %1 to double %3 = fcmp une double %2, %0 %4 = select i1 %3, i16 0, i16 %1 ret i16 %4 } Of course, if the value is out-of-range, the result of fptosi is undefined.
2018 Nov 05
5
Safe fptoui/fptosi casts
I would be interested in learning what the set of used semantics for float-to-int conversion is. If the only two used are 1) undefined behavior if unrepresentable and 2) saturate to int_{min,max} with NaN going to zero, then I think it makes sense to expose both of those natively in the IR. If the set is much larger, I think separate intrinsics for each behavior would make sense. It would be nice
2012 Jan 06
2
[LLVMdev] How to duplicate a CallInst
Hi, I have the following piece of code: %34 = fptosi float %33 to i32 %35 = call i32 @function(i32 %34) nounwind I would like of know how can I duplicate the statement %35 ? , as follows: %34 = fptosi float %33 to i32 %35 = call i32 @function(i32 %34) nounwind *%36 = **call i32 @function(i32 %34) nounwind* * * i.e, two instructions exactly equal. Using clone, results in badref. Moreover, how
2009 Feb 11
2
[LLVMdev] Eliminate PHI for non-copyable registers
In my hardware there are two special registers cannot be copied but can only be assigned and referenced (read) in the other instruction. They are allocatable also. br i1 %if_cond, label %then, label %else then: %x1 = fptosi float %y1 to i32 br label %endif else: %x2 = fptosi float %y2 to i32 br label %endif endif: %x3 = phi i32 [%x1, %then], [%x2, %else] PNE::LowerAtomiPHINode() fails
2008 Jun 03
2
[LLVMdev] Truncate float to int?
Newbie question here: what's the best way to truncate a float to a signed int? The fptosi instruction rounds, and the fptrunc instruction simply truncates from a large float type to a smaller float type. Mark
2008 Jun 03
0
[LLVMdev] Truncate float to int?
On Tue, Jun 3, 2008 at 11:32 AM, Mark Leone <markleone at gmail.com> wrote: > Newbie question here: what's the best way to truncate a float to a > signed int? The fptosi instruction rounds, and the fptrunc > instruction simply truncates from a large float type to a smaller > float type. fptosi is equivalent to a C cast from float to int. -Eli