diff options
Diffstat (limited to 'codegen.hs')
-rw-r--r-- | codegen.hs | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -441,6 +441,24 @@ genExpression (ExBinOp bo e1 e2 (Just t)) = do (TypeUInt _) -> addInstr $ A.ICmp A.ULT e1op' e2op' [] _ -> undefined return $ A.LocalReference (A.IntegerType 1) (A.Name label) + GEqual -> do + sharedType <- commonTypeM (fromJust (exTypeOf e1)) (fromJust (exTypeOf e2)) + e1op' <- castOperand e1op sharedType + e2op' <- castOperand e2op sharedType + label <- case sharedType of + (TypeInt _) -> addInstr $ A.ICmp A.SGE e1op' e2op' [] + (TypeUInt _) -> addInstr $ A.ICmp A.UGE e1op' e2op' [] + _ -> undefined + return $ A.LocalReference (A.IntegerType 1) (A.Name label) + LEqual -> do + sharedType <- commonTypeM (fromJust (exTypeOf e1)) (fromJust (exTypeOf e2)) + e1op' <- castOperand e1op sharedType + e2op' <- castOperand e2op sharedType + label <- case sharedType of + (TypeInt _) -> addInstr $ A.ICmp A.SLE e1op' e2op' [] + (TypeUInt _) -> addInstr $ A.ICmp A.ULE e1op' e2op' [] + _ -> undefined + return $ A.LocalReference (A.IntegerType 1) (A.Name label) BoolOr -> do e1op' <- castToBool e1op e2op' <- castToBool e2op |