llvm-extra 0.7 → 0.7.0.1
raw patch · 2 files changed
+20/−15 lines, 2 filesdep ~llvm-tf
Dependency ranges changed: llvm-tf
Files
- llvm-extra.cabal +3/−3
- src/Array.hs +17/−12
llvm-extra.cabal view
@@ -1,5 +1,5 @@ Name: llvm-extra-Version: 0.7+Version: 0.7.0.1 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -71,7 +71,7 @@ default: True Source-Repository this- Tag: 0.7+ Tag: 0.7.0.1 Type: darcs Location: http://code.haskell.org/~thielema/llvm-extra/ @@ -83,7 +83,7 @@ Build-Depends: -- llvm must be imported with restrictive version bounds, -- because we import implicitly and unqualified- llvm-tf >=3.0.3 && <3.1.1,+ llvm-tf >=3.0.3 && <3.2, tfp >=1.0 && <1.1, non-empty >=0.2.1 && <0.4, containers >=0.1 && <0.6,
src/Array.hs view
@@ -12,7 +12,12 @@ import qualified LLVM.Extra.Class as Class import qualified LLVM.Extra.Arithmetic as A +import qualified LLVM.Core as LLVM import LLVM.Core+ (Value, valueOf, value, constOf, undef, zero, add, sub, mul, frem,+ createFunction, Function, Linkage(ExternalLinkage), ret,+ CodeGenModule, CodeGenFunction, store,+ Vector, extractelement, insertelement, shufflevector, ) import LLVM.ExecutionEngine (simpleFunction, ) import qualified System.IO as IO @@ -30,12 +35,12 @@ -type Vec = ConstValue (Vector D4 Float)+type Vec = LLVM.ConstValue (Vector D4 Float) constVec :: Float -> CodeGenFunction r (Value (Vector D4 Float)) constVec x =- return $ valueOf $ toVector (x,x,x,x)+ return $ valueOf $ LLVM.toVector (x,x,x,x) constVecInsert :: Float -> CodeGenFunction r (Value (Vector D4 Float))@@ -52,8 +57,8 @@ because 'frem' is only available in the FPU. -} fractionVector0 ::- (IsFloating c, ABinOp a (Value (Vector D4 Float)),- ABinOpResult a (Value (Vector D4 Float)) ~ (v c)) =>+ (LLVM.IsFloating c, LLVM.ABinOp a (Value (Vector D4 Float)),+ LLVM.ABinOpResult a (Value (Vector D4 Float)) ~ (v c)) => a -> CodeGenFunction r (v c) fractionVector0 x = frem x =<< constVec 1@@ -63,7 +68,7 @@ This call fill (fromIntegral len) ptr- (toVector (0.01003, 0.01001, 0.00999, 0.00997)) >>+ (LLVM.toVector (0.01003, 0.01001, 0.00999, 0.00997)) >> would not work, because Vector is not of type Generic. -}@@ -93,8 +98,8 @@ mixReduceSize :: Value (Vector D4 Float) -> CodeGenFunction r (Value Float) mixReduceSize y = do- y01 <- shufflevector y (value undef) (constVector [constOf 0, constOf 1])- y23 <- shufflevector y (value undef) (constVector [constOf 2, constOf 3])+ y01 <- shufflevector y (value undef) (LLVM.constVector [constOf 0, constOf 1])+ y23 <- shufflevector y (value undef) (LLVM.constVector [constOf 2, constOf 3]) z <- add (y01 :: Value (Vector D2 Float)) (y23 :: Value (Vector D2 Float))@@ -113,7 +118,7 @@ -- that is translated to movhlps y23 <- shufflevector y (value undef)- (constVector $ constOf 2 !: constOf 3 !: undef !: undef !: Empty.Cons)+ (LLVM.constVector $ constOf 2 !: constOf 3 !: undef !: undef !: Empty.Cons) z <- A.add y y23 s0 <- extractelement z (valueOf 0) s1 <- extractelement z (valueOf 1)@@ -217,9 +222,9 @@ renderChorus :: IO () renderChorus = do- m <- newModule- _f <- defineModule m mChorusVector- writeBitcodeToFile "array.bc" m+ m <- LLVM.newModule+ _f <- LLVM.defineModule m mChorusVector+ LLVM.writeBitcodeToFile "array.bc" m fill <- simpleFunction mChorusVector IO.withFile "speedtest.f32" IO.WriteMode $ \h ->@@ -267,5 +272,5 @@ main :: IO () main = do- initializeNativeTarget+ LLVM.initializeNativeTarget renderChorus