@@ -140,6 +140,9 @@ initDefs tgt =
140140 , exfun "__gmpz_get_str" ptrI8 [ptrI8, IntegerType 32, pmpz] False
141141 , exfun "__gmpz_cmp" (IntegerType 32) [pmpz, pmpz] False
142142 , exfun "mpz_get_ull" (IntegerType 64) [pmpz] False
143+ , exfun "mpz_init_set_ull" VoidType [pmpz, IntegerType 64] False
144+ , exfun "mpz_init_set_sll" VoidType [pmpz, IntegerType 64] False
145+ , exfun "__idris_strCons" (IntegerType 8) [IntegerType 8, PointerType (IntegerType 8) (AddrSpace 0)] False
143146 , GlobalDefinition mainDef
144147 ] ++ map mpzBinFun ["add", "sub", "mul", "fdiv_q", "fdiv_r", "and", "ior", "xor"]
145148 where
@@ -732,6 +735,22 @@ cgOp (LTrunc ITBig ity) [x] = do
732735 IT64 -> return val
733736 _ -> inst $ Trunc val (IntegerType $ itWidth ity) []
734737 box (FInt ity) v
738+cgOp (LZExt from ITBig) [x] = do
739+ nx <- unbox (FInt from) x
740+ nx' <- case from of
741+ IT64 -> return nx
742+ _ -> inst $ Trunc nx (IntegerType $ itWidth from) []
743+ mpz <- alloc mpzTy
744+ inst' $ simpleCall "mpz_init_set_ull" [mpz, nx']
745+ box (FInt ITBig) mpz
746+cgOp (LSExt from ITBig) [x] = do
747+ nx <- unbox (FInt from) x
748+ nx' <- case from of
749+ IT64 -> return nx
750+ _ -> inst $ Trunc nx (IntegerType $ itWidth from) []
751+ mpz <- alloc mpzTy
752+ inst' $ simpleCall "mpz_init_set_sll" [mpz, nx']
753+ box (FInt ITBig) mpz
735754
736755cgOp (LLt ITBig) [x,y] = mpzCmp IPred.SLT x y
737756cgOp (LLe ITBig) [x,y] = mpzCmp IPred.SLE x y
@@ -791,6 +810,13 @@ cgOp (LIntStr ity) [x] = do
791810 box FString =<< inst (idrCall "__idris_intStr" [x''])
792811
793812cgOp LStrConcat [x,y] = cgStrCat x y
813+
814+cgOp LStrCons [c,s] = do
815+ nc <- unbox FChar c
816+ ns <- unbox FString s
817+ r <- inst $ simpleCall "__idris_strCons" [nc, ns]
818+ box FString r
819+
794820cgOp prim args = ierror $ "Unimplemented primitive: [" ++ show prim ++ "]("
795821 ++ intersperse ',' (take (length args) ['a'..]) ++ ")"
796822