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 GU  = Bool
True
condUnsigned LU  = Bool
True
condUnsigned GEU = Bool
True
condUnsigned LEU = Bool
True
condUnsigned _   = Bool
False


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


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