module GHC.CmmToAsm.LA64.Cond where

import GHC.Prelude hiding (EQ)

-- | Condition codes.
-- Used in conditional branches and bit setters. According to the available
-- instruction set, some conditions are encoded as their negated opposites. I.e.
-- these are logical things that don't necessarily map 1:1 to hardware/ISA.
-- TODO: Maybe need to simplify or expand?
data Cond
-- ISA condition
  = EQ  -- beq
  | NE  -- bne
  | LT  -- blt
  | GE  -- bge
  | LTU  -- bltu
  | GEU  -- bgeu
  | EQZ  -- beqz
  | NEZ  -- bnez
-- Extra Logical condition
  | SLT -- LT
  | SLE
  | SGE -- GE
  | SGT
  | ULT -- LTU
  | ULE
  | UGE -- GEU
  | UGT
  | FLT
  | FLE
  | FGE
  | FGT
  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, Int -> Cond -> ShowS
[Cond] -> ShowS
Cond -> String
(Int -> Cond -> ShowS)
-> (Cond -> String) -> ([Cond] -> ShowS) -> Show Cond
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Cond -> ShowS
showsPrec :: Int -> Cond -> ShowS
$cshow :: Cond -> String
show :: Cond -> String
$cshowList :: [Cond] -> ShowS
showList :: [Cond] -> ShowS
Show)