[llvm-commits] [llvm] r168641 - /llvm/trunk/include/llvm/Operator.h
Owen Anderson
resistor at mac.com
Fri Dec 7 10:00:09 PST 2012
On Nov 26, 2012, at 4:40 PM, Michael Ilseman <milseman at apple.com> wrote:
>
> +/// Convenience struct for specifying and reasoning about fast-math flags.
> +struct FastMathFlags {
> + bool UnsafeAlgebra : 1;
> + bool NoNaNs : 1;
> + bool NoInfs : 1;
> + bool NoSignedZeros : 1;
> + bool AllowReciprocal : 1;
> +
> + FastMathFlags() : UnsafeAlgebra(false), NoNaNs(false), NoInfs(false),
> + NoSignedZeros(false), AllowReciprocal(false)
> + { }
> +
> + bool any() {
> + return UnsafeAlgebra || NoNaNs || NoInfs || NoSignedZeros ||
> + AllowReciprocal;
> + }
> +};
> +
> +
> /// FPMathOperator - Utility class for floating point operations which can have
> /// information about relaxed accuracy requirements attached to them.
> class FPMathOperator : public Operator {
> public:
> + enum {
> + UnsafeAlgebra = (1 << 0),
> + NoNaNs = (1 << 1),
> + NoInfs = (1 << 2),
> + NoSignedZeros = (1 << 3),
> + AllowReciprocal = (1 << 4)
> + }
Why do you need to use a bitfield (gross!)? Can't FastMathFlags just be a wrapper around an unsigned?
--Owen
More information about the llvm-commits
mailing list