module GHC.CmmToAsm.PPC.Cond (
        Cond(..),
        condNegate,
        condUnsigned,
)

where

import GHC.Prelude

import GHC.Utils.Panic

data Cond
        = ALWAYS
        | EQQ
        | GE
        | GEU
        | GTT
        | GU
        | LE
        | LEU
        | LTT
        | LU
        | NE
        deriving Cond -> Cond -> Bool
(Cond -> Cond -> Bool) -> (Cond -> Cond -> Bool) -> Eq Cond
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Cond -> Cond -> Bool
== :: Cond -> Cond -> Bool
$c/= :: Cond -> Cond -> Bool
/= :: Cond -> Cond -> Bool
Eq


condNegate :: Cond -> Cond
condNegate :: Cond -> Cond
condNegate Cond
ALWAYS  = String -> Cond
forall a. HasCallStack => String -> a
panic String
"condNegate: ALWAYS"
condNegate Cond
EQQ     = Cond
NE
condNegate Cond
GE      = Cond
LTT
condNegate Cond
GEU     = Cond
LU
condNegate Cond
GTT     = Cond
LE
condNegate Cond
GU      = Cond
LEU
condNegate Cond
LE      = Cond
GTT
condNegate Cond
LEU     = Cond
GU
condNegate Cond
LTT     = Cond
GE
condNegate Cond
LU      = Cond
GEU
condNegate Cond
NE      = Cond
EQQ

-- Condition utils
condUnsigned :: Cond -> Bool
condUnsigned :: Cond -> Bool
condUnsigned Cond
GU  = Bool
True
condUnsigned Cond
LU  = Bool
True
condUnsigned Cond
GEU = Bool
True
condUnsigned Cond
LEU = Bool
True
condUnsigned Cond
_   = Bool
False