search for: getvalueapf

Displaying 20 results from an estimated 23 matches for "getvalueapf".

2012 May 17
0
[LLVMdev] [PATCH] OpenCL half support
...patch.) Done. > The patch removes half case from the code for single and double. > So you should remove the "bool isHalf" variable in that spot. (line > 720) I'm not sure I get it. This variable is still needed couple of lines below: bool isHalf = &CFP->getValueAPF().getSemantics()==&APFloat::IEEEhalf; bool isDouble = &CFP->getValueAPF().getSemantics()==&APFloat::IEEEdouble; bool isInf = CFP->getValueAPF().isInfinity(); bool isNaN = CFP->getValueAPF().isNaN(); if (!isHalf && !isInf && !isNaN) { &gt...
2012 May 17
3
[LLVMdev] [PATCH] OpenCL half support
...moves half case from the code for single and double. > > So you should remove the "bool isHalf" variable in that spot. (line > > 720) > I'm not sure I get it. This variable is still needed couple of lines > below: > > bool isHalf = &CFP- > >getValueAPF().getSemantics()==&APFloat::IEEEhalf; > bool isDouble = > &CFP->getValueAPF().getSemantics()==&APFloat::IEEEdouble; > bool isInf = CFP->getValueAPF().isInfinity(); > bool isNaN = CFP->getValueAPF().isNaN(); > if (!isHalf && !isInf...
2012 May 11
2
[LLVMdev] [PATCH] OpenCL half support
I've got comments on the code change. The test cases look ok, but I haven't fully checked the math on the half-values. I checked with reference to trunk top-of-tree at revision 156617. I have not compiled the code. lib/AsmParser/LLLexer.cpp Adds support to parse format: 0xH<hexdigits> Tha 0xH format should be described in LangRef.html alongside 0xK<hex> and
2012 May 17
0
[LLVMdev] [PATCH] OpenCL half support
...le. > > > So you should remove the "bool isHalf" variable in that spot. > > > (line > > > 720) > > I'm not sure I get it. This variable is still needed couple of lines > > below: > > > > bool isHalf = &CFP- > > >getValueAPF().getSemantics()==&APFloat::IEEEhalf; > > bool isDouble = > > &CFP->getValueAPF().getSemantics()==&APFloat::IEEEdouble; > > bool isInf = CFP->getValueAPF().isInfinity(); > > bool isNaN = CFP->getValueAPF().isNaN(); > > if (!...
2014 May 05
3
[LLVMdev] get unsigned integer pattern for ConstantFP
What is the proper way to get the bit pattern associated with a ConstantFP? The 32 bit pattern if MVT::f32 or pair of 32 bit patterns with MVT::f64 ? Tia. Reed
2019 Sep 26
2
ConstantFP->getType() is not right
...s my code: auto* constFloat1 = static_cast<llvm::ConstantFP*>(llvm::ConstantFP::get(llvm::Type::getFloatTy(context), 3.1)); assert(constFloat1->getType() == llvm::Type::getFloatTy(context)); auto* constFloat2 = llvm::ConstantFP::get(llvm::Type::getDoubleTy(context), constFloat1->getValueAPF()); assert(constFloat2->getType() == llvm::Type::getDoubleTy(context)); but the second assert failed, the type of constFloat2 is still float, not double, why? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachme...
2015 Jan 14
2
[LLVMdev] Bug in InsertElement constant propagation?
...(ConstantFP *CFP = dyn_cast<ConstantFP>(C)) { if (CFP->getType()->isFloatTy()) { SmallVector<float, 16> Elts; for (unsigned i = 0, e = V.size(); i != e; ++i) if (ConstantFP *CFP = dyn_cast<ConstantFP>(V[i])) Elts.push_back(CFP->getValueAPF().convertToFloat()); else break; if (Elts.size() == V.size()) return ConstantDataArray::get(C->getContext(), Elts); } Anyone knows what is the problem here? Cheers, Thomas -------------- next part -------------- An HTML attachment was scrubbed......
2012 Feb 10
1
[LLVMdev] Prevent DAG combiner from changing "store ConstFP, addr" to integer store
.... case MVT::f128: case MVT::ppcf128: break; case MVT::f32: if ((isTypeLegal(MVT::i32) && !LegalOperations && !ST->isVolatile()) || TLI.isOperationLegalOrCustom(ISD::STORE, MVT::i32)) { Tmp = DAG.getConstant((uint32_t)CFP->getValueAPF(). bitcastToAPInt().getZExtValue(), MVT::i32); return DAG.getStore(Chain, N->getDebugLoc(), Tmp, Ptr, ST->getPointerInfo(), ST->isVolatile(), ST->isNonTemporal(), ST->getAlignment());...
2010 Apr 20
0
[LLVMdev] Fwd: Re: NaNs and Infinities
...float to an integer. If bits 0-22 are 0 and bits 23-30 are 1 it's infinity; if bits 0-22 are not 0 and bits 23-30 are 1 it's NaN. Others can probably give you a answer and if not at least you have mine. ConstantFM *CFP = dyn_cast<ConstantFP>(myValue); if (CFP != NULL) { CFP->getValueAPF().isNaN(); CFP->getValueAPF().isInfinity(); } else { // Bitcast to an integer at test bits } Thanks, Javier On 4/19/2010 3:19 AM, lost wrote: > Hello! > > How can I test if floating-point value is NaN or positive/negative infinity? > __________________________________________...
2012 Apr 16
2
[LLVMdev] Representing -ffast-math at the IR level
...t as documenting and will catch any goofs. + // If it's not a floating point number then it must be 'fast'. + return !isa<ConstantFP>(MD->getOperand(0)); Here as well. + if (ConstantFP *CFP0 = dyn_cast_or_null<ConstantFP>(Op0)) { + APFloat Accuracy = CFP0->getValueAPF(); + Assert1(Accuracy.isNormal() && !Accuracy.isNegative(), + "fpmath accuracy not a positive number!", &I); To be pedantic for a moment, zero is not a positive number. What about asserting these individually to give us more clear asserts if they fire? That...
2014 Sep 19
2
[LLVMdev] More careful treatment of floating point exceptions
Hi Sanjay, Thanks, I saw this flag and it's definitely should be considered, but it appeared to me to be static characteristic of target platform. I'm not sure how appropriate it would be to change its value from a front-end. It says "Has", while optional flag would rather say "Uses" meaning that implementation cares about floating point exceptions. Regards, Sergey
2014 Sep 25
2
[LLVMdev] More careful treatment of floating point exceptions
...g.cpp index ca6b614..48e038f 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -3240,6 +3240,18 @@ static bool isFloatingPointZero(SDValue Op) { if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CP->getConstVal())) return CFP->getValueAPF().isPosZero(); } + } else if (Op->getOpcode() == ISD::BITCAST && + Op->getValueType(0) == MVT::f64) { + // Handle (ISD::BITCAST (ARMISD::VMOVIMM (ISD::TargetConstant 0)) MVT::f64) + // created by LowerConstantFP(). + SDValue BitcastOp = Op->getOperand(0);...
2012 Apr 16
0
[LLVMdev] Representing -ffast-math at the IR level
...one. > > + // If it's not a floating point number then it must be 'fast'. > + return !isa<ConstantFP>(MD->getOperand(0)); > > Here as well. > > + if (ConstantFP *CFP0 = dyn_cast_or_null<ConstantFP>(Op0)) { > + APFloat Accuracy = CFP0->getValueAPF(); > + Assert1(Accuracy.isNormal() && !Accuracy.isNegative(), > + "fpmath accuracy not a positive number!", &I); > > To be pedantic for a moment, zero is not a positive number. Zero is not allowed. The isNormal call will return false for zero. What about...
2015 Jan 14
2
[LLVMdev] Bug in InsertElement constant propagation?
...t; > if (CFP->getType()->isFloatTy()) { > > SmallVector<float, 16> Elts; > > for (unsigned i = 0, e = V.size(); i != e; ++i) > > if (ConstantFP *CFP = dyn_cast<ConstantFP>(V[i])) > > Elts.push_back(CFP->getValueAPF().convertToFloat()); > > else > > break; > > if (Elts.size() == V.size()) > > return ConstantDataArray::get(C->getContext(), Elts); > > } > > Anyone knows what is the problem here? Both bit patterns are repres...
2012 Apr 16
0
[LLVMdev] Representing -ffast-math at the IR level
Here's a revised patch, plus patches showing how fpmath metadata could be turned on in clang and dragonegg (it seemed safest for the moment to condition on -ffast-math rather than on one of the flags implied by -ffast-math). Major changes: - The FPMathOperator class can no longer be used to change math settings, only to read them. Currently it can be queried for accuracy info. I split the
2010 Oct 25
1
[LLVMdev] sprintf -> snprintf conversion
...VE_PRINTF_A && ENABLE_CBE_PRINTF_A // Print out the constant as a floating point number. char Buffer[100]; - sprintf(Buffer, "%a", V); + snprintf(Buffer, sizeof(Buffer), "%a", V); Num = Buffer; #else Num = ftostr(FPC->getValueAPF()); @@ -1343,7 +1343,7 @@ if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '_')) { char buffer[5]; - sprintf(buffer, "_%x...
2014 Jun 08
2
[LLVMdev] [llvm] r210424 - Revert "Do materialize for floating point"
...false; > + EmitInstStore(Mips::SW, SrcReg, Addr.Base.Reg, Addr.Offset); > return true; > } > > @@ -234,22 +229,6 @@ bool MipsFastISel::TargetSelectInstructi > } > > unsigned MipsFastISel::MaterializeFP(const ConstantFP *CFP, MVT VT) { > - int64_t Imm = CFP->getValueAPF().bitcastToAPInt().getZExtValue(); > - if (VT == MVT::f32) { > - const TargetRegisterClass *RC = &Mips::FGR32RegClass; > - unsigned DestReg = createResultReg(RC); > - unsigned TempReg = Materialize32BitInt(Imm, &Mips::GPR32RegClass); > - EmitInst(Mips::MTC1, Dest...
2015 Jan 20
2
[LLVMdev] Bug in InsertElement constant propagation?
Does anybody else have an opinion on this issue? I'm planning to submit a patch which would add a new get method for ConstantDataVector taking an ArrayRef<Constant*> and use that in the few places in constant propagation where convertToFloat is used. Let me know if you think there is a more obvious way to do it. Right now the only way to create a ConstantDataVector are those method:
2012 Apr 14
9
[LLVMdev] Representing -ffast-math at the IR level
The attached patch is a first attempt at representing "-ffast-math" at the IR level, in fact on individual floating point instructions (fadd, fsub etc). It is done using metadata. We already have a "fpmath" metadata type which can be used to signal that reduced precision is OK for a floating point operation, eg %z = fmul float %x, %y, !fpmath !0 ... !0 = metadata
2012 Jul 16
3
[LLVMdev] RFC: LLVM incubation, or requirements for committing new backends
...n_cast<ConstantSDNode>(Op)) { > + return C->isAllOnesValue(); > + } > + return false; > +} > + > +bool AMDGPUTargetLowering::isHWFalseValue(SDValue Op) const > +{ > + if (ConstantFPSDNode * CFP = dyn_cast<ConstantFPSDNode>(Op)) { > + return CFP->getValueAPF().isZero(); > + } > + if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) { > + return C->isNullValue(); > + } > + return false; > +} > + > +void AMDGPUTargetLowering::addLiveIn(MachineInstr * MI, > + MachineFunction * MF, MachineRegisterInfo & MR...