module SPARC.Cond (
        Cond(..),
        condUnsigned,
        condToSigned,
        condToUnsigned
)

where

import GhcPrelude

-- | Branch condition codes.
data Cond
        = ALWAYS
        | EQQ
        | GE
        | GEU
        | GTT
        | GU
        | LE
        | LEU
        | LTT
        | LU
        | NE
        | NEG
        | NEVER
        | POS
        | VC
        | VS
        deriving Cond -> Cond -> Bool
(Cond -> Cond -> Bool) -> (Cond -> Cond -> Bool) -> Eq Cond
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Cond -> Cond -> Bool
$c/= :: Cond -> Cond -> Bool
== :: Cond -> Cond -> Bool
$c== :: Cond -> Cond -> Bool
Eq


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


condToSigned :: Cond -> Cond
condToSigned :: Cond -> Cond
condToSigned Cond
GU  = Cond
GTT
condToSigned Cond
LU  = Cond
LTT
condToSigned Cond
GEU = Cond
GE
condToSigned Cond
LEU = Cond
LE
condToSigned Cond
x   = Cond
x


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