on master help sign in
LStrEq
21c9f6fBenjamin Saunders
src/IRTS/CodegenLLVM.hs+8
@@ -753,6 +753,14 @@ cgOp (LAnd ity) [x,y] = ibin ity x y And
753cgOp (LOr ity) [x,y] = ibin ity x y Or
753cgOp (LOr ity) [x,y] = ibin ity x y Or
754cgOp (LXOr ity) [x,y] = ibin ity x y Xor
754cgOp (LXOr ity) [x,y] = ibin ity x y Xor
755
755
756+cgOp LStrEq [x,y] = do
757+ x' <- unbox FString x
758+ y' <- unbox FString y
759+ cmp <- inst $ simpleCall "strcmp" [x', y']
760+ flag <- inst $ ICmp IPred.EQ cmp (ConstantOperand (C.Int 32 0)) []
761+ val <- inst $ ZExt flag (IntegerType 32) []
762+ box (FInt IT32) val
763+
756cgOp (LIntStr ITBig) [x] = do
764cgOp (LIntStr ITBig) [x] = do
757 x' <- unbox (FInt ITBig) x
765 x' <- unbox (FInt ITBig) x
758 ustr <- inst $ simpleCall "__gmpz_get_str"
766 ustr <- inst $ simpleCall "__gmpz_get_str"