module GHC.CmmToAsm.X86.Cond (
        Cond(..),
        condToUnsigned,
        maybeFlipCond,
        maybeInvertCond
)
where
import GHC.Prelude
data Cond
        = ALWAYS        
        | EQQ           
        | GE            
        | GEU           
        | GTT           
        | GU            
        | LE            
        | LEU           
        | LTT           
        | LU            
        | NE            
        | NEG           
        | POS           
        | CARRY         
        | OFLO          
        | PARITY        
        | NOTPARITY     
        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
condToUnsigned :: Cond -> Cond
condToUnsigned :: Cond -> Cond
condToUnsigned Cond
GTT = Cond
GU
condToUnsigned Cond
LTT = Cond
LU
condToUnsigned Cond
GE  = Cond
GEU
condToUnsigned Cond
LE  = Cond
LEU
condToUnsigned Cond
x   = Cond
x
maybeFlipCond :: Cond -> Maybe Cond
maybeFlipCond :: Cond -> Maybe Cond
maybeFlipCond Cond
cond  = case Cond
cond of
        Cond
EQQ   -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
EQQ
        Cond
NE    -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
NE
        Cond
LU    -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
GU
        Cond
GU    -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
LU
        Cond
LEU   -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
GEU
        Cond
GEU   -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
LEU
        Cond
LTT   -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
GTT
        Cond
GTT   -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
LTT
        Cond
LE    -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
GE
        Cond
GE    -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
LE
        Cond
_other -> Maybe Cond
forall a. Maybe a
Nothing
maybeInvertCond :: Cond -> Maybe Cond
maybeInvertCond :: Cond -> Maybe Cond
maybeInvertCond Cond
cond  = case Cond
cond of
        Cond
ALWAYS  -> Maybe Cond
forall a. Maybe a
Nothing
        Cond
EQQ     -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
NE
        Cond
NE      -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
EQQ
        Cond
NEG     -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
POS
        Cond
POS     -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
NEG
        Cond
GEU     -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
LU
        Cond
LU      -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
GEU
        Cond
GE      -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
LTT
        Cond
LTT     -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
GE
        Cond
GTT     -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
LE
        Cond
LE      -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
GTT
        Cond
GU      -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
LEU
        Cond
LEU     -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
GU
        
        
        Cond
CARRY   -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
GEU
        Cond
OFLO    -> Maybe Cond
forall a. Maybe a
Nothing
        Cond
PARITY  -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
NOTPARITY
        Cond
NOTPARITY -> Cond -> Maybe Cond
forall a. a -> Maybe a
Just Cond
PARITY