@@ -632,6 +632,14 @@ class CCPPDSUtils {
632632 return result;
633633 }
634634
635+ std::string generate_binary_operator_code (std::string value, std::string target, std::string operatorName) {
636+ size_t delimiterPos = value.find (" ," );
637+ std::string leftPart = value.substr (0 , delimiterPos);
638+ std::string rightPart = value.substr (delimiterPos + 1 );
639+ std::string result = operatorName + " (" + target + " , " + leftPart + " , " + rightPart + " );" ;
640+ return result;
641+ }
642+
635643 std::string get_deepcopy_symbolic (ASR::expr_t *value_expr, std::string value, std::string target) {
636644 std::string result;
637645 if (ASR::is_a<ASR::Var_t>(*value_expr)) {
@@ -645,22 +653,43 @@ class CCPPDSUtils {
645653 break ;
646654 }
647655 case LCompilers::ASRUtils::IntrinsicFunctions::SymbolicAdd: {
648- size_t delimiterPos = value.find (" ," );
649- std::string leftPart = value.substr (0 , delimiterPos);
650- std::string rightPart = value.substr (delimiterPos + 1 );
651- result = " basic_add(" + target + " , " + leftPart + " , " + rightPart + " );" ;
656+ result = generate_binary_operator_code (value, target, " basic_add" );
657+ break ;
658+ }
659+ case LCompilers::ASRUtils::IntrinsicFunctions::SymbolicSub: {
660+ result = generate_binary_operator_code (value, target, " basic_sub" );
661+ break ;
662+ }
663+ case LCompilers::ASRUtils::IntrinsicFunctions::SymbolicMul: {
664+ result = generate_binary_operator_code (value, target, " basic_mul" );
665+ break ;
666+ }
667+ case LCompilers::ASRUtils::IntrinsicFunctions::SymbolicDiv: {
668+ result = generate_binary_operator_code (value, target, " basic_div" );
669+ break ;
670+ }
671+ case LCompilers::ASRUtils::IntrinsicFunctions::SymbolicPow: {
672+ result = generate_binary_operator_code (value, target, " basic_pow" );
652673 break ;
653674 }
654675 case LCompilers::ASRUtils::IntrinsicFunctions::SymbolicPi: {
655676 result = " basic_const_pi(" + target + " );" ;
656677 break ;
657678 }
679+ case LCompilers::ASRUtils::IntrinsicFunctions::SymbolicInteger: {
680+ result = " integer_set_si(" + target + " , " + value + " );" ;
681+ break ;
682+ }
658683 default : {
659684 throw LCompilersException (" IntrinsicFunction: `"
660685 + LCompilers::ASRUtils::get_intrinsic_name (intrinsic_id)
661686 + " ` is not implemented" );
662687 }
663688 }
689+ } else if (ASR::is_a<ASR::Cast_t>(*value_expr)) {
690+ ASR::Cast_t* cast_expr = ASR::down_cast<ASR::Cast_t>(value_expr);
691+ std::string cast_value_expr = get_deepcopy_symbolic (cast_expr->m_value , value, target);
692+ return cast_value_expr;
664693 }
665694 return result;
666695 }
0 commit comments