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