llvm-extra-0.8.1: Utility functions for the llvm interface

Safe HaskellNone

LLVM.Extra.ScalarOrVector

Description

Support for unified handling of scalars and vectors.

Attention: The rounding and fraction functions only work for floating point values with maximum magnitude of maxBound :: Int32. This way we save expensive handling of possibly seldom cases.

Synopsis

Documentation

signedFraction :: Fraction a => Value a -> CodeGenFunction r (Value a)Source

The fraction has the same sign as the argument. This is not particular useful but fast on IEEE implementations.

addToPhase :: Fraction a => Value a -> Value a -> CodeGenFunction r (Value a)Source

increment (first operand) may be negative, phase must always be non-negative

incPhase :: Fraction a => Value a -> Value a -> CodeGenFunction r (Value a)Source

both increment and phase must be non-negative

roundToIntFast :: (IsFloating a, RationalConstant a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, NumberOfElements a ~ NumberOfElements i) => Value a -> CodeGenFunction r (Value i)Source

Rounds to the next integer. For numbers of the form n+0.5, we choose one of the neighboured integers such that the overall implementation is most efficient.

type family Scalar vector :: *Source