Whitespace only in nativeGen/RegAlloc/Graph/TrivColorable.hs
[ghc-hetmet.git] / compiler / nativeGen / PPC / Cond.hs
1
2 module PPC.Cond (
3         Cond(..),
4         condNegate,
5         condUnsigned,
6         condToSigned,
7         condToUnsigned,
8 )
9
10 where
11
12 import Panic
13
14 data Cond
15         = ALWAYS
16         | EQQ
17         | GE
18         | GEU
19         | GTT
20         | GU
21         | LE
22         | LEU
23         | LTT
24         | LU
25         | NE
26         deriving Eq
27
28
29 condNegate :: Cond -> Cond
30 condNegate ALWAYS  = panic "condNegate: ALWAYS"
31 condNegate EQQ     = NE
32 condNegate GE      = LTT
33 condNegate GEU     = LU
34 condNegate GTT     = LE
35 condNegate GU      = LEU
36 condNegate LE      = GTT
37 condNegate LEU     = GU
38 condNegate LTT     = GE
39 condNegate LU      = GEU
40 condNegate NE      = EQQ
41
42 -- Condition utils
43 condUnsigned :: Cond -> Bool
44 condUnsigned GU  = True
45 condUnsigned LU  = True
46 condUnsigned GEU = True
47 condUnsigned LEU = True
48 condUnsigned _   = False
49
50 condToSigned :: Cond -> Cond
51 condToSigned GU  = GTT
52 condToSigned LU  = LTT
53 condToSigned GEU = GE
54 condToSigned LEU = LE
55 condToSigned x   = x
56
57 condToUnsigned :: Cond -> Cond
58 condToUnsigned GTT = GU
59 condToUnsigned LTT = LU
60 condToUnsigned GE  = GEU
61 condToUnsigned LE  = LEU
62 condToUnsigned x   = x