Adapted to simplified VECTORISE pragmas
[packages/dph.git] / dph-lifted-vseg / Data / Array / Parallel / Prelude / Ordering.hs
1 {-# OPTIONS_GHC -fvectorise #-}
2
3 module Data.Array.Parallel.Prelude.Ordering
4 ( Ordering
5 , isLT, isEQ, isGT)
6 where
7 import Data.Array.Parallel.Prim ()
8 import Data.Array.Parallel.Prelude.Base ()
9 import Data.Array.Parallel.PArray.PData
10 import Data.Array.Parallel.PArray.PData.Word8
11 import Data.Array.Parallel.PArray.PRepr
12 import Data.Array.Parallel.Lifted ((:->)(..))
13 import qualified Data.Array.Parallel.Lifted as L
14 import qualified Data.Array.Parallel.PArray.Scalar as SC
15
16
17 isLT, isEQ, isGT :: Ordering -> Bool
18
19 isLT _ = False
20 {-# NOINLINE isLT #-}
21 {-# VECTORISE isLT = isLtPP #-}
22
23 isEQ _ = False
24 {-# NOINLINE isEQ #-}
25 {-# VECTORISE isEQ = isEqPP #-}
26
27 isGT _ = False
28 {-# NOINLINE isGT #-}
29 {-# VECTORISE isGT = isGtPP #-}
30
31
32 isLtPP, isEqPP, isGtPP :: Ordering :-> Bool
33 isLtPP = L.closure1' (== LT) (isOrdering LT)
34 {-# INLINE isLtPP #-}
35 {-# NOVECTORISE isLtPP #-}
36
37 isEqPP = L.closure1' (== EQ) (isOrdering EQ)
38 {-# INLINE isEqPP #-}
39 {-# NOVECTORISE isEqPP #-}
40
41 isGtPP = L.closure1' (== GT) (isOrdering GT)
42 {-# INLINE isGtPP #-}
43 {-# NOVECTORISE isGtPP #-}
44
45 isOrdering :: Ordering -> PArray Ordering -> PArray Bool
46 isOrdering o (PArray n pdata)
47 = case pdata of
48 POrdering w8s
49 -> SC.map (== (toPRepr o)) (PArray n $ PWord8 w8s)
50 {-# INLINE isOrdering #-}
51 {-# NOVECTORISE isOrdering #-}