NCG: Split up the native code generator into arch specific modules
[ghc-hetmet.git] / compiler / nativeGen / X86 / Cond.hs
diff --git a/compiler/nativeGen/X86/Cond.hs b/compiler/nativeGen/X86/Cond.hs
new file mode 100644 (file)
index 0000000..60e40b9
--- /dev/null
@@ -0,0 +1,52 @@
+
+module X86.Cond (
+       Cond(..),
+       condUnsigned,
+       condToSigned,
+       condToUnsigned
+)
+
+where
+
+data Cond
+       = ALWAYS        -- What's really used? ToDo
+       | EQQ
+       | GE
+       | GEU
+       | GTT
+       | GU
+       | LE
+       | LEU
+       | LTT
+       | LU
+       | NE
+       | NEG
+       | POS
+       | CARRY
+       | OFLO
+       | PARITY
+       | NOTPARITY
+
+
+condUnsigned :: Cond -> Bool
+condUnsigned GU  = True
+condUnsigned LU  = True
+condUnsigned GEU = True
+condUnsigned LEU = True
+condUnsigned _   = False
+
+
+condToSigned :: Cond -> Cond
+condToSigned GU  = GTT
+condToSigned LU  = LTT
+condToSigned GEU = GE
+condToSigned LEU = LE
+condToSigned x   = x
+
+
+condToUnsigned :: Cond -> Cond
+condToUnsigned GTT = GU
+condToUnsigned LTT = LU
+condToUnsigned GE  = GEU
+condToUnsigned LE  = LEU
+condToUnsigned x   = x