search for: addfpmathtag

Displaying 5 results from an estimated 5 matches for "addfpmathtag".

2012 Apr 16
3
[LLVMdev] Representing -ffast-math at the IR level
Hi Duncan, I like the changes to IRBuilder and how the operator can't change it. Looks a lot safer (mistake-wise) and more convenient. This function won't to remove a previously set tag, which could be used by optimisations or inlining. + Instruction *AddFPMathTag(Instruction *I, MDNode *FPMathTag) const { + if (!FPMathTag) + FPMathTag = DefaultFPMathTag; + if (FPMathTag) + I->setMetadata(LLVMContext::MD_fpmath, FPMathTag); + return I; + } If you want to keep it as only Add, then make FPMathTag = 0 so that you can easily add the defau...
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
2012 Apr 16
2
[LLVMdev] Representing -ffast-math at the IR level
...ath accuracy is a negative number!". + /// SetDefaultFPMathTag - Set the floating point math metadata to be used. + void SetDefaultFPMathTag(MDNode *FPMathTag) { DefaultFPMathTag = FPMathTag; } This should be 'setDefault...' much like 'getDefault...' above. + Instruction *AddFPMathTag(Instruction *I, MDNode *FPMathTag) const { Another bad case, but I think this instruction is gone... + MDString *GetFastString() const { + return CreateString("fast"); + } 'getFastString'. + /// CreateFastFPMath - Return metadata with appropriate settings for ...
2012 Apr 16
0
[LLVMdev] Representing -ffast-math at the IR level
...; + void SetDefaultFPMathTag(MDNode *FPMathTag) { DefaultFPMathTag = FPMathTag; } > > This should be 'setDefault...' much like 'getDefault...' above. The rest of IRBuilder uses a capital S in its setters, so I was just trying to be consistent here. > > + Instruction *AddFPMathTag(Instruction *I, MDNode *FPMathTag) const { > > Another bad case, but I think this instruction is gone... It still exists, and is also capitalized like that for consistency with the rest of IRBuilder. > > + MDString *GetFastString() const { > + return CreateString("fast...
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