Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
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
- class (Real a, IsFloating a) => Fraction a where
- truncate :: Value a -> CodeGenFunction r (Value a)
- fraction :: Value a -> CodeGenFunction r (Value a)
- signedFraction :: Fraction a => Value a -> CodeGenFunction r (Value a)
- addToPhase :: Fraction a => Value a -> Value a -> CodeGenFunction r (Value a)
- incPhase :: Fraction a => Value a -> Value a -> CodeGenFunction r (Value a)
- truncateToInt :: (IsFloating a, IsInteger i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i)
- floorToInt :: (IsFloating a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i)
- ceilingToInt :: (IsFloating a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i)
- roundToIntFast :: (IsFloating a, RationalConstant a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i)
- splitFractionToInt :: (IsFloating a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i, Value a)
- type family Scalar vector
- class Replicate vector where
- replicate :: Value (Scalar vector) -> CodeGenFunction r (Value vector)
- replicateConst :: ConstValue (Scalar vector) -> ConstValue vector
- replicateOf :: (IsConst (Scalar v), Replicate v) => Scalar v -> Value v
- class IsArithmetic a => Real a where
- min :: Value a -> Value a -> CodeGenFunction r (Value a)
- max :: Value a -> Value a -> CodeGenFunction r (Value a)
- abs :: Value a -> CodeGenFunction r (Value a)
- signum :: Value a -> CodeGenFunction r (Value a)
- class IsInteger a => Saturated a where
- class (IsArithmetic (Scalar v), IsArithmetic v) => PseudoModule v where
- class IsConst a => IntegerConstant a where
- constFromInteger :: Integer -> ConstValue a
- class IntegerConstant a => RationalConstant a where
- constFromRational :: Rational -> ConstValue a
- class RationalConstant a => TranscendentalConstant a where
- constPi :: ConstValue a
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
truncateToInt :: (IsFloating a, IsInteger i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i) Source #
floorToInt :: (IsFloating a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i) Source #
ceilingToInt :: (IsFloating a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i) Source #
roundToIntFast :: (IsFloating a, RationalConstant a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf 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.
splitFractionToInt :: (IsFloating a, CmpRet a, IsInteger i, IntegerConstant i, CmpRet i, CmpResult a ~ CmpResult i, ShapeOf a ~ ShapeOf i) => Value a -> CodeGenFunction r (Value i, Value a) Source #
Instances
class Replicate vector where #
replicate :: Value (Scalar vector) -> CodeGenFunction r (Value vector) #
replicateConst :: ConstValue (Scalar vector) -> ConstValue vector #
Instances
class IsArithmetic a => Real a where Source #
min :: Value a -> Value a -> CodeGenFunction r (Value a) Source #
max :: Value a -> Value a -> CodeGenFunction r (Value a) Source #
Instances
class IsInteger a => Saturated a where Source #
addSat :: Value a -> Value a -> CodeGenFunction r (Value a) Source #
subSat :: Value a -> Value a -> CodeGenFunction r (Value a) Source #
Instances
Saturated Int16 Source # | |
Saturated Int32 Source # | |
Saturated Int64 Source # | |
Saturated Int8 Source # | |
Saturated Word16 Source # | |
Saturated Word32 Source # | |
Saturated Word64 Source # | |
Saturated Word8 Source # | |
Saturated Int Source # | |
Saturated Word Source # | |
Positive d => Saturated (IntN d) Source # | |
Defined in LLVM.Extra.ScalarOrVector | |
Positive d => Saturated (WordN d) Source # | |
Defined in LLVM.Extra.ScalarOrVector | |
(Positive n, IsPrimitive a, Saturated a, Bounded a, CmpRet a, IsConst a) => Saturated (Vector n a) Source # | |
Defined in LLVM.Extra.ScalarOrVector |
class (IsArithmetic (Scalar v), IsArithmetic v) => PseudoModule v where Source #
Instances
PseudoModule Int16 Source # | |
PseudoModule Int32 Source # | |
PseudoModule Int64 Source # | |
PseudoModule Int8 Source # | |
PseudoModule Word16 Source # | |
PseudoModule Word32 Source # | |
PseudoModule Word64 Source # | |
PseudoModule Word8 Source # | |
PseudoModule Double Source # | |
PseudoModule Float Source # | |
PseudoModule Int Source # | |
PseudoModule Word Source # | |
(IsArithmetic a, IsPrimitive a, Positive n) => PseudoModule (Vector n a) Source # | |
Defined in LLVM.Extra.ScalarOrVector |
class IsConst a => IntegerConstant a where Source #
constFromInteger :: Integer -> ConstValue a Source #
Instances
class IntegerConstant a => RationalConstant a where Source #
constFromRational :: Rational -> ConstValue a Source #
Instances
RationalConstant Double Source # | |
Defined in LLVM.Extra.ScalarOrVector | |
RationalConstant Float Source # | |
Defined in LLVM.Extra.ScalarOrVector | |
(RationalConstant a, IsPrimitive a, Positive n) => RationalConstant (Vector n a) Source # | |
Defined in LLVM.Extra.ScalarOrVector constFromRational :: Rational -> ConstValue (Vector n a) Source # |
class RationalConstant a => TranscendentalConstant a where Source #
constPi :: ConstValue a Source #
Instances
TranscendentalConstant Double Source # | |
Defined in LLVM.Extra.ScalarOrVector | |
TranscendentalConstant Float Source # | |
Defined in LLVM.Extra.ScalarOrVector | |
(TranscendentalConstant a, IsPrimitive a, Positive n) => TranscendentalConstant (Vector n a) Source # | |
Defined in LLVM.Extra.ScalarOrVector constPi :: ConstValue (Vector n a) Source # |