@@ -746,6 +746,11 @@ cgOp (LAnd ITBig) [x,y] = mpzBin "and" x y
746746cgOp (LOr ITBig) [x,y] = mpzBin "ior" x y
747747cgOp (LXOr ITBig) [x,y] = mpzBin "xor" x y
748748
749+cgOp (LLt ity) [x,y] = iCmp ity IPred.SLT x y
750+cgOp (LLe ity) [x,y] = iCmp ity IPred.SLE x y
751+cgOp (LEq ity) [x,y] = iCmp ity IPred.EQ x y
752+cgOp (LGe ity) [x,y] = iCmp ity IPred.SGE x y
753+cgOp (LGt ity) [x,y] = iCmp ity IPred.SGT x y
749754cgOp (LPlus ity) [x,y] = ibin ity x y (Add False False)
750755cgOp (LMinus ity) [x,y] = ibin ity x y (Sub False False)
751756cgOp (LTimes ity) [x,y] = ibin ity x y (Mul False False)
@@ -805,6 +810,14 @@ ibin ity x y instCon = do
805810 nr <- inst $ instCon nx ny []
806811 box (FInt ity) nr
807812
813+iCmp :: IntTy -> IPred.IntegerPredicate -> Operand -> Operand -> Codegen Operand
814+iCmp ity pred x y = do
815+ nx <- unbox (FInt ity) x
816+ ny <- unbox (FInt ity) y
817+ nr <- inst $ ICmp pred nx ny []
818+ nr' <- inst $ ZExt nr (IntegerType . fromIntegral $ intTyWidth ity) []
819+ box (FInt ity) nr'
820+
808821mpzBin :: String -> Operand -> Operand -> Codegen Operand
809822mpzBin name x y = do
810823 nx <- unbox (FInt ITBig) x