[llvm-commits] [patch] fp128 sint_to_fp folding fix

Duncan Sands baldrick at free.fr
Thu Jan 10 10:46:20 PST 2013


Hi Tim,

On 08/01/13 15:14, Tim Northover wrote:
> On Monday 07 Jan 2013 16:22:14 Renato Golin wrote:
>> I thought as much... I don't know about others, but I feel that PPC should
>> be the special case here, not IEEE. Though, it has nothing to do with your
>> patch.
>
> I've got some updated patches here that remove any default behaviour; as
> Duncan pointed out it *is* largely inappropriate. The new interface is
>
>      APFloat::APFloat(const fltSemantics&, const APInt&)

this approach seems great to me.  The LLVM parts of the patch look good too.
I did notice:

> --- a/include/llvm/CodeGen/SelectionDAG.h
> +++ b/include/llvm/CodeGen/SelectionDAG.h
> @@ -935,6 +935,20 @@ public:
>      }
>    }
>
> +  /// Returns an APFloat semantics tag appropriate for the given type. If VT is
> +  /// a vector type, the element semantics are returned

Missing full stop at end of comment.

> +  static const fltSemantics &EVTToAPFloatSemantics(EVT VT) {

...

> --- a/include/llvm/IR/Type.h
> +++ b/include/llvm/IR/Type.h
> @@ -162,6 +163,18 @@ public:
>             getTypeID() == PPC_FP128TyID;
>    }
>
> +  const fltSemantics &getFltSemantics() const {
> +    switch (getTypeID()) {
> +    case HalfTyID: return APFloat::IEEEhalf;
> +    case FloatTyID: return APFloat::IEEEsingle;
> +    case DoubleTyID: return APFloat::IEEEdouble;
> +    case X86_FP80TyID: return APFloat::x87DoubleExtended;
> +    case FP128TyID: return APFloat::IEEEquad;
> +    case PPC_FP128TyID: return APFloat::PPCDoubleDouble;
> +    default: return APFloat::Bogus;

Is returning Bogus rather than asserting a good idea?

> +    }
> +  }
> +
>    /// isX86_MMXTy - Return true if this is X86 MMX.
>    bool isX86_MMXTy() const { return getTypeID() == X86_MMXTyID; }
>

Ciao, Duncan.



More information about the llvm-commits mailing list