From 450d88a1eec5bd1cf2a2611856b33442caab82f9 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 18:16:33 +0530 Subject: [PATCH 01/12] Move casting_utils to LibASR So it can be used in intrinsic_function_registry --- src/libasr/CMakeLists.txt | 1 + src/libasr/casting_utils.cpp | 143 ++++++++++++++++++++ src/libasr/casting_utils.h | 21 +++ src/lpython/semantics/python_ast_to_asr.cpp | 139 +------------------ 4 files changed, 166 insertions(+), 138 deletions(-) create mode 100644 src/libasr/casting_utils.cpp create mode 100644 src/libasr/casting_utils.h diff --git a/src/libasr/CMakeLists.txt b/src/libasr/CMakeLists.txt index 058fd67d07..2c9977c5e8 100644 --- a/src/libasr/CMakeLists.txt +++ b/src/libasr/CMakeLists.txt @@ -65,6 +65,7 @@ set(SRC asr_verify.cpp asr_utils.cpp + casting_utils.cpp diagnostics.cpp stacktrace.cpp string_utils.cpp diff --git a/src/libasr/casting_utils.cpp b/src/libasr/casting_utils.cpp new file mode 100644 index 0000000000..0a8a1c1cd3 --- /dev/null +++ b/src/libasr/casting_utils.cpp @@ -0,0 +1,143 @@ +#include +#include + +#include + + +namespace LCompilers::CastingUtil { + + // Data structure which contains priorities for + // intrinsic types defined in ASR + const std::map& type2weight = { + {ASR::ttypeType::Complex, 4}, + {ASR::ttypeType::Real, 3}, + {ASR::ttypeType::Integer, 2}, + {ASR::ttypeType::Logical, 1} + }; + + // Data structure which contains casting rules for non-equal + // intrinsic types defined in ASR + const std::map, ASR::cast_kindType>& type_rules = { + {std::make_pair(ASR::ttypeType::Complex, ASR::ttypeType::Real), ASR::cast_kindType::ComplexToReal}, + {std::make_pair(ASR::ttypeType::Complex, ASR::ttypeType::Logical), ASR::cast_kindType::ComplexToLogical}, + {std::make_pair(ASR::ttypeType::Real, ASR::ttypeType::Complex), ASR::cast_kindType::RealToComplex}, + {std::make_pair(ASR::ttypeType::Real, ASR::ttypeType::Integer), ASR::cast_kindType::RealToInteger}, + {std::make_pair(ASR::ttypeType::Real, ASR::ttypeType::Logical), ASR::cast_kindType::RealToLogical}, + {std::make_pair(ASR::ttypeType::Real, ASR::ttypeType::UnsignedInteger), ASR::cast_kindType::RealToUnsignedInteger}, + {std::make_pair(ASR::ttypeType::Integer, ASR::ttypeType::Complex), ASR::cast_kindType::IntegerToComplex}, + {std::make_pair(ASR::ttypeType::Integer, ASR::ttypeType::Real), ASR::cast_kindType::IntegerToReal}, + {std::make_pair(ASR::ttypeType::Integer, ASR::ttypeType::Logical), ASR::cast_kindType::IntegerToLogical}, + {std::make_pair(ASR::ttypeType::Integer, ASR::ttypeType::UnsignedInteger), ASR::cast_kindType::IntegerToUnsignedInteger}, + {std::make_pair(ASR::ttypeType::Logical, ASR::ttypeType::Real), ASR::cast_kindType::LogicalToReal}, + {std::make_pair(ASR::ttypeType::Logical, ASR::ttypeType::Integer), ASR::cast_kindType::LogicalToInteger}, + {std::make_pair(ASR::ttypeType::UnsignedInteger, ASR::ttypeType::Integer), ASR::cast_kindType::UnsignedIntegerToInteger}, + {std::make_pair(ASR::ttypeType::UnsignedInteger, ASR::ttypeType::Real), ASR::cast_kindType::UnsignedIntegerToReal}, + {std::make_pair(ASR::ttypeType::Integer, ASR::ttypeType::SymbolicExpression), ASR::cast_kindType::IntegerToSymbolicExpression} + }; + + // Data structure which contains casting rules for equal intrinsic + // types but with different kinds. + const std::map& kind_rules = { + {ASR::ttypeType::Complex, ASR::cast_kindType::ComplexToComplex}, + {ASR::ttypeType::Real, ASR::cast_kindType::RealToReal}, + {ASR::ttypeType::Integer, ASR::cast_kindType::IntegerToInteger}, + {ASR::ttypeType::UnsignedInteger, ASR::cast_kindType::UnsignedIntegerToUnsignedInteger} + }; + + int get_type_priority(ASR::ttypeType type) { + if( type2weight.find(type) == type2weight.end() ) { + return -1; + } + + return type2weight.at(type); + } + + int get_src_dest(ASR::expr_t* left_expr, ASR::expr_t* right_expr, + ASR::expr_t*& src_expr, ASR::expr_t*& dest_expr, + ASR::ttype_t*& src_type, ASR::ttype_t*& dest_type, + bool is_assign) { + ASR::ttype_t* left_type = ASRUtils::expr_type(left_expr); + ASR::ttype_t* right_type = ASRUtils::expr_type(right_expr); + if( ASR::is_a(*left_type) ) { + left_type = ASRUtils::get_contained_type(left_type); + } + if( ASR::is_a(*right_type) ) { + right_type = ASRUtils::get_contained_type(right_type); + } + left_type = ASRUtils::type_get_past_pointer(left_type); + right_type = ASRUtils::type_get_past_pointer(right_type); + if( ASRUtils::check_equal_type(left_type, right_type) || + ASRUtils::is_character(*left_type) || ASRUtils::is_character(*right_type) ) { + return 2; + } + if( is_assign ) { + if( ASRUtils::is_real(*left_type) && ASRUtils::is_integer(*right_type)) { + throw SemanticError("Assigning integer to float is not supported", + right_expr->base.loc); + } + if ( ASRUtils::is_complex(*left_type) && !ASRUtils::is_complex(*right_type)) { + throw SemanticError("Assigning non-complex to complex is not supported", + right_expr->base.loc); + } + dest_expr = left_expr, dest_type = left_type; + src_expr = right_expr, src_type = right_type; + return 1; + } + + int casted_expr_signal = 2; + ASR::ttypeType left_Type = left_type->type, right_Type = right_type->type; + int left_kind = ASRUtils::extract_kind_from_ttype_t(left_type); + int right_kind = ASRUtils::extract_kind_from_ttype_t(right_type); + int left_priority = get_type_priority(left_Type); + int right_priority = get_type_priority(right_Type); + if( left_priority > right_priority ) { + src_expr = right_expr, src_type = right_type; + dest_expr = left_expr, dest_type = left_type; + casted_expr_signal = 1; + } else if( left_priority < right_priority ) { + src_expr = left_expr, src_type = left_type; + dest_expr = right_expr, dest_type = right_type; + casted_expr_signal = 0; + } else { + if( left_kind > right_kind ) { + src_expr = right_expr, src_type = right_type; + dest_expr = left_expr, dest_type = left_type; + casted_expr_signal = 1; + } else if( left_kind < right_kind ) { + src_expr = left_expr, src_type = left_type; + dest_expr = right_expr, dest_type = right_type; + casted_expr_signal = 0; + } else { + return 2; + } + } + + return casted_expr_signal; + } + + ASR::expr_t* perform_casting(ASR::expr_t* expr, ASR::ttype_t* src, + ASR::ttype_t* dest, Allocator& al, + const Location& loc) { + ASR::ttypeType src_type = src->type; + ASR::ttypeType dest_type = dest->type; + ASR::cast_kindType cast_kind; + if( src_type == dest_type ) { + if( kind_rules.find(src_type) == kind_rules.end() ) { + return expr; + } + cast_kind = kind_rules.at(src_type); + } else { + std::pair cast_key = std::make_pair(src_type, dest_type); + if( type_rules.find(cast_key) == type_rules.end() ) { + return expr; + } + cast_kind = type_rules.at(cast_key); + } + if( ASRUtils::check_equal_type(src, dest, true) ) { + return expr; + } + // TODO: Fix loc + return ASRUtils::EXPR(ASRUtils::make_Cast_t_value(al, loc, expr, + cast_kind, dest)); + } +} diff --git a/src/libasr/casting_utils.h b/src/libasr/casting_utils.h new file mode 100644 index 0000000000..6c5a222ba9 --- /dev/null +++ b/src/libasr/casting_utils.h @@ -0,0 +1,21 @@ +#ifndef LFORTRAN_CASTING_UTILS_H +#define LFORTRAN_CASTING_UTILS_H + + +#include + +namespace LCompilers::CastingUtil { + + int get_type_priority(ASR::ttypeType type); + + int get_src_dest(ASR::expr_t* left_expr, ASR::expr_t* right_expr, + ASR::expr_t*& src_expr, ASR::expr_t*& dest_expr, + ASR::ttype_t*& src_type, ASR::ttype_t*& dest_type, + bool is_assign); + + ASR::expr_t* perform_casting(ASR::expr_t* expr, ASR::ttype_t* src, + ASR::ttype_t* dest, Allocator& al, + const Location& loc); +} + +#endif // LFORTRAN_CASTING_UTILS_H diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 32432069ce..a796a629bd 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -36,144 +37,6 @@ namespace LCompilers::LPython { -namespace CastingUtil { - - // Data structure which contains priorities for - // intrinsic types defined in ASR - const std::map& type2weight = { - {ASR::ttypeType::Complex, 4}, - {ASR::ttypeType::Real, 3}, - {ASR::ttypeType::Integer, 2}, - {ASR::ttypeType::Logical, 1} - }; - - // Data structure which contains casting rules for non-equal - // intrinsic types defined in ASR - const std::map, ASR::cast_kindType>& type_rules = { - {std::make_pair(ASR::ttypeType::Complex, ASR::ttypeType::Real), ASR::cast_kindType::ComplexToReal}, - {std::make_pair(ASR::ttypeType::Complex, ASR::ttypeType::Logical), ASR::cast_kindType::ComplexToLogical}, - {std::make_pair(ASR::ttypeType::Real, ASR::ttypeType::Complex), ASR::cast_kindType::RealToComplex}, - {std::make_pair(ASR::ttypeType::Real, ASR::ttypeType::Integer), ASR::cast_kindType::RealToInteger}, - {std::make_pair(ASR::ttypeType::Real, ASR::ttypeType::Logical), ASR::cast_kindType::RealToLogical}, - {std::make_pair(ASR::ttypeType::Real, ASR::ttypeType::UnsignedInteger), ASR::cast_kindType::RealToUnsignedInteger}, - {std::make_pair(ASR::ttypeType::Integer, ASR::ttypeType::Complex), ASR::cast_kindType::IntegerToComplex}, - {std::make_pair(ASR::ttypeType::Integer, ASR::ttypeType::Real), ASR::cast_kindType::IntegerToReal}, - {std::make_pair(ASR::ttypeType::Integer, ASR::ttypeType::Logical), ASR::cast_kindType::IntegerToLogical}, - {std::make_pair(ASR::ttypeType::Integer, ASR::ttypeType::UnsignedInteger), ASR::cast_kindType::IntegerToUnsignedInteger}, - {std::make_pair(ASR::ttypeType::Logical, ASR::ttypeType::Real), ASR::cast_kindType::LogicalToReal}, - {std::make_pair(ASR::ttypeType::Logical, ASR::ttypeType::Integer), ASR::cast_kindType::LogicalToInteger}, - {std::make_pair(ASR::ttypeType::UnsignedInteger, ASR::ttypeType::Integer), ASR::cast_kindType::UnsignedIntegerToInteger}, - {std::make_pair(ASR::ttypeType::UnsignedInteger, ASR::ttypeType::Real), ASR::cast_kindType::UnsignedIntegerToReal}, - {std::make_pair(ASR::ttypeType::Integer, ASR::ttypeType::SymbolicExpression), ASR::cast_kindType::IntegerToSymbolicExpression} - }; - - // Data structure which contains casting rules for equal intrinsic - // types but with different kinds. - const std::map& kind_rules = { - {ASR::ttypeType::Complex, ASR::cast_kindType::ComplexToComplex}, - {ASR::ttypeType::Real, ASR::cast_kindType::RealToReal}, - {ASR::ttypeType::Integer, ASR::cast_kindType::IntegerToInteger}, - {ASR::ttypeType::UnsignedInteger, ASR::cast_kindType::UnsignedIntegerToUnsignedInteger} - }; - - int get_type_priority(ASR::ttypeType type) { - if( type2weight.find(type) == type2weight.end() ) { - return -1; - } - - return type2weight.at(type); - } - - int get_src_dest(ASR::expr_t* left_expr, ASR::expr_t* right_expr, - ASR::expr_t*& src_expr, ASR::expr_t*& dest_expr, - ASR::ttype_t*& src_type, ASR::ttype_t*& dest_type, - bool is_assign) { - ASR::ttype_t* left_type = ASRUtils::expr_type(left_expr); - ASR::ttype_t* right_type = ASRUtils::expr_type(right_expr); - if( ASR::is_a(*left_type) ) { - left_type = ASRUtils::get_contained_type(left_type); - } - if( ASR::is_a(*right_type) ) { - right_type = ASRUtils::get_contained_type(right_type); - } - left_type = ASRUtils::type_get_past_pointer(left_type); - right_type = ASRUtils::type_get_past_pointer(right_type); - if( ASRUtils::check_equal_type(left_type, right_type) || - ASRUtils::is_character(*left_type) || ASRUtils::is_character(*right_type) ) { - return 2; - } - if( is_assign ) { - if( ASRUtils::is_real(*left_type) && ASRUtils::is_integer(*right_type)) { - throw SemanticError("Assigning integer to float is not supported", - right_expr->base.loc); - } - if ( ASRUtils::is_complex(*left_type) && !ASRUtils::is_complex(*right_type)) { - throw SemanticError("Assigning non-complex to complex is not supported", - right_expr->base.loc); - } - dest_expr = left_expr, dest_type = left_type; - src_expr = right_expr, src_type = right_type; - return 1; - } - - int casted_expr_signal = 2; - ASR::ttypeType left_Type = left_type->type, right_Type = right_type->type; - int left_kind = ASRUtils::extract_kind_from_ttype_t(left_type); - int right_kind = ASRUtils::extract_kind_from_ttype_t(right_type); - int left_priority = get_type_priority(left_Type); - int right_priority = get_type_priority(right_Type); - if( left_priority > right_priority ) { - src_expr = right_expr, src_type = right_type; - dest_expr = left_expr, dest_type = left_type; - casted_expr_signal = 1; - } else if( left_priority < right_priority ) { - src_expr = left_expr, src_type = left_type; - dest_expr = right_expr, dest_type = right_type; - casted_expr_signal = 0; - } else { - if( left_kind > right_kind ) { - src_expr = right_expr, src_type = right_type; - dest_expr = left_expr, dest_type = left_type; - casted_expr_signal = 1; - } else if( left_kind < right_kind ) { - src_expr = left_expr, src_type = left_type; - dest_expr = right_expr, dest_type = right_type; - casted_expr_signal = 0; - } else { - return 2; - } - } - - return casted_expr_signal; - } - - ASR::expr_t* perform_casting(ASR::expr_t* expr, ASR::ttype_t* src, - ASR::ttype_t* dest, Allocator& al, - const Location& loc) { - ASR::ttypeType src_type = src->type; - ASR::ttypeType dest_type = dest->type; - ASR::cast_kindType cast_kind; - if( src_type == dest_type ) { - if( kind_rules.find(src_type) == kind_rules.end() ) { - return expr; - } - cast_kind = kind_rules.at(src_type); - } else { - std::pair cast_key = std::make_pair(src_type, dest_type); - if( type_rules.find(cast_key) == type_rules.end() ) { - return expr; - } - cast_kind = type_rules.at(cast_key); - } - if( ASRUtils::check_equal_type(src, dest, true) ) { - return expr; - } - // TODO: Fix loc - return ASRUtils::EXPR(ASRUtils::make_Cast_t_value(al, loc, expr, - cast_kind, dest)); - } -} - int save_pyc_files(const ASR::TranslationUnit_t &u, std::string infile) { diag::Diagnostics diagnostics; From 8953abf3e81874428e645ede61766c172174489f Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 18:17:48 +0530 Subject: [PATCH 02/12] IntrinsicFunctions: Support floordiv in intrinsic_function_registry --- src/libasr/pass/intrinsic_function_registry.h | 125 +++++++++++++++++- src/lpython/semantics/python_ast_to_asr.cpp | 17 ++- 2 files changed, 139 insertions(+), 3 deletions(-) diff --git a/src/libasr/pass/intrinsic_function_registry.h b/src/libasr/pass/intrinsic_function_registry.h index 1be030ef7b..c83b0168b3 100644 --- a/src/libasr/pass/intrinsic_function_registry.h +++ b/src/libasr/pass/intrinsic_function_registry.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -46,6 +47,7 @@ enum class IntrinsicScalarFunctions : int64_t { Expm1, FMA, FlipSign, + FloorDiv, ListIndex, Partition, ListReverse, @@ -107,6 +109,7 @@ inline std::string get_intrinsic_name(int x) { INTRINSIC_NAME_CASE(Expm1) INTRINSIC_NAME_CASE(FMA) INTRINSIC_NAME_CASE(FlipSign) + INTRINSIC_NAME_CASE(FloorDiv) INTRINSIC_NAME_CASE(ListIndex) INTRINSIC_NAME_CASE(Partition) INTRINSIC_NAME_CASE(ListReverse) @@ -316,7 +319,10 @@ class ASRBuilder { ASR::binopType::Sub, right, int32, nullptr)) #define iDiv(left, right) r2i32(EXPR(ASR::make_RealBinOp_t(al, loc, \ i2r32(left), ASR::binopType::Div, i2r32(right), real32, nullptr))) - + #define i64Sub(left, right) EXPR(ASR::make_IntegerBinOp_t(al, loc, left, \ + ASR::binopType::Sub, right, int64, nullptr)) + #define r64Div(left, right) EXPR(ASR::make_RealBinOp_t(al, loc, \ + left, ASR::binopType::Div, right, real64, nullptr)) #define rDiv(left, right) EXPR(ASR::make_RealBinOp_t(al, loc, left, \ ASR::binopType::Div, right, real32, nullptr)) @@ -391,6 +397,8 @@ class ASRBuilder { ASR::cmpopType::Lt, y, logical, nullptr)) #define fGt(x, y) EXPR(ASR::make_RealCompare_t(al, loc, x, \ ASR::cmpopType::Gt, y, logical, nullptr)) + #define fNotEq(x, y) EXPR(ASR::make_RealCompare_t(al, loc, x, \ + ASR::cmpopType::NotEq, y, logical, nullptr)) #define sEq(x, y) EXPR(ASR::make_StringCompare_t(al, loc, x, \ ASR::cmpopType::Eq, y, logical, nullptr)) @@ -1964,6 +1972,116 @@ namespace FlipSign { } // namespace FlipSign +namespace FloorDiv { + + static inline void verify_args(const ASR::IntrinsicScalarFunction_t& x, diag::Diagnostics& diagnostics) { + ASRUtils::require_impl(x.n_args == 2, + "ASR Verify: Call to FloorDiv must have exactly 2 arguments", + x.base.base.loc, diagnostics); + ASR::ttype_t *type1 = ASRUtils::expr_type(x.m_args[0]); + ASR::ttype_t *type2 = ASRUtils::expr_type(x.m_args[1]); + ASRUtils::require_impl((is_integer(*type1) && is_integer(*type2)) || + (is_unsigned_integer(*type1) && is_unsigned_integer(*type2)) || + (is_real(*type1) && is_real(*type2)), + "ASR Verify: Arguments to FloorDiv must be of real, integer or unsigned integer type", + x.base.base.loc, diagnostics); + } + + static ASR::expr_t *eval_FloorDiv(Allocator &al, const Location &loc, + ASR::ttype_t* t1, Vec &args) { + bool is_real1 = is_real(*ASRUtils::expr_type(args[0])); + bool is_real2 = is_real(*ASRUtils::expr_type(args[1])); + bool is_int1 = is_integer(*ASRUtils::expr_type(args[0])); + bool is_int2 = is_integer(*ASRUtils::expr_type(args[1])); + bool is_unsigned_int1 = is_unsigned_integer(*ASRUtils::expr_type(args[0])); + bool is_unsigned_int2 = is_unsigned_integer(*ASRUtils::expr_type(args[1])); + + if (is_int1 && is_int2) { + int64_t a = ASR::down_cast(args[0])->m_n; + int64_t b = ASR::down_cast(args[1])->m_n; + return make_ConstantWithType(make_IntegerConstant_t, a / b, t1, loc); + } else if (is_unsigned_int1 && is_unsigned_int2) { + int64_t a = ASR::down_cast(args[0])->m_n; + int64_t b = ASR::down_cast(args[1])->m_n; + return make_ConstantWithType(make_UnsignedIntegerConstant_t, a / b, t1, loc); + } else if (is_real1 && is_real2) { + double a = ASR::down_cast(args[0])->m_r; + double b = ASR::down_cast(args[1])->m_r; + double r = a / b; + int64_t result = (int64_t)r; + if ( r >= 0.0 || (double)result == r) { + return make_ConstantWithType(make_RealConstant_t, (double)result, t1, loc); + } + return make_ConstantWithType(make_RealConstant_t, (double)(result - 1), t1, loc); + } + return nullptr; + } + + static inline ASR::asr_t* create_FloorDiv(Allocator& al, const Location& loc, + Vec& args, + const std::function err) { + if (args.size() != 2) { + err("Intrinsic FloorDiv function accepts exactly 2 arguments", loc); + } + ASR::ttype_t *type1 = ASRUtils::expr_type(args[0]); + ASR::ttype_t *type2 = ASRUtils::expr_type(args[1]); + if (!((ASRUtils::is_integer(*type1) && ASRUtils::is_integer(*type2)) || + (ASRUtils::is_unsigned_integer(*type1) && ASRUtils::is_unsigned_integer(*type2)) || + (ASRUtils::is_real(*type1) && ASRUtils::is_real(*type2)))) { + err("Argument of the FloorDiv function must be either Real, Integer or Unsigned Integer", + args[0]->base.loc); + } + ASR::expr_t *m_value = nullptr; + if (all_args_evaluated(args)) { + Vec arg_values; arg_values.reserve(al, 2); + arg_values.push_back(al, expr_value(args[0])); + arg_values.push_back(al, expr_value(args[1])); + m_value = eval_FloorDiv(al, loc, expr_type(args[1]), arg_values); + } + return ASR::make_IntrinsicScalarFunction_t(al, loc, + static_cast(IntrinsicScalarFunctions::FloorDiv), + args.p, args.n, 0, ASRUtils::expr_type(args[0]), m_value); + } + + static inline ASR::expr_t* instantiate_FloorDiv(Allocator &al, const Location &loc, + SymbolTable *scope, Vec& arg_types, ASR::ttype_t *return_type, + Vec& new_args, int64_t /*overload_id*/) { + declare_basic_variables("_lcompilers_optimization_floordiv_" + type_to_str_python(arg_types[1])); + fill_func_arg("a", arg_types[0]); + fill_func_arg("b", arg_types[1]); + auto r = declare("r", real64, Local); + auto tmp = declare("tmp", int64, Local); + auto result = declare("result", return_type, ReturnVar); + /* + @overload + def _lpython_floordiv(a: i32, b: i32) -> i32: + r: f64 # f32 rounds things up and gives incorrect tmps + tmp: i64 + result: i32 + r = float(a)/float(b) + tmp = i64(r) + if r < 0.0 and f64(tmp) != r: + tmp = tmp - 1 + result = i32(tmp) + return result + */ + + ASR::expr_t *op1 = r64Div(CastingUtil::perform_casting(args[0], arg_types[0], real64, al, loc), + CastingUtil::perform_casting(args[1], arg_types[1], real64, al, loc)); + body.push_back(al, b.Assignment(r, op1)); + body.push_back(al, b.Assignment(tmp, r2i64(r))); + body.push_back(al, b.If(And(fLt(r, f(0.0, real64)), fNotEq(i2r64(tmp), r)), { + b.Assignment(tmp, i64Sub(tmp, i(1, int64))) + }, {})); + body.push_back(al, b.Assignment(result, CastingUtil::perform_casting(tmp, int64, return_type, al, loc))); + ASR::symbol_t *f_sym = make_ASR_Function_t(fn_name, fn_symtab, dep, args, + body, result, ASR::abiType::Source, ASR::deftypeType::Implementation, nullptr); + scope->add_symbol(fn_name, f_sym); + return b.Call(f_sym, new_args, return_type, nullptr); + } + +} // namespace FloorDiv + #define create_exp_macro(X, stdeval) \ namespace X { \ static inline ASR::expr_t* eval_##X(Allocator &al, const Location &loc, \ @@ -3047,6 +3165,8 @@ namespace IntrinsicScalarFunctionRegistry { {&FMA::instantiate_FMA, &FMA::verify_args}}, {static_cast(IntrinsicScalarFunctions::FlipSign), {&FlipSign::instantiate_FlipSign, &FlipSign::verify_args}}, + {static_cast(IntrinsicScalarFunctions::FloorDiv), + {&FloorDiv::instantiate_FloorDiv, &FloorDiv::verify_args}}, {static_cast(IntrinsicScalarFunctions::Abs), {&Abs::instantiate_Abs, &Abs::verify_args}}, {static_cast(IntrinsicScalarFunctions::Partition), @@ -3151,6 +3271,8 @@ namespace IntrinsicScalarFunctionRegistry { "fma"}, {static_cast(IntrinsicScalarFunctions::FlipSign), "flipsign"}, + {static_cast(IntrinsicScalarFunctions::FloorDiv), + "floordiv"}, {static_cast(IntrinsicScalarFunctions::Expm1), "expm1"}, {static_cast(IntrinsicScalarFunctions::ListIndex), @@ -3237,6 +3359,7 @@ namespace IntrinsicScalarFunctionRegistry { {"exp2", {&Exp2::create_Exp2, &Exp2::eval_Exp2}}, {"expm1", {&Expm1::create_Expm1, &Expm1::eval_Expm1}}, {"fma", {&FMA::create_FMA, &FMA::eval_FMA}}, + {"floordiv", {&FloorDiv::create_FloorDiv, &FloorDiv::eval_FloorDiv}}, {"list.index", {&ListIndex::create_ListIndex, &ListIndex::eval_list_index}}, {"list.reverse", {&ListReverse::create_ListReverse, &ListReverse::eval_list_reverse}}, {"list.pop", {&ListPop::create_ListPop, &ListPop::eval_list_pop}}, diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index a796a629bd..7762340177 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -3387,7 +3387,7 @@ class CommonVisitor : public AST::BaseVisitor { case (AST::operatorType::Sub) : { op = ASR::binopType::Sub; break; } case (AST::operatorType::Mult) : { op = ASR::binopType::Mul; break; } case (AST::operatorType::Div) : { op = ASR::binopType::Div; break; } - case (AST::operatorType::FloorDiv) : {op = ASR::binopType::Div; break;} + case (AST::operatorType::FloorDiv) : {op_name = "floordiv"; break;} case (AST::operatorType::Pow) : { op = ASR::binopType::Pow; break; } case (AST::operatorType::BitOr) : { op = ASR::binopType::BitOr; break; } case (AST::operatorType::BitAnd) : { op = ASR::binopType::BitAnd; break; } @@ -3403,7 +3403,20 @@ class CommonVisitor : public AST::BaseVisitor { cast_helper(left, right, false); - if (op_name != "") { + if (op_name == "floordiv") { + Vec args; + args.reserve(al, 2); + args.push_back(al, left); + args.push_back(al, right); + ASRUtils::create_intrinsic_function create_func = + ASRUtils::IntrinsicScalarFunctionRegistry::get_create_function(op_name); + tmp = create_func(al, x.base.base.loc, args, + [&](const std::string &msg, const Location &loc) { + throw SemanticError(msg, loc); }); + return; + } + + if (op_name == "_mod") { Vec args; args.reserve(al, 2); ASR::call_arg_t arg1, arg2; From cdd6a8b477eb4c66182277846f20e532258151fe Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 18:27:00 +0530 Subject: [PATCH 03/12] Also support logical types in floordiv --- src/libasr/pass/intrinsic_function_registry.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/libasr/pass/intrinsic_function_registry.h b/src/libasr/pass/intrinsic_function_registry.h index c83b0168b3..4f861ebb8e 100644 --- a/src/libasr/pass/intrinsic_function_registry.h +++ b/src/libasr/pass/intrinsic_function_registry.h @@ -1982,8 +1982,9 @@ namespace FloorDiv { ASR::ttype_t *type2 = ASRUtils::expr_type(x.m_args[1]); ASRUtils::require_impl((is_integer(*type1) && is_integer(*type2)) || (is_unsigned_integer(*type1) && is_unsigned_integer(*type2)) || - (is_real(*type1) && is_real(*type2)), - "ASR Verify: Arguments to FloorDiv must be of real, integer or unsigned integer type", + (is_real(*type1) && is_real(*type2)) || + (is_logical(*type1) && is_logical(*type2)), + "ASR Verify: Arguments to FloorDiv must be of real, integer, unsigned integer or logical type", x.base.base.loc, diagnostics); } @@ -1995,6 +1996,8 @@ namespace FloorDiv { bool is_int2 = is_integer(*ASRUtils::expr_type(args[1])); bool is_unsigned_int1 = is_unsigned_integer(*ASRUtils::expr_type(args[0])); bool is_unsigned_int2 = is_unsigned_integer(*ASRUtils::expr_type(args[1])); + bool is_logical1 = is_logical(*ASRUtils::expr_type(args[0])); + bool is_logical2 = is_logical(*ASRUtils::expr_type(args[1])); if (is_int1 && is_int2) { int64_t a = ASR::down_cast(args[0])->m_n; @@ -2004,6 +2007,10 @@ namespace FloorDiv { int64_t a = ASR::down_cast(args[0])->m_n; int64_t b = ASR::down_cast(args[1])->m_n; return make_ConstantWithType(make_UnsignedIntegerConstant_t, a / b, t1, loc); + } else if (is_logical1 && is_logical2) { + bool a = ASR::down_cast(args[0])->m_value; + bool b = ASR::down_cast(args[1])->m_value; + return make_ConstantWithType(make_LogicalConstant_t, a / b, t1, loc); } else if (is_real1 && is_real2) { double a = ASR::down_cast(args[0])->m_r; double b = ASR::down_cast(args[1])->m_r; @@ -2027,8 +2034,9 @@ namespace FloorDiv { ASR::ttype_t *type2 = ASRUtils::expr_type(args[1]); if (!((ASRUtils::is_integer(*type1) && ASRUtils::is_integer(*type2)) || (ASRUtils::is_unsigned_integer(*type1) && ASRUtils::is_unsigned_integer(*type2)) || - (ASRUtils::is_real(*type1) && ASRUtils::is_real(*type2)))) { - err("Argument of the FloorDiv function must be either Real, Integer or Unsigned Integer", + (ASRUtils::is_real(*type1) && ASRUtils::is_real(*type2)) || + (ASRUtils::is_logical(*type1) && ASRUtils::is_logical(*type2)))) { + err("Argument of the FloorDiv function must be either Real, Integer, Unsigned Integer or Logical", args[0]->base.loc); } ASR::expr_t *m_value = nullptr; From 937726fe716b8f552fa7793f0c315097b053d68c Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 18:41:27 +0530 Subject: [PATCH 04/12] Also support constant variables in floordiv --- src/libasr/pass/intrinsic_function_registry.h | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/libasr/pass/intrinsic_function_registry.h b/src/libasr/pass/intrinsic_function_registry.h index 4f861ebb8e..5e852be01b 100644 --- a/src/libasr/pass/intrinsic_function_registry.h +++ b/src/libasr/pass/intrinsic_function_registry.h @@ -1980,6 +1980,8 @@ namespace FloorDiv { x.base.base.loc, diagnostics); ASR::ttype_t *type1 = ASRUtils::expr_type(x.m_args[0]); ASR::ttype_t *type2 = ASRUtils::expr_type(x.m_args[1]); + type1 = ASRUtils::type_get_past_const(type1); + type2 = ASRUtils::type_get_past_const(type2); ASRUtils::require_impl((is_integer(*type1) && is_integer(*type2)) || (is_unsigned_integer(*type1) && is_unsigned_integer(*type2)) || (is_real(*type1) && is_real(*type2)) || @@ -1990,14 +1992,18 @@ namespace FloorDiv { static ASR::expr_t *eval_FloorDiv(Allocator &al, const Location &loc, ASR::ttype_t* t1, Vec &args) { - bool is_real1 = is_real(*ASRUtils::expr_type(args[0])); - bool is_real2 = is_real(*ASRUtils::expr_type(args[1])); - bool is_int1 = is_integer(*ASRUtils::expr_type(args[0])); - bool is_int2 = is_integer(*ASRUtils::expr_type(args[1])); - bool is_unsigned_int1 = is_unsigned_integer(*ASRUtils::expr_type(args[0])); - bool is_unsigned_int2 = is_unsigned_integer(*ASRUtils::expr_type(args[1])); - bool is_logical1 = is_logical(*ASRUtils::expr_type(args[0])); - bool is_logical2 = is_logical(*ASRUtils::expr_type(args[1])); + ASR::ttype_t *type1 = ASRUtils::expr_type(args[0]); + ASR::ttype_t *type2 = ASRUtils::expr_type(args[1]); + type1 = ASRUtils::type_get_past_const(type1); + type2 = ASRUtils::type_get_past_const(type2); + bool is_real1 = is_real(*type1); + bool is_real2 = is_real(*type2); + bool is_int1 = is_integer(*type1); + bool is_int2 = is_integer(*type2); + bool is_unsigned_int1 = is_unsigned_integer(*type1); + bool is_unsigned_int2 = is_unsigned_integer(*type2); + bool is_logical1 = is_logical(*type1); + bool is_logical2 = is_logical(*type2); if (is_int1 && is_int2) { int64_t a = ASR::down_cast(args[0])->m_n; @@ -2032,6 +2038,8 @@ namespace FloorDiv { } ASR::ttype_t *type1 = ASRUtils::expr_type(args[0]); ASR::ttype_t *type2 = ASRUtils::expr_type(args[1]); + type1 = ASRUtils::type_get_past_const(type1); + type2 = ASRUtils::type_get_past_const(type2); if (!((ASRUtils::is_integer(*type1) && ASRUtils::is_integer(*type2)) || (ASRUtils::is_unsigned_integer(*type1) && ASRUtils::is_unsigned_integer(*type2)) || (ASRUtils::is_real(*type1) && ASRUtils::is_real(*type2)) || From f402c5e9b03980bb7409290c13b1317a9f992b73 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 21:00:39 +0530 Subject: [PATCH 05/12] Support throw error for div by 0 --- src/libasr/pass/intrinsic_function_registry.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libasr/pass/intrinsic_function_registry.h b/src/libasr/pass/intrinsic_function_registry.h index 5e852be01b..4878d242f5 100644 --- a/src/libasr/pass/intrinsic_function_registry.h +++ b/src/libasr/pass/intrinsic_function_registry.h @@ -2048,6 +2048,12 @@ namespace FloorDiv { args[0]->base.loc); } ASR::expr_t *m_value = nullptr; + double compile_time_arg2_val; + if (ASRUtils::extract_value(expr_value(args[1]), compile_time_arg2_val)) { + if (compile_time_arg2_val == 0.0) { + err("Division by 0 is not allowed", args[1]->base.loc); + } + } if (all_args_evaluated(args)) { Vec arg_values; arg_values.reserve(al, 2); arg_values.push_back(al, expr_value(args[0])); From 18a2deab079d6fef504f61415a0ea92f982138c7 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 21:18:30 +0530 Subject: [PATCH 06/12] CPP: Support floordiv intrinsic function --- src/libasr/codegen/asr_to_c_cpp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libasr/codegen/asr_to_c_cpp.h b/src/libasr/codegen/asr_to_c_cpp.h index f0648b5959..db43a98175 100644 --- a/src/libasr/codegen/asr_to_c_cpp.h +++ b/src/libasr/codegen/asr_to_c_cpp.h @@ -2800,6 +2800,7 @@ PyMODINIT_FUNC PyInit_lpython_module_)" + fn_name + R"((void) { SET_INTRINSIC_NAME(Expm1, "expm1"); SET_INTRINSIC_NAME(Trunc, "trunc"); SET_INTRINSIC_NAME(Fix, "fix"); + SET_INTRINSIC_NAME(FloorDiv, "floordiv"); default : { throw LCompilersException("IntrinsicScalarFunction: `" + ASRUtils::get_intrinsic_name(x.m_intrinsic_id) From 2ecb309a1af31072749d46785b1d6917a705d72e Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 18:43:10 +0530 Subject: [PATCH 07/12] Remove _lpython_floordiv() from lpython_builtin.py --- src/runtime/lpython_builtin.py | 127 ++++++--------------------------- 1 file changed, 20 insertions(+), 107 deletions(-) diff --git a/src/runtime/lpython_builtin.py b/src/runtime/lpython_builtin.py index bf57108f50..a2faeb8ef1 100644 --- a/src/runtime/lpython_builtin.py +++ b/src/runtime/lpython_builtin.py @@ -206,13 +206,13 @@ def bin(n: i32) -> str: prep = '-0b' res: str res = '' - if (n_ - _lpython_floordiv(n_, 2)*2) == 0: + if (n_ - (n_ // 2)*2) == 0: res += '0' else: res += '1' while n_ > 1: - n_ = _lpython_floordiv(n_, 2) - if (n_ - _lpython_floordiv(n_, 2)*2) == 0: + n_ = (n_ // 2) + if (n_ - (n_ // 2)*2) == 0: res += '0' else: res += '1' @@ -239,9 +239,9 @@ def hex(n: i32) -> str: res = "" remainder: i32 while n_ > 0: - remainder = n_ - _lpython_floordiv(n_, 16)*16 + remainder = n_ - (n_ // 16)*16 n_ -= remainder - n_ = _lpython_floordiv(n_, 16) + n_ = (n_ // 16) res += hex_values[remainder] return prep + res[::-1] @@ -266,9 +266,9 @@ def oct(n: i32) -> str: res = "" remainder: i32 while n_ > 0: - remainder = n_ - _lpython_floordiv(n_, 8)*8 + remainder = n_ - (n_ // 8)*8 n_ -= remainder - n_ = _lpython_floordiv(n_, 8) + n_ = (n_ // 8) res += _values[remainder] return prep + res[::-1] @@ -289,7 +289,7 @@ def round(value: f64) -> i32: elif f > 0.5: return i + 1 else: - if i - _lpython_floordiv(i, 2) * 2 == 0: + if i - (i // 2) * 2 == 0: return i else: return i + 1 @@ -305,7 +305,7 @@ def round(value: f32) -> i32: elif f > 0.5: return i + 1 else: - if i - _lpython_floordiv(i, 2) * 2 == 0: + if i - (i // 2) * 2 == 0: return i else: return i + 1 @@ -423,7 +423,7 @@ def divmod(x: i32, y: i32) -> tuple[i32, i32]: if y == 0: raise ZeroDivisionError("Integer division or modulo by zero not possible") t: tuple[i32, i32] - t = (_lpython_floordiv(x, y), _mod(x, y)) + t = ((x // y), _mod(x, y)) return t @@ -452,132 +452,45 @@ def _lpython_imag(x: c32) -> f32: return _lfortran_caimag(x) -@overload -def _lpython_floordiv(a: f64, b: f64) -> f64: - r: f64 - r = a/b - result: i64 - result = int(r) - if r >= 0.0 or f64(result) == r: - return float(result) - return float(result - i64(1)) - - -@overload -def _lpython_floordiv(a: f32, b: f32) -> f32: - r: f64 - r = float(a)/float(b) - result: i32 - resultf32: f32 - result = i32(r) - if r >= 0.0 or f64(result) == r: - resultf32 = f32(1.0) * f32(result) - else: - resultf32 = f32(1.0) * f32(result) - f32(1.0) - return resultf32 - -@overload -def _lpython_floordiv(a: i8, b: i8) -> i8: - r: f64 # f32 rounds things up and gives incorrect results - r = float(a)/float(b) - result: i8 - result = i8(r) - if r >= 0.0 or f64(result) == r: - return result - return result - i8(1) - -@overload -def _lpython_floordiv(a: u8, b: u8) -> u8: - return u8(_lpython_floordiv(i8(a), i8(b))) - -@overload -def _lpython_floordiv(a: i16, b: i16) -> i16: - r: f64 # f32 rounds things up and gives incorrect results - r = float(a)/float(b) - result: i16 - result = i16(r) - if r >= 0.0 or f64(result) == r: - return result - return result - i16(1) - -@overload -def _lpython_floordiv(a: u16, b: u16) -> u16: - return u16(_lpython_floordiv(i16(a), i16(b))) - -@overload -def _lpython_floordiv(a: i32, b: i32) -> i32: - r: f64 # f32 rounds things up and gives incorrect results - r = float(a)/float(b) - result: i32 - result = i32(r) - if r >= 0.0 or f64(result) == r: - return result - return result - 1 - -@overload -def _lpython_floordiv(a: u32, b: u32) -> u32: - return u32(_lpython_floordiv(i32(a), i32(b))) - -@overload -def _lpython_floordiv(a: i64, b: i64) -> i64: - r: f64 - r = a/b - result: i64 - result = int(r) - if r >= 0.0 or f64(result) == r: - return result - return result - i64(1) - -@overload -def _lpython_floordiv(a: u64, b: u64) -> u64: - return u64(_lpython_floordiv(i64(a), i64(b))) - -@overload -def _lpython_floordiv(a: bool, b: bool) -> bool: - if b == False: - raise ValueError('Denominator cannot be False or 0.') - return a - - @overload def _mod(a: i8, b: i8) -> i8: - return a - _lpython_floordiv(a, b)*b + return a - (a // b)*b @overload def _mod(a: i16, b: i16) -> i16: - return a - _lpython_floordiv(a, b)*b + return a - (a // b)*b @overload def _mod(a: i32, b: i32) -> i32: - return a - _lpython_floordiv(a, b)*b + return a - (a // b)*b @overload def _mod(a: u8, b: u8) -> u8: - return a - _lpython_floordiv(a, b)*b + return a - (a // b)*b @overload def _mod(a: u16, b: u16) -> u16: - return a - _lpython_floordiv(a, b)*b + return a - (a // b)*b @overload def _mod(a: u32, b: u32) -> u32: - return a - _lpython_floordiv(a, b)*b + return a - (a // b)*b @overload def _mod(a: f32, b: f32) -> f32: - return a - _lpython_floordiv(a, b)*b + return a - (a // b)*b @overload def _mod(a: u64, b: u64) -> u64: - return a - _lpython_floordiv(a, b)*b + return a - (a // b)*b @overload def _mod(a: i64, b: i64) -> i64: - return a - _lpython_floordiv(a, b)*b + return a - (a // b)*b @overload def _mod(a: f64, b: f64) -> f64: - return a - _lpython_floordiv(a, b)*b + return a - (a // b)*b @overload From 693b7efd697286e63fd33e9734ea55cad61a8a87 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 21:06:11 +0530 Subject: [PATCH 08/12] Remove floordiv support from AST->ASR --- src/lpython/semantics/python_ast_to_asr.cpp | 167 +++++++------------- 1 file changed, 53 insertions(+), 114 deletions(-) diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 7762340177..272d5a1c2c 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -1905,7 +1905,7 @@ class CommonVisitor : public AST::BaseVisitor { } void make_BinOp_helper(ASR::expr_t *left, ASR::expr_t *right, - ASR::binopType op, const Location &loc, bool floordiv) { + ASR::binopType op, const Location &loc) { ASR::ttype_t *left_type = ASRUtils::expr_type(left); ASR::ttype_t *right_type = ASRUtils::expr_type(right); if( ASR::is_a(*left_type) ) { @@ -1946,120 +1946,60 @@ class CommonVisitor : public AST::BaseVisitor { ); throw SemanticAbort(); } - // Floor div operation in python using (`//`) - if (floordiv) { - bool both_int = (ASRUtils::is_integer(*left_type) && ASRUtils::is_integer(*right_type)); - if (both_int) { - cast_helper(left, right, false); - dest_type = ASRUtils::expr_type(left); - } else { + ASR::ttype_t* left_type = ASRUtils::expr_type(left); + ASR::ttype_t* right_type = ASRUtils::expr_type(right); + ASR::dimension_t *m_dims_left = nullptr, *m_dims_right = nullptr; + int n_dims_left = ASRUtils::extract_dimensions_from_ttype(left_type, m_dims_left); + int n_dims_right = ASRUtils::extract_dimensions_from_ttype(right_type, m_dims_right); + if( n_dims_left == 0 && n_dims_right == 0 ) { + int left_type_priority = CastingUtil::get_type_priority(left_type->type); + int right_type_priority = CastingUtil::get_type_priority(right_type->type); + int left_kind = ASRUtils::extract_kind_from_ttype_t(left_type); + int right_kind = ASRUtils::extract_kind_from_ttype_t(right_type); + bool is_left_f32 = ASR::is_a(*left_type) && left_kind == 4; + bool is_right_f32 = ASR::is_a(*right_type) && right_kind == 4; + if( (left_type_priority >= right_type_priority && is_left_f32) || + (right_type_priority >= left_type_priority && is_right_f32) ) { + dest_type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 4)); + } else if( left_type_priority <= CastingUtil::get_type_priority(ASR::ttypeType::Real) && + right_type_priority <= CastingUtil::get_type_priority(ASR::ttypeType::Real)) { dest_type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 8)); - if (ASRUtils::is_integer(*left_type)) { - left = ASR::down_cast(ASRUtils::make_Cast_t_value( - al, left->base.loc, left, ASR::cast_kindType::IntegerToReal, dest_type)); - } - if (ASRUtils::is_integer(*right_type)) { - right = ASR::down_cast(ASRUtils::make_Cast_t_value( - al, right->base.loc, right, ASR::cast_kindType::IntegerToReal, dest_type)); - } - cast_helper(left, right, false); - dest_type = ASRUtils::expr_type(left); - } - if (ASRUtils::expr_value(right) != nullptr) { - if (ASRUtils::is_integer(*right_type)) { - int8_t value = ASR::down_cast(ASRUtils::expr_value(right))->m_n; - if (value == 0) { - diag.add(diag::Diagnostic( - "integer division by zero is not allowed", - diag::Level::Error, diag::Stage::Semantic, { - diag::Label("integer division by zero", - {right->base.loc}) - }) - ); - throw SemanticAbort(); - } - } else if (ASRUtils::is_real(*right_type)) { - double value = ASR::down_cast(ASRUtils::expr_value(right))->m_r; - if (value == 0.0) { - diag.add(diag::Diagnostic( - "float floor division by zero is not allowed", - diag::Level::Error, diag::Stage::Semantic, { - diag::Label("float floor division by zero", - {right->base.loc}) - }) - ); - throw SemanticAbort(); - } - } - } - ASR::symbol_t *fn_div = resolve_intrinsic_function(loc, "_lpython_floordiv"); - Vec args; - args.reserve(al, 2); - ASR::call_arg_t arg1, arg2; - arg1.loc = left->base.loc; - arg2.loc = right->base.loc; - arg1.m_value = left; - arg2.m_value = right; - args.push_back(al, arg1); - args.push_back(al, arg2); - tmp = make_call_helper(al, fn_div, current_scope, args, "_lpython_floordiv", loc); - return; - } else { // real division in python using (`/`) - ASR::ttype_t* left_type = ASRUtils::expr_type(left); - ASR::ttype_t* right_type = ASRUtils::expr_type(right); - ASR::dimension_t *m_dims_left = nullptr, *m_dims_right = nullptr; - int n_dims_left = ASRUtils::extract_dimensions_from_ttype(left_type, m_dims_left); - int n_dims_right = ASRUtils::extract_dimensions_from_ttype(right_type, m_dims_right); - if( n_dims_left == 0 && n_dims_right == 0 ) { - int left_type_priority = CastingUtil::get_type_priority(left_type->type); - int right_type_priority = CastingUtil::get_type_priority(right_type->type); - int left_kind = ASRUtils::extract_kind_from_ttype_t(left_type); - int right_kind = ASRUtils::extract_kind_from_ttype_t(right_type); - bool is_left_f32 = ASR::is_a(*left_type) && left_kind == 4; - bool is_right_f32 = ASR::is_a(*right_type) && right_kind == 4; - if( (left_type_priority >= right_type_priority && is_left_f32) || - (right_type_priority >= left_type_priority && is_right_f32) ) { - dest_type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 4)); - } else if( left_type_priority <= CastingUtil::get_type_priority(ASR::ttypeType::Real) && - right_type_priority <= CastingUtil::get_type_priority(ASR::ttypeType::Real)) { - dest_type = ASRUtils::TYPE(ASR::make_Real_t(al, loc, 8)); + } else { + if( left_type_priority > right_type_priority ) { + dest_type = ASRUtils::duplicate_type_without_dims(al, left_type, loc); + } else if( left_type_priority < right_type_priority ) { + dest_type = ASRUtils::duplicate_type_without_dims(al, right_type, loc); } else { - if( left_type_priority > right_type_priority ) { + if( left_kind >= right_kind ) { dest_type = ASRUtils::duplicate_type_without_dims(al, left_type, loc); - } else if( left_type_priority < right_type_priority ) { - dest_type = ASRUtils::duplicate_type_without_dims(al, right_type, loc); } else { - if( left_kind >= right_kind ) { - dest_type = ASRUtils::duplicate_type_without_dims(al, left_type, loc); - } else { - dest_type = ASRUtils::duplicate_type_without_dims(al, right_type, loc); - } + dest_type = ASRUtils::duplicate_type_without_dims(al, right_type, loc); } } - cast_helper(dest_type, left, left->base.loc, true); - double val = -1.0; - if (ASRUtils::extract_value(ASRUtils::expr_value(right), val) && - val == 0.0) { - diag.add(diag::Diagnostic( - "division by zero is not allowed", - diag::Level::Error, diag::Stage::Semantic, { - diag::Label("division by zero", - {right->base.loc}) - }) - ); - throw SemanticAbort(); - } - cast_helper(dest_type, right, right->base.loc, true); + } + cast_helper(dest_type, left, left->base.loc, true); + double val = -1.0; + if (ASRUtils::extract_value(ASRUtils::expr_value(right), val) && + val == 0.0) { + diag.add(diag::Diagnostic( + "division by zero is not allowed", + diag::Level::Error, diag::Stage::Semantic, { + diag::Label("division by zero", + {right->base.loc}) + }) + ); + throw SemanticAbort(); + } + cast_helper(dest_type, right, right->base.loc, true); + } else { + if( n_dims_left != 0 && n_dims_right != 0 ) { + LCOMPILERS_ASSERT(n_dims_left == n_dims_right); + dest_type = left_type; } else { - if( n_dims_left != 0 && n_dims_right != 0 ) { - LCOMPILERS_ASSERT(n_dims_left == n_dims_right); + if( n_dims_left > 0 ) { dest_type = left_type; } else { - if( n_dims_left > 0 ) { - dest_type = left_type; - } else { - dest_type = right_type; - } + dest_type = right_type; } } } @@ -3430,8 +3370,7 @@ class CommonVisitor : public AST::BaseVisitor { tmp = make_call_helper(al, fn_mod, current_scope, args, op_name, x.base.base.loc); return; } - bool floordiv = (x.m_op == AST::operatorType::FloorDiv); - make_BinOp_helper(left, right, op, x.base.base.loc, floordiv); + make_BinOp_helper(left, right, op, x.base.base.loc); } void visit_UnaryOp(const AST::UnaryOp_t &x) { @@ -5342,7 +5281,7 @@ class BodyVisitor : public CommonVisitor { offset_op = ASR::binopType::Sub; } make_BinOp_helper(loop_end, constant_one, - offset_op, loc, false); + offset_op, loc); } else { ASR::ttype_t* logical_type = ASRUtils::TYPE(ASR::make_Logical_t(al, inc->base.loc, 4)); ASR::expr_t* inc_pos = ASRUtils::EXPR(ASR::make_IntegerCompare_t(al, inc->base.loc, inc, @@ -5351,13 +5290,13 @@ class BodyVisitor : public CommonVisitor { ASR::cmpopType::Lt, constant_zero, logical_type, nullptr)); cast_helper(a_type, inc_pos, inc->base.loc, true); cast_helper(a_type, inc_neg, inc->base.loc, true); - make_BinOp_helper(inc_pos, constant_neg_one, ASR::binopType::Mul, inc->base.loc, false); + make_BinOp_helper(inc_pos, constant_neg_one, ASR::binopType::Mul, inc->base.loc); ASR::expr_t* case_1 = ASRUtils::EXPR(tmp); - make_BinOp_helper(inc_neg, constant_one, ASR::binopType::Mul, inc->base.loc, false); + make_BinOp_helper(inc_neg, constant_one, ASR::binopType::Mul, inc->base.loc); ASR::expr_t* case_2 = ASRUtils::EXPR(tmp); - make_BinOp_helper(case_1, case_2, ASR::binopType::Add, inc->base.loc, false); + make_BinOp_helper(case_1, case_2, ASR::binopType::Add, inc->base.loc); ASR::expr_t* cases_combined = ASRUtils::EXPR(tmp); - make_BinOp_helper(loop_end, cases_combined, ASR::binopType::Add, loop_end->base.loc, false); + make_BinOp_helper(loop_end, cases_combined, ASR::binopType::Add, loop_end->base.loc); } head.m_end = ASRUtils::EXPR(tmp); @@ -5621,7 +5560,7 @@ class BodyVisitor : public CommonVisitor { ASR::symbol_t *fn_mod = resolve_intrinsic_function(x.base.base.loc, op_name); tmp = make_call_helper(al, fn_mod, current_scope, args, op_name, x.base.base.loc); } else { - make_BinOp_helper(left, right, op, x.base.base.loc, false); + make_BinOp_helper(left, right, op, x.base.base.loc); } ASR::stmt_t* a_overloaded = nullptr; From 665badeb77d04a7ff5ee0f0816e3f8cea7c9788e Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 21:11:41 +0530 Subject: [PATCH 09/12] TEST: Update reference tests --- .../reference/asr-array_01_decl-39cf894.json | 2 +- .../asr-array_01_decl-39cf894.stdout | 134 +- .../reference/asr-array_02_decl-e8f6874.json | 2 +- .../asr-array_02_decl-e8f6874.stdout | 98 +- tests/reference/asr-bindc_02-bc1a7ea.json | 2 +- tests/reference/asr-bindc_02-bc1a7ea.stdout | 48 +- tests/reference/asr-cast-435c233.json | 2 +- tests/reference/asr-cast-435c233.stdout | 8 +- tests/reference/asr-complex1-f26c460.json | 2 +- tests/reference/asr-complex1-f26c460.stdout | 2 +- tests/reference/asr-constants1-5828e8a.json | 2 +- tests/reference/asr-constants1-5828e8a.stdout | 2 +- tests/reference/asr-elemental_01-b58df26.json | 2 +- .../reference/asr-elemental_01-b58df26.stdout | 574 ++++---- tests/reference/asr-expr10-efcbb1b.json | 2 +- tests/reference/asr-expr10-efcbb1b.stdout | 2 +- tests/reference/asr-expr13-81bdb5a.json | 2 +- tests/reference/asr-expr13-81bdb5a.stdout | 2 +- tests/reference/asr-expr7-480ba2f.json | 2 +- tests/reference/asr-expr7-480ba2f.stdout | 8 +- tests/reference/asr-expr8-6beda60.json | 2 +- tests/reference/asr-expr8-6beda60.stdout | 39 +- tests/reference/asr-expr_05-3a37324.json | 2 +- tests/reference/asr-expr_05-3a37324.stdout | 42 +- .../asr-generics_array_01-682b1b2.json | 2 +- .../asr-generics_array_01-682b1b2.stdout | 66 +- .../asr-generics_array_02-22c8dc1.json | 2 +- .../asr-generics_array_02-22c8dc1.stdout | 234 ++-- .../asr-generics_array_03-fb3706c.json | 2 +- .../asr-generics_array_03-fb3706c.stdout | 338 ++--- tests/reference/asr-structs_05-fa98307.json | 2 +- tests/reference/asr-structs_05-fa98307.stdout | 280 ++-- .../asr-test_bool_binop-f856ef0.json | 2 +- .../asr-test_bool_binop-f856ef0.stdout | 68 +- .../asr-test_builtin_bin-52ba9fa.json | 2 +- .../asr-test_builtin_bin-52ba9fa.stdout | 8 +- .../asr-test_builtin_bool-330223a.json | 2 +- .../asr-test_builtin_bool-330223a.stdout | 8 +- .../asr-test_builtin_hex-64bd268.json | 2 +- .../asr-test_builtin_hex-64bd268.stdout | 8 +- .../asr-test_builtin_oct-20b9066.json | 2 +- .../asr-test_builtin_oct-20b9066.stdout | 8 +- .../asr-test_builtin_pow-f02fcda.json | 2 +- .../asr-test_builtin_pow-f02fcda.stdout | 8 +- .../asr-test_builtin_round-7417a21.json | 2 +- .../asr-test_builtin_round-7417a21.stdout | 8 +- .../asr-test_complex_01-a6def58.json | 2 +- .../asr-test_complex_01-a6def58.stdout | 8 +- .../asr-test_complex_02-782ba2d.json | 2 +- .../asr-test_complex_02-782ba2d.stdout | 8 +- tests/reference/asr-test_max_min-3c2fc51.json | 2 +- .../reference/asr-test_max_min-3c2fc51.stdout | 8 +- .../reference/asr-test_numpy_03-e600a49.json | 2 +- .../asr-test_numpy_03-e600a49.stdout | 1160 ++++++++--------- .../reference/asr-test_numpy_04-ecbb614.json | 2 +- .../asr-test_numpy_04-ecbb614.stdout | 54 +- tests/reference/asr-test_pow-3f5d550.json | 2 +- tests/reference/asr-test_pow-3f5d550.stdout | 8 +- .../asr-test_zero_division-3dd84e8.json | 2 +- .../asr-test_zero_division-3dd84e8.stderr | 4 +- .../asr-test_zero_division2-d84989f.json | 2 +- .../asr-test_zero_division2-d84989f.stderr | 4 +- tests/reference/asr-vec_01-66ac423.json | 2 +- tests/reference/asr-vec_01-66ac423.stdout | 42 +- tests/reference/c-expr7-bb2692a.json | 2 +- tests/reference/c-expr7-bb2692a.stdout | 300 +++++ tests/reference/cpp-expr8-704cece.json | 2 +- tests/reference/cpp-expr8-704cece.stdout | 6 - .../cpp-test_builtin_pow-56b3f92.json | 2 +- .../cpp-test_builtin_pow-56b3f92.stdout | 36 +- .../pass_loop_vectorise-vec_01-be9985e.json | 2 +- .../pass_loop_vectorise-vec_01-be9985e.stdout | 98 +- 72 files changed, 1930 insertions(+), 1871 deletions(-) diff --git a/tests/reference/asr-array_01_decl-39cf894.json b/tests/reference/asr-array_01_decl-39cf894.json index 74d395c607..ad322439fa 100644 --- a/tests/reference/asr-array_01_decl-39cf894.json +++ b/tests/reference/asr-array_01_decl-39cf894.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-array_01_decl-39cf894.stdout", - "stdout_hash": "f1338c6f6e5f0d9e55addc9bd28498dde023b5870395fd4e097788d2", + "stdout_hash": "24b1d1f4774489a87a82c51c4f4a797ca363f7efdb011e42936fc6b9", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-array_01_decl-39cf894.stdout b/tests/reference/asr-array_01_decl-39cf894.stdout index ceda5a9f38..7afd122ab5 100644 --- a/tests/reference/asr-array_01_decl-39cf894.stdout +++ b/tests/reference/asr-array_01_decl-39cf894.stdout @@ -10,11 +10,11 @@ ArraySizes: (EnumType (SymbolTable - 212 + 201 { SIZE_10: (Variable - 212 + 201 SIZE_10 [] Local @@ -30,7 +30,7 @@ ), SIZE_3: (Variable - 212 + 201 SIZE_3 [] Local @@ -58,7 +58,7 @@ __main__global_stmts: (Function (SymbolTable - 219 + 208 { }) @@ -94,11 +94,11 @@ accept_f32_array: (Function (SymbolTable - 216 + 205 { _lpython_return_variable: (Variable - 216 + 205 _lpython_return_variable [] ReturnVar @@ -114,7 +114,7 @@ ), xf32: (Variable - 216 + 205 xf32 [] InOut @@ -155,10 +155,10 @@ .false. ) [] - [(Var 216 xf32)] + [(Var 205 xf32)] [(= (ArrayItem - (Var 216 xf32) + (Var 205 xf32) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -181,9 +181,9 @@ () ) (= - (Var 216 _lpython_return_variable) + (Var 205 _lpython_return_variable) (ArrayItem - (Var 216 xf32) + (Var 205 xf32) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -194,7 +194,7 @@ () ) (Return)] - (Var 216 _lpython_return_variable) + (Var 205 _lpython_return_variable) Public .false. .false. @@ -203,11 +203,11 @@ accept_f64_array: (Function (SymbolTable - 217 + 206 { _lpython_return_variable: (Variable - 217 + 206 _lpython_return_variable [] ReturnVar @@ -223,7 +223,7 @@ ), xf64: (Variable - 217 + 206 xf64 [] InOut @@ -264,10 +264,10 @@ .false. ) [] - [(Var 217 xf64)] + [(Var 206 xf64)] [(= (ArrayItem - (Var 217 xf64) + (Var 206 xf64) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -282,9 +282,9 @@ () ) (= - (Var 217 _lpython_return_variable) + (Var 206 _lpython_return_variable) (ArrayItem - (Var 217 xf64) + (Var 206 xf64) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -295,7 +295,7 @@ () ) (Return)] - (Var 217 _lpython_return_variable) + (Var 206 _lpython_return_variable) Public .false. .false. @@ -304,11 +304,11 @@ accept_i16_array: (Function (SymbolTable - 213 + 202 { _lpython_return_variable: (Variable - 213 + 202 _lpython_return_variable [] ReturnVar @@ -324,7 +324,7 @@ ), xi16: (Variable - 213 + 202 xi16 [] InOut @@ -365,10 +365,10 @@ .false. ) [] - [(Var 213 xi16)] + [(Var 202 xi16)] [(= (ArrayItem - (Var 213 xi16) + (Var 202 xi16) [(() (IntegerConstant 2 (Integer 4)) ())] @@ -385,9 +385,9 @@ () ) (= - (Var 213 _lpython_return_variable) + (Var 202 _lpython_return_variable) (ArrayItem - (Var 213 xi16) + (Var 202 xi16) [(() (IntegerConstant 2 (Integer 4)) ())] @@ -398,7 +398,7 @@ () ) (Return)] - (Var 213 _lpython_return_variable) + (Var 202 _lpython_return_variable) Public .false. .false. @@ -407,11 +407,11 @@ accept_i32_array: (Function (SymbolTable - 214 + 203 { _lpython_return_variable: (Variable - 214 + 203 _lpython_return_variable [] ReturnVar @@ -427,7 +427,7 @@ ), xi32: (Variable - 214 + 203 xi32 [] InOut @@ -468,10 +468,10 @@ .false. ) [] - [(Var 214 xi32)] + [(Var 203 xi32)] [(= (ArrayItem - (Var 214 xi32) + (Var 203 xi32) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -483,9 +483,9 @@ () ) (= - (Var 214 _lpython_return_variable) + (Var 203 _lpython_return_variable) (ArrayItem - (Var 214 xi32) + (Var 203 xi32) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -496,7 +496,7 @@ () ) (Return)] - (Var 214 _lpython_return_variable) + (Var 203 _lpython_return_variable) Public .false. .false. @@ -505,11 +505,11 @@ accept_i64_array: (Function (SymbolTable - 215 + 204 { _lpython_return_variable: (Variable - 215 + 204 _lpython_return_variable [] ReturnVar @@ -525,7 +525,7 @@ ), xi64: (Variable - 215 + 204 xi64 [] InOut @@ -566,10 +566,10 @@ .false. ) [] - [(Var 215 xi64)] + [(Var 204 xi64)] [(= (ArrayItem - (Var 215 xi64) + (Var 204 xi64) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -586,9 +586,9 @@ () ) (= - (Var 215 _lpython_return_variable) + (Var 204 _lpython_return_variable) (ArrayItem - (Var 215 xi64) + (Var 204 xi64) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -599,7 +599,7 @@ () ) (Return)] - (Var 215 _lpython_return_variable) + (Var 204 _lpython_return_variable) Public .false. .false. @@ -608,11 +608,11 @@ declare_arrays: (Function (SymbolTable - 218 + 207 { ac32: (Variable - 218 + 207 ac32 [] Local @@ -633,7 +633,7 @@ ), ac64: (Variable - 218 + 207 ac64 [] Local @@ -654,7 +654,7 @@ ), af32: (Variable - 218 + 207 af32 [] Local @@ -675,7 +675,7 @@ ), af64: (Variable - 218 + 207 af64 [] Local @@ -696,7 +696,7 @@ ), ai16: (Variable - 218 + 207 ai16 [] Local @@ -717,7 +717,7 @@ ), ai32: (Variable - 218 + 207 ai32 [] Local @@ -738,7 +738,7 @@ ), ai64: (Variable - 218 + 207 ai64 [] Local @@ -780,7 +780,7 @@ accept_f64_array] [] [(= - (Var 218 ai16) + (Var 207 ai16) (ArrayConstant [] (Array @@ -794,7 +794,7 @@ () ) (= - (Var 218 ai32) + (Var 207 ai32) (ArrayConstant [] (Array @@ -808,7 +808,7 @@ () ) (= - (Var 218 ai64) + (Var 207 ai64) (ArrayConstant [] (Array @@ -822,7 +822,7 @@ () ) (= - (Var 218 af32) + (Var 207 af32) (ArrayConstant [] (Array @@ -836,7 +836,7 @@ () ) (= - (Var 218 af64) + (Var 207 af64) (ArrayConstant [] (Array @@ -850,7 +850,7 @@ () ) (= - (Var 218 ac32) + (Var 207 ac32) (ArrayConstant [] (Array @@ -864,7 +864,7 @@ () ) (= - (Var 218 ac64) + (Var 207 ac64) (ArrayConstant [] (Array @@ -883,7 +883,7 @@ 2 accept_i16_array () [((ArrayPhysicalCast - (Var 218 ai16) + (Var 207 ai16) FixedSizeArray DescriptorArray (Array @@ -907,7 +907,7 @@ 2 accept_i32_array () [((ArrayPhysicalCast - (Var 218 ai32) + (Var 207 ai32) FixedSizeArray DescriptorArray (Array @@ -931,7 +931,7 @@ 2 accept_i64_array () [((ArrayPhysicalCast - (Var 218 ai64) + (Var 207 ai64) FixedSizeArray DescriptorArray (Array @@ -955,7 +955,7 @@ 2 accept_f32_array () [((ArrayPhysicalCast - (Var 218 af32) + (Var 207 af32) FixedSizeArray DescriptorArray (Array @@ -979,7 +979,7 @@ 2 accept_f64_array () [((ArrayPhysicalCast - (Var 218 af64) + (Var 207 af64) FixedSizeArray DescriptorArray (Array @@ -1014,11 +1014,11 @@ main_program: (Program (SymbolTable - 220 + 209 { __main__global_stmts: (ExternalSymbol - 220 + 209 __main__global_stmts 2 __main__global_stmts __main__ @@ -1030,7 +1030,7 @@ main_program [__main__] [(SubroutineCall - 220 __main__global_stmts + 209 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-array_02_decl-e8f6874.json b/tests/reference/asr-array_02_decl-e8f6874.json index cc3d019ef4..68dff93169 100644 --- a/tests/reference/asr-array_02_decl-e8f6874.json +++ b/tests/reference/asr-array_02_decl-e8f6874.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-array_02_decl-e8f6874.stdout", - "stdout_hash": "393110b677168be9f169afdfcfa2f8032ad1d43eb58ff3cc903d119b", + "stdout_hash": "a442d1685188ae1ac93a98e1c9d15aa8c9eb53cf7ef9d926911d941c", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-array_02_decl-e8f6874.stdout b/tests/reference/asr-array_02_decl-e8f6874.stdout index 614a55e085..d32364d9da 100644 --- a/tests/reference/asr-array_02_decl-e8f6874.stdout +++ b/tests/reference/asr-array_02_decl-e8f6874.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 217 + 206 { }) @@ -46,11 +46,11 @@ accept_multidim_f32_array: (Function (SymbolTable - 214 + 203 { _lpython_return_variable: (Variable - 214 + 203 _lpython_return_variable [] ReturnVar @@ -66,7 +66,7 @@ ), xf32: (Variable - 214 + 203 xf32 [] InOut @@ -107,11 +107,11 @@ .false. ) [] - [(Var 214 xf32)] + [(Var 203 xf32)] [(= - (Var 214 _lpython_return_variable) + (Var 203 _lpython_return_variable) (ArrayItem - (Var 214 xf32) + (Var 203 xf32) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -122,7 +122,7 @@ () ) (Return)] - (Var 214 _lpython_return_variable) + (Var 203 _lpython_return_variable) Public .false. .false. @@ -131,11 +131,11 @@ accept_multidim_f64_array: (Function (SymbolTable - 215 + 204 { _lpython_return_variable: (Variable - 215 + 204 _lpython_return_variable [] ReturnVar @@ -151,7 +151,7 @@ ), xf64: (Variable - 215 + 204 xf64 [] InOut @@ -196,11 +196,11 @@ .false. ) [] - [(Var 215 xf64)] + [(Var 204 xf64)] [(= - (Var 215 _lpython_return_variable) + (Var 204 _lpython_return_variable) (ArrayItem - (Var 215 xf64) + (Var 204 xf64) [(() (IntegerConstant 0 (Integer 4)) ()) @@ -214,7 +214,7 @@ () ) (Return)] - (Var 215 _lpython_return_variable) + (Var 204 _lpython_return_variable) Public .false. .false. @@ -223,11 +223,11 @@ accept_multidim_i32_array: (Function (SymbolTable - 212 + 201 { _lpython_return_variable: (Variable - 212 + 201 _lpython_return_variable [] ReturnVar @@ -243,7 +243,7 @@ ), xi32: (Variable - 212 + 201 xi32 [] InOut @@ -288,11 +288,11 @@ .false. ) [] - [(Var 212 xi32)] + [(Var 201 xi32)] [(= - (Var 212 _lpython_return_variable) + (Var 201 _lpython_return_variable) (ArrayItem - (Var 212 xi32) + (Var 201 xi32) [(() (IntegerConstant 0 (Integer 4)) ()) @@ -306,7 +306,7 @@ () ) (Return)] - (Var 212 _lpython_return_variable) + (Var 201 _lpython_return_variable) Public .false. .false. @@ -315,11 +315,11 @@ accept_multidim_i64_array: (Function (SymbolTable - 213 + 202 { _lpython_return_variable: (Variable - 213 + 202 _lpython_return_variable [] ReturnVar @@ -335,7 +335,7 @@ ), xi64: (Variable - 213 + 202 xi64 [] InOut @@ -384,11 +384,11 @@ .false. ) [] - [(Var 213 xi64)] + [(Var 202 xi64)] [(= - (Var 213 _lpython_return_variable) + (Var 202 _lpython_return_variable) (ArrayItem - (Var 213 xi64) + (Var 202 xi64) [(() (IntegerConstant 9 (Integer 4)) ()) @@ -405,7 +405,7 @@ () ) (Return)] - (Var 213 _lpython_return_variable) + (Var 202 _lpython_return_variable) Public .false. .false. @@ -414,11 +414,11 @@ declare_arrays: (Function (SymbolTable - 216 + 205 { ac32: (Variable - 216 + 205 ac32 [] Local @@ -443,7 +443,7 @@ ), ac64: (Variable - 216 + 205 ac64 [] Local @@ -470,7 +470,7 @@ ), af32: (Variable - 216 + 205 af32 [] Local @@ -491,7 +491,7 @@ ), af64: (Variable - 216 + 205 af64 [] Local @@ -514,7 +514,7 @@ ), ai32: (Variable - 216 + 205 ai32 [] Local @@ -537,7 +537,7 @@ ), ai64: (Variable - 216 + 205 ai64 [] Local @@ -582,7 +582,7 @@ accept_multidim_f64_array] [] [(= - (Var 216 ai32) + (Var 205 ai32) (ArrayConstant [] (Array @@ -598,7 +598,7 @@ () ) (= - (Var 216 ai64) + (Var 205 ai64) (ArrayConstant [] (Array @@ -616,7 +616,7 @@ () ) (= - (Var 216 af32) + (Var 205 af32) (ArrayConstant [] (Array @@ -630,7 +630,7 @@ () ) (= - (Var 216 af64) + (Var 205 af64) (ArrayConstant [] (Array @@ -646,7 +646,7 @@ () ) (= - (Var 216 ac32) + (Var 205 ac32) (ArrayConstant [] (Array @@ -664,7 +664,7 @@ () ) (= - (Var 216 ac64) + (Var 205 ac64) (ArrayConstant [] (Array @@ -689,7 +689,7 @@ 2 accept_multidim_i32_array () [((ArrayPhysicalCast - (Var 216 ai32) + (Var 205 ai32) FixedSizeArray DescriptorArray (Array @@ -715,7 +715,7 @@ 2 accept_multidim_i64_array () [((ArrayPhysicalCast - (Var 216 ai64) + (Var 205 ai64) FixedSizeArray DescriptorArray (Array @@ -743,7 +743,7 @@ 2 accept_multidim_f32_array () [((ArrayPhysicalCast - (Var 216 af32) + (Var 205 af32) FixedSizeArray DescriptorArray (Array @@ -767,7 +767,7 @@ 2 accept_multidim_f64_array () [((ArrayPhysicalCast - (Var 216 af64) + (Var 205 af64) FixedSizeArray DescriptorArray (Array @@ -804,11 +804,11 @@ main_program: (Program (SymbolTable - 218 + 207 { __main__global_stmts: (ExternalSymbol - 218 + 207 __main__global_stmts 2 __main__global_stmts __main__ @@ -820,7 +820,7 @@ main_program [__main__] [(SubroutineCall - 218 __main__global_stmts + 207 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-bindc_02-bc1a7ea.json b/tests/reference/asr-bindc_02-bc1a7ea.json index f205d08df3..c15e13d718 100644 --- a/tests/reference/asr-bindc_02-bc1a7ea.json +++ b/tests/reference/asr-bindc_02-bc1a7ea.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-bindc_02-bc1a7ea.stdout", - "stdout_hash": "24306e75cc181b95d938b85b3a9ea6aaddc89891924e3482ddcf2284", + "stdout_hash": "01a64e5f6cf42ede674e82e44dae47760b77e108155c498d63ad4638", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-bindc_02-bc1a7ea.stdout b/tests/reference/asr-bindc_02-bc1a7ea.stdout index 84909c1d4e..9a45fc6312 100644 --- a/tests/reference/asr-bindc_02-bc1a7ea.stdout +++ b/tests/reference/asr-bindc_02-bc1a7ea.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 213 + 202 { }) @@ -77,11 +77,11 @@ f: (Function (SymbolTable - 212 + 201 { y: (Variable - 212 + 201 y [] Local @@ -102,7 +102,7 @@ ), yptr1: (Variable - 212 + 201 yptr1 [] Local @@ -125,7 +125,7 @@ ), yq: (Variable - 212 + 201 yq [] Local @@ -158,14 +158,14 @@ [] [] [(= - (Var 212 yq) + (Var 201 yq) (PointerNullConstant (CPtr) ) () ) (= - (Var 212 y) + (Var 201 y) (ArrayConstant [] (Array @@ -180,7 +180,7 @@ ) (= (ArrayItem - (Var 212 y) + (Var 201 y) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -198,7 +198,7 @@ ) (= (ArrayItem - (Var 212 y) + (Var 201 y) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -215,9 +215,9 @@ () ) (= - (Var 212 yptr1) + (Var 201 yptr1) (GetPointer - (Var 212 y) + (Var 201 y) (Pointer (Array (Integer 2) @@ -233,7 +233,7 @@ (Print () [(GetPointer - (Var 212 y) + (Var 201 y) (Pointer (Array (Integer 2) @@ -244,14 +244,14 @@ ) () ) - (Var 212 yptr1)] + (Var 201 yptr1)] () () ) (Print () [(ArrayItem - (Var 212 yptr1) + (Var 201 yptr1) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -260,7 +260,7 @@ () ) (ArrayItem - (Var 212 yptr1) + (Var 201 yptr1) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -274,7 +274,7 @@ (Assert (IntegerCompare (ArrayItem - (Var 212 yptr1) + (Var 201 yptr1) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -297,7 +297,7 @@ (Assert (IntegerCompare (ArrayItem - (Var 212 yptr1) + (Var 201 yptr1) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -318,8 +318,8 @@ () ) (CPtrToPointer - (Var 212 yq) - (Var 212 yptr1) + (Var 201 yq) + (Var 201 yptr1) (ArrayConstant [(IntegerConstant 2 (Integer 4))] (Array @@ -343,8 +343,8 @@ ) (Print () - [(Var 212 yq) - (Var 212 yptr1)] + [(Var 201 yq) + (Var 201 yptr1)] () () )] @@ -408,11 +408,11 @@ main_program: (Program (SymbolTable - 214 + 203 { __main__global_stmts: (ExternalSymbol - 214 + 203 __main__global_stmts 2 __main__global_stmts __main__ @@ -424,7 +424,7 @@ main_program [__main__] [(SubroutineCall - 214 __main__global_stmts + 203 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-cast-435c233.json b/tests/reference/asr-cast-435c233.json index e87c0209a3..0e702578d8 100644 --- a/tests/reference/asr-cast-435c233.json +++ b/tests/reference/asr-cast-435c233.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-cast-435c233.stdout", - "stdout_hash": "bc6585a6ab9f9cb1de5bacadd387d304bbc069de158b026c4550977e", + "stdout_hash": "1d616232829e2d73cf1f82681176b8f5e82ae5159e9bc3b39794a33f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-cast-435c233.stdout b/tests/reference/asr-cast-435c233.stdout index ce4580f626..aed92b3b98 100644 --- a/tests/reference/asr-cast-435c233.stdout +++ b/tests/reference/asr-cast-435c233.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 130 + 119 { }) @@ -285,11 +285,11 @@ main_program: (Program (SymbolTable - 131 + 120 { __main__global_stmts: (ExternalSymbol - 131 + 120 __main__global_stmts 2 __main__global_stmts __main__ @@ -301,7 +301,7 @@ main_program [__main__] [(SubroutineCall - 131 __main__global_stmts + 120 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-complex1-f26c460.json b/tests/reference/asr-complex1-f26c460.json index a8c9047810..4540a057eb 100644 --- a/tests/reference/asr-complex1-f26c460.json +++ b/tests/reference/asr-complex1-f26c460.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex1-f26c460.stdout", - "stdout_hash": "dbf14823f5ba118f855c7db3da76c72138b44e148c0cad01166a5145", + "stdout_hash": "8c3db4b88ed74a020b6a0ed76f47a65c3da89b2e0756dd260de0a9fb", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex1-f26c460.stdout b/tests/reference/asr-complex1-f26c460.stdout index 55a7a54245..8076419ea1 100644 --- a/tests/reference/asr-complex1-f26c460.stdout +++ b/tests/reference/asr-complex1-f26c460.stdout @@ -781,7 +781,7 @@ main_program: (Program (SymbolTable - 131 + 120 { }) diff --git a/tests/reference/asr-constants1-5828e8a.json b/tests/reference/asr-constants1-5828e8a.json index f8f0d2575c..efbf8f9bc1 100644 --- a/tests/reference/asr-constants1-5828e8a.json +++ b/tests/reference/asr-constants1-5828e8a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-constants1-5828e8a.stdout", - "stdout_hash": "3e3b391023b8c9a848cd795e6a8ef252ba77710b1561ed988fd78b0f", + "stdout_hash": "8ad517b1fb9537e903479b813ed839f72c36608a890401e78187eaa1", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-constants1-5828e8a.stdout b/tests/reference/asr-constants1-5828e8a.stdout index 319de060a0..e1ac329855 100644 --- a/tests/reference/asr-constants1-5828e8a.stdout +++ b/tests/reference/asr-constants1-5828e8a.stdout @@ -1780,7 +1780,7 @@ main_program: (Program (SymbolTable - 139 + 128 { }) diff --git a/tests/reference/asr-elemental_01-b58df26.json b/tests/reference/asr-elemental_01-b58df26.json index a255b70615..b4d36966d1 100644 --- a/tests/reference/asr-elemental_01-b58df26.json +++ b/tests/reference/asr-elemental_01-b58df26.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-elemental_01-b58df26.stdout", - "stdout_hash": "9621078691e8fdc6b9382f8bc62b6abba1ef6c48617198fa2a310503", + "stdout_hash": "71cc6bc6a596fd628bad7572f8636622ef932ac2098ed3776f77099e", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-elemental_01-b58df26.stdout b/tests/reference/asr-elemental_01-b58df26.stdout index 6db356de84..3e3d44dd88 100644 --- a/tests/reference/asr-elemental_01-b58df26.stdout +++ b/tests/reference/asr-elemental_01-b58df26.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 245 + 234 { }) @@ -84,11 +84,11 @@ elemental_cos: (Function (SymbolTable - 220 + 209 { array2d: (Variable - 220 + 209 array2d [] Local @@ -111,7 +111,7 @@ ), cos2d: (Variable - 220 + 209 cos2d [] Local @@ -134,7 +134,7 @@ ), cos@__lpython_overloaded_0__cos: (ExternalSymbol - 220 + 209 cos@__lpython_overloaded_0__cos 3 __lpython_overloaded_0__cos numpy @@ -144,7 +144,7 @@ ), i: (Variable - 220 + 209 i [] Local @@ -160,7 +160,7 @@ ), j: (Variable - 220 + 209 j [] Local @@ -194,7 +194,7 @@ verify2d] [] [(= - (Var 220 array2d) + (Var 209 array2d) (ArrayConstant [] (Array @@ -210,7 +210,7 @@ () ) (= - (Var 220 cos2d) + (Var 209 cos2d) (ArrayConstant [] (Array @@ -227,7 +227,7 @@ ) (DoLoop () - ((Var 220 i) + ((Var 209 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 256 (Integer 4)) @@ -239,7 +239,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 220 j) + ((Var 209 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 64 (Integer 4)) @@ -251,12 +251,12 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 220 array2d) + (Var 209 array2d) [(() - (Var 220 i) + (Var 209 i) ()) (() - (Var 220 j) + (Var 209 j) ())] (Real 8) RowMajor @@ -264,9 +264,9 @@ ) (Cast (IntegerBinOp - (Var 220 i) + (Var 209 i) Add - (Var 220 j) + (Var 209 j) (Integer 4) () ) @@ -279,12 +279,12 @@ )] ) (= - (Var 220 cos2d) + (Var 209 cos2d) (RealBinOp (FunctionCall - 220 cos@__lpython_overloaded_0__cos + 209 cos@__lpython_overloaded_0__cos 2 cos - [((Var 220 array2d))] + [((Var 209 array2d))] (Array (Real 8) [((IntegerConstant 0 (Integer 4)) @@ -317,7 +317,7 @@ 2 verify2d () [((ArrayPhysicalCast - (Var 220 array2d) + (Var 209 array2d) FixedSizeArray DescriptorArray (Array @@ -331,7 +331,7 @@ () )) ((ArrayPhysicalCast - (Var 220 cos2d) + (Var 209 cos2d) FixedSizeArray DescriptorArray (Array @@ -357,11 +357,11 @@ elemental_mul: (Function (SymbolTable - 218 + 207 { array_a: (Variable - 218 + 207 array_a [] Local @@ -382,7 +382,7 @@ ), array_b: (Variable - 218 + 207 array_b [] Local @@ -403,7 +403,7 @@ ), array_c: (Variable - 218 + 207 array_c [] Local @@ -424,7 +424,7 @@ ), i: (Variable - 218 + 207 i [] Local @@ -440,7 +440,7 @@ ), j: (Variable - 218 + 207 j [] Local @@ -456,7 +456,7 @@ ), k: (Variable - 218 + 207 k [] Local @@ -489,7 +489,7 @@ [verify1d_mul] [] [(= - (Var 218 array_a) + (Var 207 array_a) (ArrayConstant [] (Array @@ -503,7 +503,7 @@ () ) (= - (Var 218 array_b) + (Var 207 array_b) (ArrayConstant [] (Array @@ -517,7 +517,7 @@ () ) (= - (Var 218 array_c) + (Var 207 array_c) (ArrayConstant [] (Array @@ -532,7 +532,7 @@ ) (DoLoop () - ((Var 218 i) + ((Var 207 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 100 (Integer 4)) @@ -544,16 +544,16 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 218 array_a) + (Var 207 array_a) [(() - (Var 218 i) + (Var 207 i) ())] (Real 8) RowMajor () ) (Cast - (Var 218 i) + (Var 207 i) IntegerToReal (Real 8) () @@ -563,7 +563,7 @@ ) (DoLoop () - ((Var 218 j) + ((Var 207 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 100 (Integer 4)) @@ -575,9 +575,9 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 218 array_b) + (Var 207 array_b) [(() - (Var 218 j) + (Var 207 j) ())] (Real 8) RowMajor @@ -585,7 +585,7 @@ ) (Cast (IntegerBinOp - (Var 218 j) + (Var 207 j) Add (IntegerConstant 5 (Integer 4)) (Integer 4) @@ -599,11 +599,11 @@ )] ) (= - (Var 218 array_c) + (Var 207 array_c) (RealBinOp (RealBinOp (RealBinOp - (Var 218 array_a) + (Var 207 array_a) Pow (RealConstant 2.000000 @@ -632,7 +632,7 @@ ) Mul (RealBinOp - (Var 218 array_b) + (Var 207 array_b) Pow (RealConstant 3.000000 @@ -660,7 +660,7 @@ 2 verify1d_mul () [((ArrayPhysicalCast - (Var 218 array_a) + (Var 207 array_a) FixedSizeArray DescriptorArray (Array @@ -672,7 +672,7 @@ () )) ((ArrayPhysicalCast - (Var 218 array_b) + (Var 207 array_b) FixedSizeArray DescriptorArray (Array @@ -684,7 +684,7 @@ () )) ((ArrayPhysicalCast - (Var 218 array_c) + (Var 207 array_c) FixedSizeArray DescriptorArray (Array @@ -707,11 +707,11 @@ elemental_sin: (Function (SymbolTable - 219 + 208 { array1d: (Variable - 219 + 208 array1d [] Local @@ -732,7 +732,7 @@ ), arraynd: (Variable - 219 + 208 arraynd [] Local @@ -757,7 +757,7 @@ ), i: (Variable - 219 + 208 i [] Local @@ -773,7 +773,7 @@ ), j: (Variable - 219 + 208 j [] Local @@ -789,7 +789,7 @@ ), k: (Variable - 219 + 208 k [] Local @@ -805,7 +805,7 @@ ), sin1d: (Variable - 219 + 208 sin1d [] Local @@ -826,7 +826,7 @@ ), sin@__lpython_overloaded_0__sin: (ExternalSymbol - 219 + 208 sin@__lpython_overloaded_0__sin 3 __lpython_overloaded_0__sin numpy @@ -836,7 +836,7 @@ ), sin@__lpython_overloaded_1__sin: (ExternalSymbol - 219 + 208 sin@__lpython_overloaded_1__sin 3 __lpython_overloaded_1__sin numpy @@ -846,7 +846,7 @@ ), sinnd: (Variable - 219 + 208 sinnd [] Local @@ -891,7 +891,7 @@ verifynd] [] [(= - (Var 219 array1d) + (Var 208 array1d) (ArrayConstant [] (Array @@ -905,7 +905,7 @@ () ) (= - (Var 219 sin1d) + (Var 208 sin1d) (ArrayConstant [] (Array @@ -920,7 +920,7 @@ ) (DoLoop () - ((Var 219 i) + ((Var 208 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 256 (Integer 4)) @@ -932,16 +932,16 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 219 array1d) + (Var 208 array1d) [(() - (Var 219 i) + (Var 208 i) ())] (Real 4) RowMajor () ) (Cast - (Var 219 i) + (Var 208 i) IntegerToReal (Real 4) () @@ -950,14 +950,14 @@ )] ) (= - (Var 219 sin1d) + (Var 208 sin1d) (FunctionCall - 219 sin@__lpython_overloaded_1__sin + 208 sin@__lpython_overloaded_1__sin 2 sin [((FunctionCall - 219 sin@__lpython_overloaded_1__sin + 208 sin@__lpython_overloaded_1__sin 2 sin - [((Var 219 array1d))] + [((Var 208 array1d))] (Array (Real 4) [((IntegerConstant 0 (Integer 4)) @@ -982,7 +982,7 @@ 2 verify1d () [((ArrayPhysicalCast - (Var 219 array1d) + (Var 208 array1d) FixedSizeArray DescriptorArray (Array @@ -994,7 +994,7 @@ () )) ((ArrayPhysicalCast - (Var 219 sin1d) + (Var 208 sin1d) FixedSizeArray DescriptorArray (Array @@ -1009,7 +1009,7 @@ () ) (= - (Var 219 arraynd) + (Var 208 arraynd) (ArrayConstant [] (Array @@ -1027,7 +1027,7 @@ () ) (= - (Var 219 sinnd) + (Var 208 sinnd) (ArrayConstant [] (Array @@ -1046,7 +1046,7 @@ ) (DoLoop () - ((Var 219 i) + ((Var 208 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 256 (Integer 4)) @@ -1058,7 +1058,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 219 j) + ((Var 208 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 64 (Integer 4)) @@ -1070,7 +1070,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 219 k) + ((Var 208 k) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -1082,15 +1082,15 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 219 arraynd) + (Var 208 arraynd) [(() - (Var 219 i) + (Var 208 i) ()) (() - (Var 219 j) + (Var 208 j) ()) (() - (Var 219 k) + (Var 208 k) ())] (Real 8) RowMajor @@ -1099,14 +1099,14 @@ (Cast (IntegerBinOp (IntegerBinOp - (Var 219 i) + (Var 208 i) Add - (Var 219 j) + (Var 208 j) (Integer 4) () ) Add - (Var 219 k) + (Var 208 k) (Integer 4) () ) @@ -1120,12 +1120,12 @@ )] ) (= - (Var 219 sinnd) + (Var 208 sinnd) (RealBinOp (FunctionCall - 219 sin@__lpython_overloaded_0__sin + 208 sin@__lpython_overloaded_0__sin 2 sin - [((Var 219 arraynd))] + [((Var 208 arraynd))] (Array (Real 8) [((IntegerConstant 0 (Integer 4)) @@ -1162,7 +1162,7 @@ 2 verifynd () [((ArrayPhysicalCast - (Var 219 arraynd) + (Var 208 arraynd) FixedSizeArray DescriptorArray (Array @@ -1178,7 +1178,7 @@ () )) ((ArrayPhysicalCast - (Var 219 sinnd) + (Var 208 sinnd) FixedSizeArray DescriptorArray (Array @@ -1207,11 +1207,11 @@ elemental_sum: (Function (SymbolTable - 217 + 206 { array_a: (Variable - 217 + 206 array_a [] Local @@ -1232,7 +1232,7 @@ ), array_b: (Variable - 217 + 206 array_b [] Local @@ -1253,7 +1253,7 @@ ), array_c: (Variable - 217 + 206 array_c [] Local @@ -1274,7 +1274,7 @@ ), i: (Variable - 217 + 206 i [] Local @@ -1290,7 +1290,7 @@ ), j: (Variable - 217 + 206 j [] Local @@ -1306,7 +1306,7 @@ ), k: (Variable - 217 + 206 k [] Local @@ -1339,7 +1339,7 @@ [verify1d_sum] [] [(= - (Var 217 array_a) + (Var 206 array_a) (ArrayConstant [] (Array @@ -1353,7 +1353,7 @@ () ) (= - (Var 217 array_b) + (Var 206 array_b) (ArrayConstant [] (Array @@ -1367,7 +1367,7 @@ () ) (= - (Var 217 array_c) + (Var 206 array_c) (ArrayConstant [] (Array @@ -1382,7 +1382,7 @@ ) (DoLoop () - ((Var 217 i) + ((Var 206 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 100 (Integer 4)) @@ -1394,16 +1394,16 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 217 array_a) + (Var 206 array_a) [(() - (Var 217 i) + (Var 206 i) ())] (Real 8) RowMajor () ) (Cast - (Var 217 i) + (Var 206 i) IntegerToReal (Real 8) () @@ -1413,7 +1413,7 @@ ) (DoLoop () - ((Var 217 j) + ((Var 206 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 100 (Integer 4)) @@ -1425,9 +1425,9 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 217 array_b) + (Var 206 array_b) [(() - (Var 217 j) + (Var 206 j) ())] (Real 8) RowMajor @@ -1435,7 +1435,7 @@ ) (Cast (IntegerBinOp - (Var 217 j) + (Var 206 j) Add (IntegerConstant 5 (Integer 4)) (Integer 4) @@ -1449,10 +1449,10 @@ )] ) (= - (Var 217 array_c) + (Var 206 array_c) (RealBinOp (RealBinOp - (Var 217 array_a) + (Var 206 array_a) Pow (RealConstant 2.000000 @@ -1474,7 +1474,7 @@ ) Mul (RealBinOp - (Var 217 array_b) + (Var 206 array_b) Pow (RealConstant 3.000000 @@ -1510,7 +1510,7 @@ 2 verify1d_sum () [((ArrayPhysicalCast - (Var 217 array_a) + (Var 206 array_a) FixedSizeArray DescriptorArray (Array @@ -1522,7 +1522,7 @@ () )) ((ArrayPhysicalCast - (Var 217 array_b) + (Var 206 array_b) FixedSizeArray DescriptorArray (Array @@ -1534,7 +1534,7 @@ () )) ((ArrayPhysicalCast - (Var 217 array_c) + (Var 206 array_c) FixedSizeArray DescriptorArray (Array @@ -1557,11 +1557,11 @@ elemental_trig_identity: (Function (SymbolTable - 221 + 210 { arraynd: (Variable - 221 + 210 arraynd [] Local @@ -1588,7 +1588,7 @@ ), cos@__lpython_overloaded_1__cos: (ExternalSymbol - 221 + 210 cos@__lpython_overloaded_1__cos 3 __lpython_overloaded_1__cos numpy @@ -1598,7 +1598,7 @@ ), eps: (Variable - 221 + 210 eps [] Local @@ -1614,7 +1614,7 @@ ), i: (Variable - 221 + 210 i [] Local @@ -1630,7 +1630,7 @@ ), j: (Variable - 221 + 210 j [] Local @@ -1646,7 +1646,7 @@ ), k: (Variable - 221 + 210 k [] Local @@ -1662,7 +1662,7 @@ ), l: (Variable - 221 + 210 l [] Local @@ -1678,7 +1678,7 @@ ), newshape: (Variable - 221 + 210 newshape [] Local @@ -1699,7 +1699,7 @@ ), observed: (Variable - 221 + 210 observed [] Local @@ -1726,7 +1726,7 @@ ), observed1d: (Variable - 221 + 210 observed1d [] Local @@ -1747,7 +1747,7 @@ ), sin@__lpython_overloaded_1__sin: (ExternalSymbol - 221 + 210 sin@__lpython_overloaded_1__sin 3 __lpython_overloaded_1__sin numpy @@ -1775,7 +1775,7 @@ cos@__lpython_overloaded_1__cos] [] [(= - (Var 221 eps) + (Var 210 eps) (Cast (RealConstant 0.000001 @@ -1791,7 +1791,7 @@ () ) (= - (Var 221 arraynd) + (Var 210 arraynd) (ArrayConstant [] (Array @@ -1811,7 +1811,7 @@ () ) (= - (Var 221 observed) + (Var 210 observed) (ArrayConstant [] (Array @@ -1831,7 +1831,7 @@ () ) (= - (Var 221 observed1d) + (Var 210 observed1d) (ArrayConstant [] (Array @@ -1846,7 +1846,7 @@ ) (DoLoop () - ((Var 221 i) + ((Var 210 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 64 (Integer 4)) @@ -1858,7 +1858,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 221 j) + ((Var 210 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 32 (Integer 4)) @@ -1870,7 +1870,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 221 k) + ((Var 210 k) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 8 (Integer 4)) @@ -1882,7 +1882,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 221 l) + ((Var 210 l) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 4 (Integer 4)) @@ -1894,18 +1894,18 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 221 arraynd) + (Var 210 arraynd) [(() - (Var 221 i) + (Var 210 i) ()) (() - (Var 221 j) + (Var 210 j) ()) (() - (Var 221 k) + (Var 210 k) ()) (() - (Var 221 l) + (Var 210 l) ())] (Real 4) RowMajor @@ -1915,19 +1915,19 @@ (IntegerBinOp (IntegerBinOp (IntegerBinOp - (Var 221 i) + (Var 210 i) Add - (Var 221 j) + (Var 210 j) (Integer 4) () ) Add - (Var 221 k) + (Var 210 k) (Integer 4) () ) Add - (Var 221 l) + (Var 210 l) (Integer 4) () ) @@ -1942,13 +1942,13 @@ )] ) (= - (Var 221 observed) + (Var 210 observed) (RealBinOp (RealBinOp (FunctionCall - 221 sin@__lpython_overloaded_1__sin + 210 sin@__lpython_overloaded_1__sin 2 sin - [((Var 221 arraynd))] + [((Var 210 arraynd))] (Array (Real 4) [((IntegerConstant 0 (Integer 4)) @@ -1991,9 +1991,9 @@ Add (RealBinOp (FunctionCall - 221 cos@__lpython_overloaded_1__cos + 210 cos@__lpython_overloaded_1__cos 2 cos - [((Var 221 arraynd))] + [((Var 210 arraynd))] (Array (Real 4) [((IntegerConstant 0 (Integer 4)) @@ -2050,7 +2050,7 @@ () ) (= - (Var 221 newshape) + (Var 210 newshape) (ArrayConstant [] (Array @@ -2065,7 +2065,7 @@ ) (= (ArrayItem - (Var 221 newshape) + (Var 210 newshape) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -2077,11 +2077,11 @@ () ) (= - (Var 221 observed1d) + (Var 210 observed1d) (ArrayReshape - (Var 221 observed) + (Var 210 observed) (ArrayPhysicalCast - (Var 221 newshape) + (Var 210 newshape) FixedSizeArray DescriptorArray (Array @@ -2104,7 +2104,7 @@ ) (DoLoop () - ((Var 221 i) + ((Var 210 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 65536 (Integer 4)) @@ -2120,9 +2120,9 @@ Abs [(RealBinOp (ArrayItem - (Var 221 observed1d) + (Var 210 observed1d) [(() - (Var 221 i) + (Var 210 i) ())] (Real 4) RowMajor @@ -2149,7 +2149,7 @@ () ) LtE - (Var 221 eps) + (Var 210 eps) (Logical 4) () ) @@ -2175,11 +2175,11 @@ verify1d: (Function (SymbolTable - 212 + 201 { array: (Variable - 212 + 201 array [] InOut @@ -2201,11 +2201,11 @@ block: (Block (SymbolTable - 222 + 211 { sin@__lpython_overloaded_1__sin: (ExternalSymbol - 222 + 211 sin@__lpython_overloaded_1__sin 3 __lpython_overloaded_1__sin numpy @@ -2221,15 +2221,15 @@ Abs [(RealBinOp (FunctionCall - 222 sin@__lpython_overloaded_1__sin + 211 sin@__lpython_overloaded_1__sin 2 sin [((FunctionCall - 222 sin@__lpython_overloaded_1__sin + 211 sin@__lpython_overloaded_1__sin 2 sin [((ArrayItem - (Var 212 array) + (Var 201 array) [(() - (Var 212 i) + (Var 201 i) ())] (Real 4) RowMajor @@ -2245,9 +2245,9 @@ ) Sub (ArrayItem - (Var 212 result) + (Var 201 result) [(() - (Var 212 i) + (Var 201 i) ())] (Real 4) RowMajor @@ -2261,7 +2261,7 @@ () ) LtE - (Var 212 eps) + (Var 201 eps) (Logical 4) () ) @@ -2270,7 +2270,7 @@ ), eps: (Variable - 212 + 201 eps [] Local @@ -2286,7 +2286,7 @@ ), i: (Variable - 212 + 201 i [] Local @@ -2302,7 +2302,7 @@ ), result: (Variable - 212 + 201 result [] InOut @@ -2323,7 +2323,7 @@ ), size: (Variable - 212 + 201 size [] In @@ -2366,11 +2366,11 @@ .false. ) [sin@__lpython_overloaded_1__sin] - [(Var 212 array) - (Var 212 result) - (Var 212 size)] + [(Var 201 array) + (Var 201 result) + (Var 201 size)] [(= - (Var 212 eps) + (Var 201 eps) (Cast (RealConstant 0.000001 @@ -2387,10 +2387,10 @@ ) (DoLoop () - ((Var 212 i) + ((Var 201 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 212 size) + (Var 201 size) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -2399,7 +2399,7 @@ (IntegerConstant 1 (Integer 4))) [(BlockCall -1 - 212 block + 201 block )] )] () @@ -2411,11 +2411,11 @@ verify1d_mul: (Function (SymbolTable - 216 + 205 { array_a: (Variable - 216 + 205 array_a [] InOut @@ -2436,7 +2436,7 @@ ), array_b: (Variable - 216 + 205 array_b [] InOut @@ -2457,7 +2457,7 @@ ), eps: (Variable - 216 + 205 eps [] Local @@ -2473,7 +2473,7 @@ ), i: (Variable - 216 + 205 i [] Local @@ -2489,7 +2489,7 @@ ), result: (Variable - 216 + 205 result [] InOut @@ -2510,7 +2510,7 @@ ), size: (Variable - 216 + 205 size [] In @@ -2559,12 +2559,12 @@ .false. ) [] - [(Var 216 array_a) - (Var 216 array_b) - (Var 216 result) - (Var 216 size)] + [(Var 205 array_a) + (Var 205 array_b) + (Var 205 result) + (Var 205 size)] [(= - (Var 216 eps) + (Var 205 eps) (RealConstant 0.000010 (Real 8) @@ -2573,10 +2573,10 @@ ) (DoLoop () - ((Var 216 i) + ((Var 205 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 216 size) + (Var 205 size) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -2592,9 +2592,9 @@ (RealBinOp (RealBinOp (ArrayItem - (Var 216 array_a) + (Var 205 array_a) [(() - (Var 216 i) + (Var 205 i) ())] (Real 8) RowMajor @@ -2619,9 +2619,9 @@ Mul (RealBinOp (ArrayItem - (Var 216 array_b) + (Var 205 array_b) [(() - (Var 216 i) + (Var 205 i) ())] (Real 8) RowMajor @@ -2640,9 +2640,9 @@ ) Sub (ArrayItem - (Var 216 result) + (Var 205 result) [(() - (Var 216 i) + (Var 205 i) ())] (Real 8) RowMajor @@ -2656,7 +2656,7 @@ () ) LtE - (Var 216 eps) + (Var 205 eps) (Logical 4) () ) @@ -2672,11 +2672,11 @@ verify1d_sum: (Function (SymbolTable - 215 + 204 { array_a: (Variable - 215 + 204 array_a [] InOut @@ -2697,7 +2697,7 @@ ), array_b: (Variable - 215 + 204 array_b [] InOut @@ -2718,7 +2718,7 @@ ), eps: (Variable - 215 + 204 eps [] Local @@ -2734,7 +2734,7 @@ ), i: (Variable - 215 + 204 i [] Local @@ -2750,7 +2750,7 @@ ), result: (Variable - 215 + 204 result [] InOut @@ -2771,7 +2771,7 @@ ), size: (Variable - 215 + 204 size [] In @@ -2820,12 +2820,12 @@ .false. ) [] - [(Var 215 array_a) - (Var 215 array_b) - (Var 215 result) - (Var 215 size)] + [(Var 204 array_a) + (Var 204 array_b) + (Var 204 result) + (Var 204 size)] [(= - (Var 215 eps) + (Var 204 eps) (RealConstant 0.000000 (Real 8) @@ -2834,10 +2834,10 @@ ) (DoLoop () - ((Var 215 i) + ((Var 204 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 215 size) + (Var 204 size) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -2852,9 +2852,9 @@ (RealBinOp (RealBinOp (ArrayItem - (Var 215 array_a) + (Var 204 array_a) [(() - (Var 215 i) + (Var 204 i) ())] (Real 8) RowMajor @@ -2877,9 +2877,9 @@ Mul (RealBinOp (ArrayItem - (Var 215 array_b) + (Var 204 array_b) [(() - (Var 215 i) + (Var 204 i) ())] (Real 8) RowMajor @@ -2901,9 +2901,9 @@ ) Sub (ArrayItem - (Var 215 result) + (Var 204 result) [(() - (Var 215 i) + (Var 204 i) ())] (Real 8) RowMajor @@ -2917,7 +2917,7 @@ () ) LtE - (Var 215 eps) + (Var 204 eps) (Logical 4) () ) @@ -2933,11 +2933,11 @@ verify2d: (Function (SymbolTable - 214 + 203 { array: (Variable - 214 + 203 array [] InOut @@ -2961,16 +2961,16 @@ block: (Block (SymbolTable - 226 + 215 { block: (Block (SymbolTable - 227 + 216 { cos@__lpython_overloaded_0__cos: (ExternalSymbol - 227 + 216 cos@__lpython_overloaded_0__cos 3 __lpython_overloaded_0__cos numpy @@ -2987,15 +2987,15 @@ [(RealBinOp (RealBinOp (FunctionCall - 227 cos@__lpython_overloaded_0__cos + 216 cos@__lpython_overloaded_0__cos 2 cos [((ArrayItem - (Var 214 array) + (Var 203 array) [(() - (Var 214 i) + (Var 203 i) ()) (() - (Var 214 j) + (Var 203 j) ())] (Real 8) RowMajor @@ -3015,12 +3015,12 @@ ) Sub (ArrayItem - (Var 214 result) + (Var 203 result) [(() - (Var 214 i) + (Var 203 i) ()) (() - (Var 214 j) + (Var 203 j) ())] (Real 8) RowMajor @@ -3034,7 +3034,7 @@ () ) LtE - (Var 214 eps) + (Var 203 eps) (Logical 4) () ) @@ -3045,10 +3045,10 @@ block [(DoLoop () - ((Var 214 j) + ((Var 203 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 214 size2) + (Var 203 size2) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -3057,13 +3057,13 @@ (IntegerConstant 1 (Integer 4))) [(BlockCall -1 - 226 block + 215 block )] )] ), eps: (Variable - 214 + 203 eps [] Local @@ -3079,7 +3079,7 @@ ), i: (Variable - 214 + 203 i [] Local @@ -3095,7 +3095,7 @@ ), j: (Variable - 214 + 203 j [] Local @@ -3111,7 +3111,7 @@ ), result: (Variable - 214 + 203 result [] InOut @@ -3134,7 +3134,7 @@ ), size1: (Variable - 214 + 203 size1 [] In @@ -3150,7 +3150,7 @@ ), size2: (Variable - 214 + 203 size2 [] In @@ -3198,12 +3198,12 @@ .false. ) [cos@__lpython_overloaded_0__cos] - [(Var 214 array) - (Var 214 result) - (Var 214 size1) - (Var 214 size2)] + [(Var 203 array) + (Var 203 result) + (Var 203 size1) + (Var 203 size2)] [(= - (Var 214 eps) + (Var 203 eps) (RealConstant 0.000000 (Real 8) @@ -3212,10 +3212,10 @@ ) (DoLoop () - ((Var 214 i) + ((Var 203 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 214 size1) + (Var 203 size1) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -3224,7 +3224,7 @@ (IntegerConstant 1 (Integer 4))) [(BlockCall -1 - 214 block + 203 block )] )] () @@ -3236,11 +3236,11 @@ verifynd: (Function (SymbolTable - 213 + 202 { array: (Variable - 213 + 202 array [] InOut @@ -3266,21 +3266,21 @@ block: (Block (SymbolTable - 223 + 212 { block: (Block (SymbolTable - 224 + 213 { block: (Block (SymbolTable - 225 + 214 { sin@__lpython_overloaded_0__sin: (ExternalSymbol - 225 + 214 sin@__lpython_overloaded_0__sin 3 __lpython_overloaded_0__sin numpy @@ -3297,18 +3297,18 @@ [(RealBinOp (RealBinOp (FunctionCall - 225 sin@__lpython_overloaded_0__sin + 214 sin@__lpython_overloaded_0__sin 2 sin [((ArrayItem - (Var 213 array) + (Var 202 array) [(() - (Var 213 i) + (Var 202 i) ()) (() - (Var 213 j) + (Var 202 j) ()) (() - (Var 213 k) + (Var 202 k) ())] (Real 8) RowMajor @@ -3328,15 +3328,15 @@ ) Sub (ArrayItem - (Var 213 result) + (Var 202 result) [(() - (Var 213 i) + (Var 202 i) ()) (() - (Var 213 j) + (Var 202 j) ()) (() - (Var 213 k) + (Var 202 k) ())] (Real 8) RowMajor @@ -3350,7 +3350,7 @@ () ) LtE - (Var 213 eps) + (Var 202 eps) (Logical 4) () ) @@ -3361,10 +3361,10 @@ block [(DoLoop () - ((Var 213 k) + ((Var 202 k) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 213 size3) + (Var 202 size3) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -3373,7 +3373,7 @@ (IntegerConstant 1 (Integer 4))) [(BlockCall -1 - 224 block + 213 block )] )] ) @@ -3381,10 +3381,10 @@ block [(DoLoop () - ((Var 213 j) + ((Var 202 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 213 size2) + (Var 202 size2) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -3393,13 +3393,13 @@ (IntegerConstant 1 (Integer 4))) [(BlockCall -1 - 223 block + 212 block )] )] ), eps: (Variable - 213 + 202 eps [] Local @@ -3415,7 +3415,7 @@ ), i: (Variable - 213 + 202 i [] Local @@ -3431,7 +3431,7 @@ ), j: (Variable - 213 + 202 j [] Local @@ -3447,7 +3447,7 @@ ), k: (Variable - 213 + 202 k [] Local @@ -3463,7 +3463,7 @@ ), result: (Variable - 213 + 202 result [] InOut @@ -3488,7 +3488,7 @@ ), size1: (Variable - 213 + 202 size1 [] In @@ -3504,7 +3504,7 @@ ), size2: (Variable - 213 + 202 size2 [] In @@ -3520,7 +3520,7 @@ ), size3: (Variable - 213 + 202 size3 [] In @@ -3573,13 +3573,13 @@ .false. ) [sin@__lpython_overloaded_0__sin] - [(Var 213 array) - (Var 213 result) - (Var 213 size1) - (Var 213 size2) - (Var 213 size3)] + [(Var 202 array) + (Var 202 result) + (Var 202 size1) + (Var 202 size2) + (Var 202 size3)] [(= - (Var 213 eps) + (Var 202 eps) (RealConstant 0.000000 (Real 8) @@ -3588,10 +3588,10 @@ ) (DoLoop () - ((Var 213 i) + ((Var 202 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 213 size1) + (Var 202 size1) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -3600,7 +3600,7 @@ (IntegerConstant 1 (Integer 4))) [(BlockCall -1 - 213 block + 202 block )] )] () @@ -3620,11 +3620,11 @@ main_program: (Program (SymbolTable - 246 + 235 { __main__global_stmts: (ExternalSymbol - 246 + 235 __main__global_stmts 2 __main__global_stmts __main__ @@ -3636,7 +3636,7 @@ main_program [__main__] [(SubroutineCall - 246 __main__global_stmts + 235 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-expr10-efcbb1b.json b/tests/reference/asr-expr10-efcbb1b.json index 85af31c4c5..486fbbae27 100644 --- a/tests/reference/asr-expr10-efcbb1b.json +++ b/tests/reference/asr-expr10-efcbb1b.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr10-efcbb1b.stdout", - "stdout_hash": "2a5bd5360e8284c71c4513549995e66d94c58a71e00e56c7fce353ea", + "stdout_hash": "888daca8b770c13848943f1e1da7d63d29ce81e4beeaf050a042f7d4", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr10-efcbb1b.stdout b/tests/reference/asr-expr10-efcbb1b.stdout index d7216722c1..d0c6534e4e 100644 --- a/tests/reference/asr-expr10-efcbb1b.stdout +++ b/tests/reference/asr-expr10-efcbb1b.stdout @@ -440,7 +440,7 @@ main_program: (Program (SymbolTable - 130 + 119 { }) diff --git a/tests/reference/asr-expr13-81bdb5a.json b/tests/reference/asr-expr13-81bdb5a.json index 93edc6fd9c..9f0b756203 100644 --- a/tests/reference/asr-expr13-81bdb5a.json +++ b/tests/reference/asr-expr13-81bdb5a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr13-81bdb5a.stdout", - "stdout_hash": "fa09d415d8cc21c3b0f5b1e0276c3155a22abe22afa2d05caf07c2e3", + "stdout_hash": "c07ed7eef3224ca374248cf1a964efd0159266de0351db244cc65639", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr13-81bdb5a.stdout b/tests/reference/asr-expr13-81bdb5a.stdout index c69a5e4f5a..f6376d2e47 100644 --- a/tests/reference/asr-expr13-81bdb5a.stdout +++ b/tests/reference/asr-expr13-81bdb5a.stdout @@ -460,7 +460,7 @@ main_program: (Program (SymbolTable - 130 + 119 { }) diff --git a/tests/reference/asr-expr7-480ba2f.json b/tests/reference/asr-expr7-480ba2f.json index 3dcafc2759..0662b945e4 100644 --- a/tests/reference/asr-expr7-480ba2f.json +++ b/tests/reference/asr-expr7-480ba2f.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr7-480ba2f.stdout", - "stdout_hash": "88c30ffb14f2ecd97ec1f2bab23bcb93de2a6bf31895ab2766b04d76", + "stdout_hash": "f2a3f371604ed6cb8460758126475e5d6bd7c6d1bee5c36b8df66162", "stderr": "asr-expr7-480ba2f.stderr", "stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c", "returncode": 0 diff --git a/tests/reference/asr-expr7-480ba2f.stdout b/tests/reference/asr-expr7-480ba2f.stdout index a8c4abcbd3..1b16413d18 100644 --- a/tests/reference/asr-expr7-480ba2f.stdout +++ b/tests/reference/asr-expr7-480ba2f.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 132 + 121 { }) @@ -344,11 +344,11 @@ main_program: (Program (SymbolTable - 133 + 122 { __main__global_stmts: (ExternalSymbol - 133 + 122 __main__global_stmts 2 __main__global_stmts __main__ @@ -360,7 +360,7 @@ main_program [__main__] [(SubroutineCall - 133 __main__global_stmts + 122 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-expr8-6beda60.json b/tests/reference/asr-expr8-6beda60.json index f40572b9a3..9fb8c510ab 100644 --- a/tests/reference/asr-expr8-6beda60.json +++ b/tests/reference/asr-expr8-6beda60.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr8-6beda60.stdout", - "stdout_hash": "93a660ef9a1cf611f2b57d4713674589dbb4d32a862e8c7ddc3e0c90", + "stdout_hash": "b79ac7dd790182c720f71316cdcedbd0a6b3b1bd56ef5cb800fab8dd", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr8-6beda60.stdout b/tests/reference/asr-expr8-6beda60.stdout index 39b139fca3..cda03a79a5 100644 --- a/tests/reference/asr-expr8-6beda60.stdout +++ b/tests/reference/asr-expr8-6beda60.stdout @@ -12,26 +12,6 @@ (SymbolTable 3 { - _lpython_floordiv: - (ExternalSymbol - 3 - _lpython_floordiv - 4 _lpython_floordiv - lpython_builtin - [] - _lpython_floordiv - Private - ), - _lpython_floordiv@__lpython_overloaded_10___lpython_floordiv: - (ExternalSymbol - 3 - _lpython_floordiv@__lpython_overloaded_10___lpython_floordiv - 4 __lpython_overloaded_10___lpython_floordiv - lpython_builtin - [] - __lpython_overloaded_10___lpython_floordiv - Public - ), b1: (Variable 3 @@ -112,7 +92,7 @@ [] .false. ) - [_lpython_floordiv@__lpython_overloaded_10___lpython_floordiv] + [] [] [(= (Var 3 x) @@ -387,14 +367,13 @@ (= (Var 3 x) (Cast - (FunctionCall - 3 _lpython_floordiv@__lpython_overloaded_10___lpython_floordiv - 3 _lpython_floordiv - [((Var 3 b1)) - ((Var 3 b1))] + (IntrinsicScalarFunction + FloorDiv + [(Var 3 b1) + (Var 3 b1)] + 0 (Logical 4) () - () ) LogicalToInteger (Integer 4) @@ -431,16 +410,14 @@ ) }) __main__ - [lpython_builtin] + [] .false. .false. ), - lpython_builtin: - (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable - 130 + 4 { }) diff --git a/tests/reference/asr-expr_05-3a37324.json b/tests/reference/asr-expr_05-3a37324.json index b11d31e5d9..71dbc8d3d5 100644 --- a/tests/reference/asr-expr_05-3a37324.json +++ b/tests/reference/asr-expr_05-3a37324.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr_05-3a37324.stdout", - "stdout_hash": "689af9ee83b49ffe1276c8e80c0f581c2c98ffafec8e478ace5bb9b1", + "stdout_hash": "88a4e64ce40edc1bb143c2540b877787c0e123da28609e0e129c3b84", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr_05-3a37324.stdout b/tests/reference/asr-expr_05-3a37324.stdout index b94d43e8c1..05fb00b886 100644 --- a/tests/reference/asr-expr_05-3a37324.stdout +++ b/tests/reference/asr-expr_05-3a37324.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 132 + 121 { }) @@ -48,26 +48,6 @@ (SymbolTable 5 { - _lpython_floordiv: - (ExternalSymbol - 5 - _lpython_floordiv - 6 _lpython_floordiv - lpython_builtin - [] - _lpython_floordiv - Private - ), - _lpython_floordiv@__lpython_overloaded_5___lpython_floordiv: - (ExternalSymbol - 5 - _lpython_floordiv@__lpython_overloaded_5___lpython_floordiv - 6 __lpython_overloaded_5___lpython_floordiv - lpython_builtin - [] - __lpython_overloaded_5___lpython_floordiv - Public - ), _mod: (ExternalSymbol 5 @@ -310,8 +290,7 @@ test_mod _mod@__lpython_overloaded_2___mod _mod@__lpython_overloaded_9___mod - _mod@__lpython_overloaded_4___mod - _lpython_floordiv@__lpython_overloaded_5___lpython_floordiv] + _mod@__lpython_overloaded_4___mod] [] [(= (Var 5 a) @@ -1381,16 +1360,15 @@ ) (= (Var 5 c1) - (FunctionCall - 5 _lpython_floordiv@__lpython_overloaded_5___lpython_floordiv - 5 _lpython_floordiv - [((Var 5 a1)) - ((Var 5 b1))] + (IntrinsicScalarFunction + FloorDiv + [(Var 5 a1) + (Var 5 b1)] + 0 (UnsignedInteger 2 ) () - () ) () ) @@ -1637,11 +1615,11 @@ main_program: (Program (SymbolTable - 133 + 122 { __main__global_stmts: (ExternalSymbol - 133 + 122 __main__global_stmts 2 __main__global_stmts __main__ @@ -1653,7 +1631,7 @@ main_program [__main__] [(SubroutineCall - 133 __main__global_stmts + 122 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-generics_array_01-682b1b2.json b/tests/reference/asr-generics_array_01-682b1b2.json index f68dd2415a..bce600e7c0 100644 --- a/tests/reference/asr-generics_array_01-682b1b2.json +++ b/tests/reference/asr-generics_array_01-682b1b2.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-generics_array_01-682b1b2.stdout", - "stdout_hash": "849f2057aa992ce262762fdc4a7da93aaded727fbb85a77e267d1cc5", + "stdout_hash": "03c8c6575d2998c550eb112986451ceea6f8f94324e9fe33a8999fc5", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-generics_array_01-682b1b2.stdout b/tests/reference/asr-generics_array_01-682b1b2.stdout index 91ba2fd6a9..a74477dc35 100644 --- a/tests/reference/asr-generics_array_01-682b1b2.stdout +++ b/tests/reference/asr-generics_array_01-682b1b2.stdout @@ -28,11 +28,11 @@ __asr_generic_f_0: (Function (SymbolTable - 214 + 203 { _lpython_return_variable: (Variable - 214 + 203 _lpython_return_variable [] ReturnVar @@ -48,7 +48,7 @@ ), i: (Variable - 214 + 203 i [] In @@ -64,7 +64,7 @@ ), lst: (Variable - 214 + 203 lst [] InOut @@ -106,11 +106,11 @@ .false. ) [] - [(Var 214 lst) - (Var 214 i)] + [(Var 203 lst) + (Var 203 i)] [(= (ArrayItem - (Var 214 lst) + (Var 203 lst) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -118,13 +118,13 @@ RowMajor () ) - (Var 214 i) + (Var 203 i) () ) (= - (Var 214 _lpython_return_variable) + (Var 203 _lpython_return_variable) (ArrayItem - (Var 214 lst) + (Var 203 lst) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -135,7 +135,7 @@ () ) (Return)] - (Var 214 _lpython_return_variable) + (Var 203 _lpython_return_variable) Public .false. .false. @@ -144,7 +144,7 @@ __main__global_stmts: (Function (SymbolTable - 215 + 204 { }) @@ -180,11 +180,11 @@ f: (Function (SymbolTable - 212 + 201 { _lpython_return_variable: (Variable - 212 + 201 _lpython_return_variable [] ReturnVar @@ -202,7 +202,7 @@ ), i: (Variable - 212 + 201 i [] In @@ -220,7 +220,7 @@ ), lst: (Variable - 212 + 201 lst [] InOut @@ -270,11 +270,11 @@ .false. ) [] - [(Var 212 lst) - (Var 212 i)] + [(Var 201 lst) + (Var 201 i)] [(= (ArrayItem - (Var 212 lst) + (Var 201 lst) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -284,13 +284,13 @@ RowMajor () ) - (Var 212 i) + (Var 201 i) () ) (= - (Var 212 _lpython_return_variable) + (Var 201 _lpython_return_variable) (ArrayItem - (Var 212 lst) + (Var 201 lst) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -303,7 +303,7 @@ () ) (Return)] - (Var 212 _lpython_return_variable) + (Var 201 _lpython_return_variable) Public .false. .false. @@ -312,11 +312,11 @@ use_array: (Function (SymbolTable - 213 + 202 { array: (Variable - 213 + 202 array [] Local @@ -337,7 +337,7 @@ ), x: (Variable - 213 + 202 x [] Local @@ -370,7 +370,7 @@ [__asr_generic_f_0] [] [(= - (Var 213 array) + (Var 202 array) (ArrayConstant [] (Array @@ -384,7 +384,7 @@ () ) (= - (Var 213 x) + (Var 202 x) (IntegerConstant 69 (Integer 4)) () ) @@ -394,7 +394,7 @@ 2 __asr_generic_f_0 () [((ArrayPhysicalCast - (Var 213 array) + (Var 202 array) FixedSizeArray DescriptorArray (Array @@ -405,7 +405,7 @@ ) () )) - ((Var 213 x))] + ((Var 202 x))] (Integer 4) () () @@ -430,11 +430,11 @@ main_program: (Program (SymbolTable - 216 + 205 { __main__global_stmts: (ExternalSymbol - 216 + 205 __main__global_stmts 2 __main__global_stmts __main__ @@ -446,7 +446,7 @@ main_program [__main__] [(SubroutineCall - 216 __main__global_stmts + 205 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-generics_array_02-22c8dc1.json b/tests/reference/asr-generics_array_02-22c8dc1.json index 2b1f94015b..d120fab6da 100644 --- a/tests/reference/asr-generics_array_02-22c8dc1.json +++ b/tests/reference/asr-generics_array_02-22c8dc1.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-generics_array_02-22c8dc1.stdout", - "stdout_hash": "fede9f91850b04ac3a0d9f65474a7bb9fb8c9805f87f320425931ff5", + "stdout_hash": "6060b35873ff8fc00781889af581731a8c7cb148d2423dfef06bc14a", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-generics_array_02-22c8dc1.stdout b/tests/reference/asr-generics_array_02-22c8dc1.stdout index a5e3ad0447..4bbd63c4a5 100644 --- a/tests/reference/asr-generics_array_02-22c8dc1.stdout +++ b/tests/reference/asr-generics_array_02-22c8dc1.stdout @@ -28,11 +28,11 @@ __asr_generic_g_0: (Function (SymbolTable - 218 + 207 { a: (Variable - 218 + 207 a [n] InOut @@ -42,7 +42,7 @@ (Array (Integer 4) [((IntegerConstant 0 (Integer 4)) - (Var 218 n))] + (Var 207 n))] PointerToDataArray ) () @@ -53,7 +53,7 @@ ), b: (Variable - 218 + 207 b [n] InOut @@ -63,7 +63,7 @@ (Array (Integer 4) [((IntegerConstant 0 (Integer 4)) - (Var 218 n))] + (Var 207 n))] PointerToDataArray ) () @@ -74,7 +74,7 @@ ), i: (Variable - 218 + 207 i [] Local @@ -90,7 +90,7 @@ ), n: (Variable - 218 + 207 n [] In @@ -106,7 +106,7 @@ ), r: (Variable - 218 + 207 r [n] Local @@ -116,7 +116,7 @@ (Array (Integer 4) [((IntegerConstant 0 (Integer 4)) - (Var 218 n))] + (Var 207 n))] PointerToDataArray ) () @@ -162,17 +162,17 @@ .false. ) [add_integer] - [(Var 218 n) - (Var 218 a) - (Var 218 b)] + [(Var 207 n) + (Var 207 a) + (Var 207 b)] [(= - (Var 218 r) + (Var 207 r) (ArrayConstant [] (Array (Integer 4) [((IntegerConstant 0 (Integer 4)) - (Var 218 n))] + (Var 207 n))] PointerToDataArray ) RowMajor @@ -181,10 +181,10 @@ ) (DoLoop () - ((Var 218 i) + ((Var 207 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 218 n) + (Var 207 n) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -193,9 +193,9 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 218 r) + (Var 207 r) [(() - (Var 218 i) + (Var 207 i) ())] (Integer 4) RowMajor @@ -205,18 +205,18 @@ 2 add_integer () [((ArrayItem - (Var 218 a) + (Var 207 a) [(() - (Var 218 i) + (Var 207 i) ())] (Integer 4) RowMajor () )) ((ArrayItem - (Var 218 b) + (Var 207 b) [(() - (Var 218 i) + (Var 207 i) ())] (Integer 4) RowMajor @@ -232,7 +232,7 @@ (Print () [(ArrayItem - (Var 218 r) + (Var 207 r) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -252,11 +252,11 @@ __asr_generic_g_1: (Function (SymbolTable - 219 + 208 { a: (Variable - 219 + 208 a [n] InOut @@ -266,7 +266,7 @@ (Array (Real 4) [((IntegerConstant 0 (Integer 4)) - (Var 219 n))] + (Var 208 n))] PointerToDataArray ) () @@ -277,7 +277,7 @@ ), b: (Variable - 219 + 208 b [n] InOut @@ -287,7 +287,7 @@ (Array (Real 4) [((IntegerConstant 0 (Integer 4)) - (Var 219 n))] + (Var 208 n))] PointerToDataArray ) () @@ -298,7 +298,7 @@ ), i: (Variable - 219 + 208 i [] Local @@ -314,7 +314,7 @@ ), n: (Variable - 219 + 208 n [] In @@ -330,7 +330,7 @@ ), r: (Variable - 219 + 208 r [n] Local @@ -340,7 +340,7 @@ (Array (Real 4) [((IntegerConstant 0 (Integer 4)) - (Var 219 n))] + (Var 208 n))] PointerToDataArray ) () @@ -386,17 +386,17 @@ .false. ) [add_float] - [(Var 219 n) - (Var 219 a) - (Var 219 b)] + [(Var 208 n) + (Var 208 a) + (Var 208 b)] [(= - (Var 219 r) + (Var 208 r) (ArrayConstant [] (Array (Real 4) [((IntegerConstant 0 (Integer 4)) - (Var 219 n))] + (Var 208 n))] PointerToDataArray ) RowMajor @@ -405,10 +405,10 @@ ) (DoLoop () - ((Var 219 i) + ((Var 208 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 219 n) + (Var 208 n) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -417,9 +417,9 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 219 r) + (Var 208 r) [(() - (Var 219 i) + (Var 208 i) ())] (Real 4) RowMajor @@ -429,18 +429,18 @@ 2 add_float () [((ArrayItem - (Var 219 a) + (Var 208 a) [(() - (Var 219 i) + (Var 208 i) ())] (Real 4) RowMajor () )) ((ArrayItem - (Var 219 b) + (Var 208 b) [(() - (Var 219 i) + (Var 208 i) ())] (Real 4) RowMajor @@ -456,7 +456,7 @@ (Print () [(ArrayItem - (Var 219 r) + (Var 208 r) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -476,7 +476,7 @@ __main__global_stmts: (Function (SymbolTable - 220 + 209 { }) @@ -512,11 +512,11 @@ add: (Function (SymbolTable - 212 + 201 { _lpython_return_variable: (Variable - 212 + 201 _lpython_return_variable [] ReturnVar @@ -534,7 +534,7 @@ ), x: (Variable - 212 + 201 x [] In @@ -552,7 +552,7 @@ ), y: (Variable - 212 + 201 y [] In @@ -592,10 +592,10 @@ .true. ) [] - [(Var 212 x) - (Var 212 y)] + [(Var 201 x) + (Var 201 y)] [] - (Var 212 _lpython_return_variable) + (Var 201 _lpython_return_variable) Public .false. .false. @@ -604,11 +604,11 @@ add_float: (Function (SymbolTable - 214 + 203 { _lpython_return_variable: (Variable - 214 + 203 _lpython_return_variable [] ReturnVar @@ -624,7 +624,7 @@ ), x: (Variable - 214 + 203 x [] In @@ -640,7 +640,7 @@ ), y: (Variable - 214 + 203 y [] In @@ -672,21 +672,21 @@ .false. ) [] - [(Var 214 x) - (Var 214 y)] + [(Var 203 x) + (Var 203 y)] [(= - (Var 214 _lpython_return_variable) + (Var 203 _lpython_return_variable) (RealBinOp - (Var 214 x) + (Var 203 x) Add - (Var 214 y) + (Var 203 y) (Real 4) () ) () ) (Return)] - (Var 214 _lpython_return_variable) + (Var 203 _lpython_return_variable) Public .false. .false. @@ -695,11 +695,11 @@ add_integer: (Function (SymbolTable - 213 + 202 { _lpython_return_variable: (Variable - 213 + 202 _lpython_return_variable [] ReturnVar @@ -715,7 +715,7 @@ ), x: (Variable - 213 + 202 x [] In @@ -731,7 +731,7 @@ ), y: (Variable - 213 + 202 y [] In @@ -763,21 +763,21 @@ .false. ) [] - [(Var 213 x) - (Var 213 y)] + [(Var 202 x) + (Var 202 y)] [(= - (Var 213 _lpython_return_variable) + (Var 202 _lpython_return_variable) (IntegerBinOp - (Var 213 x) + (Var 202 x) Add - (Var 213 y) + (Var 202 y) (Integer 4) () ) () ) (Return)] - (Var 213 _lpython_return_variable) + (Var 202 _lpython_return_variable) Public .false. .false. @@ -786,11 +786,11 @@ g: (Function (SymbolTable - 215 + 204 { a: (Variable - 215 + 204 a [n] InOut @@ -802,7 +802,7 @@ T ) [((IntegerConstant 0 (Integer 4)) - (Var 215 n))] + (Var 204 n))] PointerToDataArray ) () @@ -813,7 +813,7 @@ ), b: (Variable - 215 + 204 b [n] InOut @@ -825,7 +825,7 @@ T ) [((IntegerConstant 0 (Integer 4)) - (Var 215 n))] + (Var 204 n))] PointerToDataArray ) () @@ -836,7 +836,7 @@ ), i: (Variable - 215 + 204 i [] Local @@ -852,7 +852,7 @@ ), n: (Variable - 215 + 204 n [] In @@ -868,7 +868,7 @@ ), r: (Variable - 215 + 204 r [n] Local @@ -880,7 +880,7 @@ T ) [((IntegerConstant 0 (Integer 4)) - (Var 215 n))] + (Var 204 n))] PointerToDataArray ) () @@ -930,11 +930,11 @@ .false. ) [add] - [(Var 215 n) - (Var 215 a) - (Var 215 b)] + [(Var 204 n) + (Var 204 a) + (Var 204 b)] [(= - (Var 215 r) + (Var 204 r) (ArrayConstant [] (Array @@ -942,7 +942,7 @@ T ) [((IntegerConstant 0 (Integer 4)) - (Var 215 n))] + (Var 204 n))] PointerToDataArray ) RowMajor @@ -951,10 +951,10 @@ ) (DoLoop () - ((Var 215 i) + ((Var 204 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 215 n) + (Var 204 n) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -963,9 +963,9 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 215 r) + (Var 204 r) [(() - (Var 215 i) + (Var 204 i) ())] (TypeParameter T @@ -977,9 +977,9 @@ 2 add () [((ArrayItem - (Var 215 a) + (Var 204 a) [(() - (Var 215 i) + (Var 204 i) ())] (TypeParameter T @@ -988,9 +988,9 @@ () )) ((ArrayItem - (Var 215 b) + (Var 204 b) [(() - (Var 215 i) + (Var 204 i) ())] (TypeParameter T @@ -1010,7 +1010,7 @@ (Print () [(ArrayItem - (Var 215 r) + (Var 204 r) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -1032,11 +1032,11 @@ main: (Function (SymbolTable - 216 + 205 { a_float: (Variable - 216 + 205 a_float [] Local @@ -1057,7 +1057,7 @@ ), a_int: (Variable - 216 + 205 a_int [] Local @@ -1078,7 +1078,7 @@ ), b_float: (Variable - 216 + 205 b_float [] Local @@ -1099,7 +1099,7 @@ ), b_int: (Variable - 216 + 205 b_int [] Local @@ -1138,7 +1138,7 @@ __asr_generic_g_1] [] [(= - (Var 216 a_int) + (Var 205 a_int) (ArrayConstant [] (Array @@ -1153,7 +1153,7 @@ ) (= (ArrayItem - (Var 216 a_int) + (Var 205 a_int) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -1165,7 +1165,7 @@ () ) (= - (Var 216 b_int) + (Var 205 b_int) (ArrayConstant [] (Array @@ -1180,7 +1180,7 @@ ) (= (ArrayItem - (Var 216 b_int) + (Var 205 b_int) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -1196,7 +1196,7 @@ () [((IntegerConstant 1 (Integer 4))) ((ArrayPhysicalCast - (Var 216 a_int) + (Var 205 a_int) FixedSizeArray PointerToDataArray (Array @@ -1208,7 +1208,7 @@ () )) ((ArrayPhysicalCast - (Var 216 b_int) + (Var 205 b_int) FixedSizeArray PointerToDataArray (Array @@ -1222,7 +1222,7 @@ () ) (= - (Var 216 a_float) + (Var 205 a_float) (ArrayConstant [] (Array @@ -1237,7 +1237,7 @@ ) (= (ArrayItem - (Var 216 a_float) + (Var 205 a_float) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -1260,7 +1260,7 @@ () ) (= - (Var 216 b_float) + (Var 205 b_float) (ArrayConstant [] (Array @@ -1275,7 +1275,7 @@ ) (= (ArrayItem - (Var 216 b_float) + (Var 205 b_float) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -1302,7 +1302,7 @@ () [((IntegerConstant 1 (Integer 4))) ((ArrayPhysicalCast - (Var 216 a_float) + (Var 205 a_float) FixedSizeArray PointerToDataArray (Array @@ -1314,7 +1314,7 @@ () )) ((ArrayPhysicalCast - (Var 216 b_float) + (Var 205 b_float) FixedSizeArray PointerToDataArray (Array @@ -1362,11 +1362,11 @@ main_program: (Program (SymbolTable - 221 + 210 { __main__global_stmts: (ExternalSymbol - 221 + 210 __main__global_stmts 2 __main__global_stmts __main__ @@ -1378,7 +1378,7 @@ main_program [__main__] [(SubroutineCall - 221 __main__global_stmts + 210 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-generics_array_03-fb3706c.json b/tests/reference/asr-generics_array_03-fb3706c.json index f8e631624b..af02823632 100644 --- a/tests/reference/asr-generics_array_03-fb3706c.json +++ b/tests/reference/asr-generics_array_03-fb3706c.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-generics_array_03-fb3706c.stdout", - "stdout_hash": "3ea43f85153ff741050ee6259f9775b907e1293074f180637e5824e0", + "stdout_hash": "39ded0e74b830a48eddb106954df6ac01c167e2517a188d8baf246ca", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-generics_array_03-fb3706c.stdout b/tests/reference/asr-generics_array_03-fb3706c.stdout index 933eec84b4..ba718219e6 100644 --- a/tests/reference/asr-generics_array_03-fb3706c.stdout +++ b/tests/reference/asr-generics_array_03-fb3706c.stdout @@ -28,11 +28,11 @@ __asr_generic_g_0: (Function (SymbolTable - 219 + 208 { _lpython_return_variable: (Variable - 219 + 208 _lpython_return_variable [n m] @@ -43,9 +43,9 @@ (Array (Integer 4) [((IntegerConstant 0 (Integer 4)) - (Var 219 n)) + (Var 208 n)) ((IntegerConstant 0 (Integer 4)) - (Var 219 m))] + (Var 208 m))] PointerToDataArray ) () @@ -56,7 +56,7 @@ ), a: (Variable - 219 + 208 a [n m] @@ -67,9 +67,9 @@ (Array (Integer 4) [((IntegerConstant 0 (Integer 4)) - (Var 219 n)) + (Var 208 n)) ((IntegerConstant 0 (Integer 4)) - (Var 219 m))] + (Var 208 m))] PointerToDataArray ) () @@ -80,7 +80,7 @@ ), b: (Variable - 219 + 208 b [n m] @@ -91,9 +91,9 @@ (Array (Integer 4) [((IntegerConstant 0 (Integer 4)) - (Var 219 n)) + (Var 208 n)) ((IntegerConstant 0 (Integer 4)) - (Var 219 m))] + (Var 208 m))] PointerToDataArray ) () @@ -104,7 +104,7 @@ ), i: (Variable - 219 + 208 i [] Local @@ -120,7 +120,7 @@ ), j: (Variable - 219 + 208 j [] Local @@ -136,7 +136,7 @@ ), m: (Variable - 219 + 208 m [] In @@ -152,7 +152,7 @@ ), n: (Variable - 219 + 208 n [] In @@ -168,7 +168,7 @@ ), r: (Variable - 219 + 208 r [n m] @@ -179,9 +179,9 @@ (Array (Integer 4) [((IntegerConstant 0 (Integer 4)) - (Var 219 n)) + (Var 208 n)) ((IntegerConstant 0 (Integer 4)) - (Var 219 m))] + (Var 208 m))] PointerToDataArray ) () @@ -255,20 +255,20 @@ .false. ) [add_integer] - [(Var 219 n) - (Var 219 m) - (Var 219 a) - (Var 219 b)] + [(Var 208 n) + (Var 208 m) + (Var 208 a) + (Var 208 b)] [(= - (Var 219 r) + (Var 208 r) (ArrayConstant [] (Array (Integer 4) [((IntegerConstant 0 (Integer 4)) - (Var 219 n)) + (Var 208 n)) ((IntegerConstant 0 (Integer 4)) - (Var 219 m))] + (Var 208 m))] PointerToDataArray ) RowMajor @@ -277,10 +277,10 @@ ) (DoLoop () - ((Var 219 i) + ((Var 208 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 219 n) + (Var 208 n) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -289,10 +289,10 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 219 j) + ((Var 208 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 219 m) + (Var 208 m) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -301,12 +301,12 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 219 r) + (Var 208 r) [(() - (Var 219 i) + (Var 208 i) ()) (() - (Var 219 j) + (Var 208 j) ())] (Integer 4) RowMajor @@ -316,24 +316,24 @@ 2 add_integer () [((ArrayItem - (Var 219 a) + (Var 208 a) [(() - (Var 219 i) + (Var 208 i) ()) (() - (Var 219 j) + (Var 208 j) ())] (Integer 4) RowMajor () )) ((ArrayItem - (Var 219 b) + (Var 208 b) [(() - (Var 219 i) + (Var 208 i) ()) (() - (Var 219 j) + (Var 208 j) ())] (Integer 4) RowMajor @@ -350,7 +350,7 @@ (Print () [(ArrayItem - (Var 219 r) + (Var 208 r) [(() (IntegerConstant 0 (Integer 4)) ()) @@ -364,7 +364,7 @@ () () )] - (Var 219 _lpython_return_variable) + (Var 208 _lpython_return_variable) Public .false. .false. @@ -373,11 +373,11 @@ __asr_generic_g_1: (Function (SymbolTable - 220 + 209 { _lpython_return_variable: (Variable - 220 + 209 _lpython_return_variable [n m] @@ -388,9 +388,9 @@ (Array (Real 4) [((IntegerConstant 0 (Integer 4)) - (Var 220 n)) + (Var 209 n)) ((IntegerConstant 0 (Integer 4)) - (Var 220 m))] + (Var 209 m))] PointerToDataArray ) () @@ -401,7 +401,7 @@ ), a: (Variable - 220 + 209 a [n m] @@ -412,9 +412,9 @@ (Array (Real 4) [((IntegerConstant 0 (Integer 4)) - (Var 220 n)) + (Var 209 n)) ((IntegerConstant 0 (Integer 4)) - (Var 220 m))] + (Var 209 m))] PointerToDataArray ) () @@ -425,7 +425,7 @@ ), b: (Variable - 220 + 209 b [n m] @@ -436,9 +436,9 @@ (Array (Real 4) [((IntegerConstant 0 (Integer 4)) - (Var 220 n)) + (Var 209 n)) ((IntegerConstant 0 (Integer 4)) - (Var 220 m))] + (Var 209 m))] PointerToDataArray ) () @@ -449,7 +449,7 @@ ), i: (Variable - 220 + 209 i [] Local @@ -465,7 +465,7 @@ ), j: (Variable - 220 + 209 j [] Local @@ -481,7 +481,7 @@ ), m: (Variable - 220 + 209 m [] In @@ -497,7 +497,7 @@ ), n: (Variable - 220 + 209 n [] In @@ -513,7 +513,7 @@ ), r: (Variable - 220 + 209 r [n m] @@ -524,9 +524,9 @@ (Array (Real 4) [((IntegerConstant 0 (Integer 4)) - (Var 220 n)) + (Var 209 n)) ((IntegerConstant 0 (Integer 4)) - (Var 220 m))] + (Var 209 m))] PointerToDataArray ) () @@ -600,20 +600,20 @@ .false. ) [add_float] - [(Var 220 n) - (Var 220 m) - (Var 220 a) - (Var 220 b)] + [(Var 209 n) + (Var 209 m) + (Var 209 a) + (Var 209 b)] [(= - (Var 220 r) + (Var 209 r) (ArrayConstant [] (Array (Real 4) [((IntegerConstant 0 (Integer 4)) - (Var 220 n)) + (Var 209 n)) ((IntegerConstant 0 (Integer 4)) - (Var 220 m))] + (Var 209 m))] PointerToDataArray ) RowMajor @@ -622,10 +622,10 @@ ) (DoLoop () - ((Var 220 i) + ((Var 209 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 220 n) + (Var 209 n) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -634,10 +634,10 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 220 j) + ((Var 209 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 220 m) + (Var 209 m) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -646,12 +646,12 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 220 r) + (Var 209 r) [(() - (Var 220 i) + (Var 209 i) ()) (() - (Var 220 j) + (Var 209 j) ())] (Real 4) RowMajor @@ -661,24 +661,24 @@ 2 add_float () [((ArrayItem - (Var 220 a) + (Var 209 a) [(() - (Var 220 i) + (Var 209 i) ()) (() - (Var 220 j) + (Var 209 j) ())] (Real 4) RowMajor () )) ((ArrayItem - (Var 220 b) + (Var 209 b) [(() - (Var 220 i) + (Var 209 i) ()) (() - (Var 220 j) + (Var 209 j) ())] (Real 4) RowMajor @@ -695,7 +695,7 @@ (Print () [(ArrayItem - (Var 220 r) + (Var 209 r) [(() (IntegerConstant 0 (Integer 4)) ()) @@ -709,7 +709,7 @@ () () )] - (Var 220 _lpython_return_variable) + (Var 209 _lpython_return_variable) Public .false. .false. @@ -718,7 +718,7 @@ __main__global_stmts: (Function (SymbolTable - 221 + 210 { }) @@ -754,11 +754,11 @@ add: (Function (SymbolTable - 212 + 201 { _lpython_return_variable: (Variable - 212 + 201 _lpython_return_variable [] ReturnVar @@ -776,7 +776,7 @@ ), x: (Variable - 212 + 201 x [] In @@ -794,7 +794,7 @@ ), y: (Variable - 212 + 201 y [] In @@ -834,10 +834,10 @@ .true. ) [] - [(Var 212 x) - (Var 212 y)] + [(Var 201 x) + (Var 201 y)] [] - (Var 212 _lpython_return_variable) + (Var 201 _lpython_return_variable) Public .false. .false. @@ -846,11 +846,11 @@ add_float: (Function (SymbolTable - 214 + 203 { _lpython_return_variable: (Variable - 214 + 203 _lpython_return_variable [] ReturnVar @@ -866,7 +866,7 @@ ), x: (Variable - 214 + 203 x [] In @@ -882,7 +882,7 @@ ), y: (Variable - 214 + 203 y [] In @@ -914,21 +914,21 @@ .false. ) [] - [(Var 214 x) - (Var 214 y)] + [(Var 203 x) + (Var 203 y)] [(= - (Var 214 _lpython_return_variable) + (Var 203 _lpython_return_variable) (RealBinOp - (Var 214 x) + (Var 203 x) Add - (Var 214 y) + (Var 203 y) (Real 4) () ) () ) (Return)] - (Var 214 _lpython_return_variable) + (Var 203 _lpython_return_variable) Public .false. .false. @@ -937,11 +937,11 @@ add_integer: (Function (SymbolTable - 213 + 202 { _lpython_return_variable: (Variable - 213 + 202 _lpython_return_variable [] ReturnVar @@ -957,7 +957,7 @@ ), x: (Variable - 213 + 202 x [] In @@ -973,7 +973,7 @@ ), y: (Variable - 213 + 202 y [] In @@ -1005,21 +1005,21 @@ .false. ) [] - [(Var 213 x) - (Var 213 y)] + [(Var 202 x) + (Var 202 y)] [(= - (Var 213 _lpython_return_variable) + (Var 202 _lpython_return_variable) (IntegerBinOp - (Var 213 x) + (Var 202 x) Add - (Var 213 y) + (Var 202 y) (Integer 4) () ) () ) (Return)] - (Var 213 _lpython_return_variable) + (Var 202 _lpython_return_variable) Public .false. .false. @@ -1028,11 +1028,11 @@ g: (Function (SymbolTable - 215 + 204 { _lpython_return_variable: (Variable - 215 + 204 _lpython_return_variable [n m] @@ -1045,9 +1045,9 @@ T ) [((IntegerConstant 0 (Integer 4)) - (Var 215 n)) + (Var 204 n)) ((IntegerConstant 0 (Integer 4)) - (Var 215 m))] + (Var 204 m))] PointerToDataArray ) () @@ -1058,7 +1058,7 @@ ), a: (Variable - 215 + 204 a [n m] @@ -1071,9 +1071,9 @@ T ) [((IntegerConstant 0 (Integer 4)) - (Var 215 n)) + (Var 204 n)) ((IntegerConstant 0 (Integer 4)) - (Var 215 m))] + (Var 204 m))] PointerToDataArray ) () @@ -1084,7 +1084,7 @@ ), b: (Variable - 215 + 204 b [n m] @@ -1097,9 +1097,9 @@ T ) [((IntegerConstant 0 (Integer 4)) - (Var 215 n)) + (Var 204 n)) ((IntegerConstant 0 (Integer 4)) - (Var 215 m))] + (Var 204 m))] PointerToDataArray ) () @@ -1110,7 +1110,7 @@ ), i: (Variable - 215 + 204 i [] Local @@ -1126,7 +1126,7 @@ ), j: (Variable - 215 + 204 j [] Local @@ -1142,7 +1142,7 @@ ), m: (Variable - 215 + 204 m [] In @@ -1158,7 +1158,7 @@ ), n: (Variable - 215 + 204 n [] In @@ -1174,7 +1174,7 @@ ), r: (Variable - 215 + 204 r [n m] @@ -1187,9 +1187,9 @@ T ) [((IntegerConstant 0 (Integer 4)) - (Var 215 n)) + (Var 204 n)) ((IntegerConstant 0 (Integer 4)) - (Var 215 m))] + (Var 204 m))] PointerToDataArray ) () @@ -1269,12 +1269,12 @@ .false. ) [add] - [(Var 215 n) - (Var 215 m) - (Var 215 a) - (Var 215 b)] + [(Var 204 n) + (Var 204 m) + (Var 204 a) + (Var 204 b)] [(= - (Var 215 r) + (Var 204 r) (ArrayConstant [] (Array @@ -1282,9 +1282,9 @@ T ) [((IntegerConstant 0 (Integer 4)) - (Var 215 n)) + (Var 204 n)) ((IntegerConstant 0 (Integer 4)) - (Var 215 m))] + (Var 204 m))] PointerToDataArray ) RowMajor @@ -1293,10 +1293,10 @@ ) (DoLoop () - ((Var 215 i) + ((Var 204 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 215 n) + (Var 204 n) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -1305,10 +1305,10 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 215 j) + ((Var 204 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp - (Var 215 m) + (Var 204 m) Sub (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -1317,12 +1317,12 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 215 r) + (Var 204 r) [(() - (Var 215 i) + (Var 204 i) ()) (() - (Var 215 j) + (Var 204 j) ())] (TypeParameter T @@ -1334,12 +1334,12 @@ 2 add () [((ArrayItem - (Var 215 a) + (Var 204 a) [(() - (Var 215 i) + (Var 204 i) ()) (() - (Var 215 j) + (Var 204 j) ())] (TypeParameter T @@ -1348,12 +1348,12 @@ () )) ((ArrayItem - (Var 215 b) + (Var 204 b) [(() - (Var 215 i) + (Var 204 i) ()) (() - (Var 215 j) + (Var 204 j) ())] (TypeParameter T @@ -1374,7 +1374,7 @@ (Print () [(ArrayItem - (Var 215 r) + (Var 204 r) [(() (IntegerConstant 0 (Integer 4)) ()) @@ -1390,7 +1390,7 @@ () () )] - (Var 215 _lpython_return_variable) + (Var 204 _lpython_return_variable) Public .false. .false. @@ -1417,11 +1417,11 @@ main: (Function (SymbolTable - 216 + 205 { __lcompilers_dummy: (Variable - 216 + 205 __lcompilers_dummy [] Local @@ -1444,7 +1444,7 @@ ), __lcompilers_dummy1: (Variable - 216 + 205 __lcompilers_dummy1 [] Local @@ -1467,7 +1467,7 @@ ), a_float: (Variable - 216 + 205 a_float [] Local @@ -1490,7 +1490,7 @@ ), a_int: (Variable - 216 + 205 a_int [] Local @@ -1513,7 +1513,7 @@ ), b_float: (Variable - 216 + 205 b_float [] Local @@ -1536,7 +1536,7 @@ ), b_int: (Variable - 216 + 205 b_int [] Local @@ -1577,7 +1577,7 @@ __asr_generic_g_1] [] [(= - (Var 216 a_int) + (Var 205 a_int) (ArrayConstant [] (Array @@ -1594,7 +1594,7 @@ ) (= (ArrayItem - (Var 216 a_int) + (Var 205 a_int) [(() (IntegerConstant 0 (Integer 4)) ()) @@ -1609,7 +1609,7 @@ () ) (= - (Var 216 b_int) + (Var 205 b_int) (ArrayConstant [] (Array @@ -1626,7 +1626,7 @@ ) (= (ArrayItem - (Var 216 b_int) + (Var 205 b_int) [(() (IntegerConstant 0 (Integer 4)) ()) @@ -1641,14 +1641,14 @@ () ) (= - (Var 216 __lcompilers_dummy) + (Var 205 __lcompilers_dummy) (FunctionCall 2 __asr_generic_g_0 () [((IntegerConstant 1 (Integer 4))) ((IntegerConstant 1 (Integer 4))) ((ArrayPhysicalCast - (Var 216 a_int) + (Var 205 a_int) FixedSizeArray PointerToDataArray (Array @@ -1662,7 +1662,7 @@ () )) ((ArrayPhysicalCast - (Var 216 b_int) + (Var 205 b_int) FixedSizeArray PointerToDataArray (Array @@ -1689,7 +1689,7 @@ () ) (= - (Var 216 a_float) + (Var 205 a_float) (ArrayConstant [] (Array @@ -1706,7 +1706,7 @@ ) (= (ArrayItem - (Var 216 a_float) + (Var 205 a_float) [(() (IntegerConstant 0 (Integer 4)) ()) @@ -1729,7 +1729,7 @@ () ) (= - (Var 216 b_float) + (Var 205 b_float) (ArrayConstant [] (Array @@ -1746,7 +1746,7 @@ ) (= (ArrayItem - (Var 216 b_float) + (Var 205 b_float) [(() (IntegerConstant 0 (Integer 4)) ()) @@ -1769,14 +1769,14 @@ () ) (= - (Var 216 __lcompilers_dummy1) + (Var 205 __lcompilers_dummy1) (FunctionCall 2 __asr_generic_g_1 () [((IntegerConstant 1 (Integer 4))) ((IntegerConstant 1 (Integer 4))) ((ArrayPhysicalCast - (Var 216 a_float) + (Var 205 a_float) FixedSizeArray PointerToDataArray (Array @@ -1790,7 +1790,7 @@ () )) ((ArrayPhysicalCast - (Var 216 b_float) + (Var 205 b_float) FixedSizeArray PointerToDataArray (Array @@ -1851,11 +1851,11 @@ main_program: (Program (SymbolTable - 222 + 211 { __main__global_stmts: (ExternalSymbol - 222 + 211 __main__global_stmts 2 __main__global_stmts __main__ @@ -1867,7 +1867,7 @@ main_program [__main__] [(SubroutineCall - 222 __main__global_stmts + 211 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-structs_05-fa98307.json b/tests/reference/asr-structs_05-fa98307.json index 834ce1324d..a0f7b5bf70 100644 --- a/tests/reference/asr-structs_05-fa98307.json +++ b/tests/reference/asr-structs_05-fa98307.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-structs_05-fa98307.stdout", - "stdout_hash": "1fecfc2d130b3b8a65c33c0b182c79e959054945548dca0fd53527f3", + "stdout_hash": "3f7e68ccebad6bea7e857ff10c72bf579bd9620b47635d9eeff31a46", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-structs_05-fa98307.stdout b/tests/reference/asr-structs_05-fa98307.stdout index 08b0c7561c..e6c27d31a3 100644 --- a/tests/reference/asr-structs_05-fa98307.stdout +++ b/tests/reference/asr-structs_05-fa98307.stdout @@ -10,11 +10,11 @@ A: (StructType (SymbolTable - 212 + 201 { a: (Variable - 212 + 201 a [] Local @@ -30,7 +30,7 @@ ), b: (Variable - 212 + 201 b [] Local @@ -46,7 +46,7 @@ ), c: (Variable - 212 + 201 c [] Local @@ -62,7 +62,7 @@ ), d: (Variable - 212 + 201 d [] Local @@ -78,7 +78,7 @@ ), x: (Variable - 212 + 201 x [] Local @@ -94,7 +94,7 @@ ), y: (Variable - 212 + 201 y [] Local @@ -110,7 +110,7 @@ ), z: (Variable - 212 + 201 z [] Local @@ -151,7 +151,7 @@ __main__global_stmts: (Function (SymbolTable - 218 + 207 { }) @@ -187,11 +187,11 @@ g: (Function (SymbolTable - 216 + 205 { y: (Variable - 216 + 205 y [] Local @@ -233,7 +233,7 @@ update_2] [] [(= - (Var 216 y) + (Var 205 y) (ArrayConstant [] (Array @@ -250,7 +250,7 @@ ) (= (ArrayItem - (Var 216 y) + (Var 205 y) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -310,7 +310,7 @@ ) (= (ArrayItem - (Var 216 y) + (Var 205 y) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -372,7 +372,7 @@ 2 verify () [((ArrayPhysicalCast - (Var 216 y) + (Var 205 y) FixedSizeArray DescriptorArray (Array @@ -401,7 +401,7 @@ 2 update_1 () [((ArrayItem - (Var 216 y) + (Var 205 y) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -417,7 +417,7 @@ 2 update_2 () [((ArrayPhysicalCast - (Var 216 y) + (Var 205 y) FixedSizeArray DescriptorArray (Array @@ -436,7 +436,7 @@ 2 verify () [((ArrayPhysicalCast - (Var 216 y) + (Var 205 y) FixedSizeArray DescriptorArray (Array @@ -470,11 +470,11 @@ update_1: (Function (SymbolTable - 214 + 203 { s: (Variable - 214 + 203 s [] InOut @@ -509,11 +509,11 @@ .false. ) [] - [(Var 214 s)] + [(Var 203 s)] [(= (StructInstanceMember - (Var 214 s) - 212 x + (Var 203 s) + 201 x (Integer 4) () ) @@ -522,8 +522,8 @@ ) (= (StructInstanceMember - (Var 214 s) - 212 y + (Var 203 s) + 201 y (Real 8) () ) @@ -535,8 +535,8 @@ ) (= (StructInstanceMember - (Var 214 s) - 212 z + (Var 203 s) + 201 z (Integer 8) () ) @@ -550,8 +550,8 @@ ) (= (StructInstanceMember - (Var 214 s) - 212 a + (Var 203 s) + 201 a (Real 4) () ) @@ -571,8 +571,8 @@ ) (= (StructInstanceMember - (Var 214 s) - 212 b + (Var 203 s) + 201 b (Integer 2) () ) @@ -586,8 +586,8 @@ ) (= (StructInstanceMember - (Var 214 s) - 212 c + (Var 203 s) + 201 c (Integer 1) () ) @@ -608,11 +608,11 @@ update_2: (Function (SymbolTable - 215 + 204 { s: (Variable - 215 + 204 s [] InOut @@ -657,11 +657,11 @@ .false. ) [] - [(Var 215 s)] + [(Var 204 s)] [(= (StructInstanceMember (ArrayItem - (Var 215 s) + (Var 204 s) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -671,7 +671,7 @@ RowMajor () ) - 212 x + 201 x (Integer 4) () ) @@ -681,7 +681,7 @@ (= (StructInstanceMember (ArrayItem - (Var 215 s) + (Var 204 s) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -691,7 +691,7 @@ RowMajor () ) - 212 y + 201 y (Real 8) () ) @@ -704,7 +704,7 @@ (= (StructInstanceMember (ArrayItem - (Var 215 s) + (Var 204 s) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -714,7 +714,7 @@ RowMajor () ) - 212 z + 201 z (Integer 8) () ) @@ -729,7 +729,7 @@ (= (StructInstanceMember (ArrayItem - (Var 215 s) + (Var 204 s) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -739,7 +739,7 @@ RowMajor () ) - 212 a + 201 a (Real 4) () ) @@ -760,7 +760,7 @@ (= (StructInstanceMember (ArrayItem - (Var 215 s) + (Var 204 s) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -770,7 +770,7 @@ RowMajor () ) - 212 b + 201 b (Integer 2) () ) @@ -785,7 +785,7 @@ (= (StructInstanceMember (ArrayItem - (Var 215 s) + (Var 204 s) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -795,7 +795,7 @@ RowMajor () ) - 212 c + 201 c (Integer 1) () ) @@ -816,11 +816,11 @@ verify: (Function (SymbolTable - 213 + 202 { eps: (Variable - 213 + 202 eps [] Local @@ -836,7 +836,7 @@ ), s: (Variable - 213 + 202 s [] InOut @@ -859,7 +859,7 @@ ), s0: (Variable - 213 + 202 s0 [] Local @@ -877,7 +877,7 @@ ), s1: (Variable - 213 + 202 s1 [] Local @@ -895,7 +895,7 @@ ), x1: (Variable - 213 + 202 x1 [] In @@ -911,7 +911,7 @@ ), x2: (Variable - 213 + 202 x2 [] In @@ -927,7 +927,7 @@ ), y1: (Variable - 213 + 202 y1 [] In @@ -943,7 +943,7 @@ ), y2: (Variable - 213 + 202 y2 [] In @@ -985,13 +985,13 @@ .false. ) [] - [(Var 213 s) - (Var 213 x1) - (Var 213 y1) - (Var 213 x2) - (Var 213 y2)] + [(Var 202 s) + (Var 202 x1) + (Var 202 y1) + (Var 202 x2) + (Var 202 y2)] [(= - (Var 213 eps) + (Var 202 eps) (RealConstant 0.000000 (Real 8) @@ -999,9 +999,9 @@ () ) (= - (Var 213 s0) + (Var 202 s0) (ArrayItem - (Var 213 s) + (Var 202 s) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -1016,44 +1016,44 @@ (Print () [(StructInstanceMember - (Var 213 s0) - 212 x + (Var 202 s0) + 201 x (Integer 4) () ) (StructInstanceMember - (Var 213 s0) - 212 y + (Var 202 s0) + 201 y (Real 8) () ) (StructInstanceMember - (Var 213 s0) - 212 z + (Var 202 s0) + 201 z (Integer 8) () ) (StructInstanceMember - (Var 213 s0) - 212 a + (Var 202 s0) + 201 a (Real 4) () ) (StructInstanceMember - (Var 213 s0) - 212 b + (Var 202 s0) + 201 b (Integer 2) () ) (StructInstanceMember - (Var 213 s0) - 212 c + (Var 202 s0) + 201 c (Integer 1) () ) (StructInstanceMember - (Var 213 s0) - 212 d + (Var 202 s0) + 201 d (Logical 4) () )] @@ -1063,13 +1063,13 @@ (Assert (IntegerCompare (StructInstanceMember - (Var 213 s0) - 212 x + (Var 202 s0) + 201 x (Integer 4) () ) Eq - (Var 213 x1) + (Var 202 x1) (Logical 4) () ) @@ -1081,13 +1081,13 @@ Abs [(RealBinOp (StructInstanceMember - (Var 213 s0) - 212 y + (Var 202 s0) + 201 y (Real 8) () ) Sub - (Var 213 y1) + (Var 202 y1) (Real 8) () )] @@ -1096,7 +1096,7 @@ () ) Lt - (Var 213 eps) + (Var 202 eps) (Logical 4) () ) @@ -1105,14 +1105,14 @@ (Assert (IntegerCompare (StructInstanceMember - (Var 213 s0) - 212 z + (Var 202 s0) + 201 z (Integer 8) () ) Eq (Cast - (Var 213 x1) + (Var 202 x1) IntegerToInteger (Integer 8) () @@ -1128,14 +1128,14 @@ Abs [(RealBinOp (StructInstanceMember - (Var 213 s0) - 212 a + (Var 202 s0) + 201 a (Real 4) () ) Sub (Cast - (Var 213 y1) + (Var 202 y1) RealToReal (Real 4) () @@ -1168,14 +1168,14 @@ (Assert (IntegerCompare (StructInstanceMember - (Var 213 s0) - 212 b + (Var 202 s0) + 201 b (Integer 2) () ) Eq (Cast - (Var 213 x1) + (Var 202 x1) IntegerToInteger (Integer 2) () @@ -1188,14 +1188,14 @@ (Assert (IntegerCompare (StructInstanceMember - (Var 213 s0) - 212 c + (Var 202 s0) + 201 c (Integer 1) () ) Eq (Cast - (Var 213 x1) + (Var 202 x1) IntegerToInteger (Integer 1) () @@ -1207,17 +1207,17 @@ ) (Assert (StructInstanceMember - (Var 213 s0) - 212 d + (Var 202 s0) + 201 d (Logical 4) () ) () ) (= - (Var 213 s1) + (Var 202 s1) (ArrayItem - (Var 213 s) + (Var 202 s) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -1232,44 +1232,44 @@ (Print () [(StructInstanceMember - (Var 213 s1) - 212 x + (Var 202 s1) + 201 x (Integer 4) () ) (StructInstanceMember - (Var 213 s1) - 212 y + (Var 202 s1) + 201 y (Real 8) () ) (StructInstanceMember - (Var 213 s1) - 212 z + (Var 202 s1) + 201 z (Integer 8) () ) (StructInstanceMember - (Var 213 s1) - 212 a + (Var 202 s1) + 201 a (Real 4) () ) (StructInstanceMember - (Var 213 s1) - 212 b + (Var 202 s1) + 201 b (Integer 2) () ) (StructInstanceMember - (Var 213 s1) - 212 c + (Var 202 s1) + 201 c (Integer 1) () ) (StructInstanceMember - (Var 213 s1) - 212 d + (Var 202 s1) + 201 d (Logical 4) () )] @@ -1279,13 +1279,13 @@ (Assert (IntegerCompare (StructInstanceMember - (Var 213 s1) - 212 x + (Var 202 s1) + 201 x (Integer 4) () ) Eq - (Var 213 x2) + (Var 202 x2) (Logical 4) () ) @@ -1297,13 +1297,13 @@ Abs [(RealBinOp (StructInstanceMember - (Var 213 s1) - 212 y + (Var 202 s1) + 201 y (Real 8) () ) Sub - (Var 213 y2) + (Var 202 y2) (Real 8) () )] @@ -1312,7 +1312,7 @@ () ) Lt - (Var 213 eps) + (Var 202 eps) (Logical 4) () ) @@ -1321,14 +1321,14 @@ (Assert (IntegerCompare (StructInstanceMember - (Var 213 s1) - 212 z + (Var 202 s1) + 201 z (Integer 8) () ) Eq (Cast - (Var 213 x2) + (Var 202 x2) IntegerToInteger (Integer 8) () @@ -1344,14 +1344,14 @@ Abs [(RealBinOp (StructInstanceMember - (Var 213 s1) - 212 a + (Var 202 s1) + 201 a (Real 4) () ) Sub (Cast - (Var 213 y2) + (Var 202 y2) RealToReal (Real 4) () @@ -1384,14 +1384,14 @@ (Assert (IntegerCompare (StructInstanceMember - (Var 213 s1) - 212 b + (Var 202 s1) + 201 b (Integer 2) () ) Eq (Cast - (Var 213 x2) + (Var 202 x2) IntegerToInteger (Integer 2) () @@ -1404,14 +1404,14 @@ (Assert (IntegerCompare (StructInstanceMember - (Var 213 s1) - 212 c + (Var 202 s1) + 201 c (Integer 1) () ) Eq (Cast - (Var 213 x2) + (Var 202 x2) IntegerToInteger (Integer 1) () @@ -1423,8 +1423,8 @@ ) (Assert (StructInstanceMember - (Var 213 s1) - 212 d + (Var 202 s1) + 201 d (Logical 4) () ) @@ -1447,11 +1447,11 @@ main_program: (Program (SymbolTable - 219 + 208 { __main__global_stmts: (ExternalSymbol - 219 + 208 __main__global_stmts 2 __main__global_stmts __main__ @@ -1463,7 +1463,7 @@ main_program [__main__] [(SubroutineCall - 219 __main__global_stmts + 208 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_bool_binop-f856ef0.json b/tests/reference/asr-test_bool_binop-f856ef0.json index 2d04fd5a5c..b74825e8d7 100644 --- a/tests/reference/asr-test_bool_binop-f856ef0.json +++ b/tests/reference/asr-test_bool_binop-f856ef0.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_bool_binop-f856ef0.stdout", - "stdout_hash": "17f23bdb23ec6588306416cfc406f24efad6516162c5ef0df1d3d82b", + "stdout_hash": "b2d6b1205576cabc7c44ae611eec55ba5af026dbd918972e05e8f7da", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_bool_binop-f856ef0.stdout b/tests/reference/asr-test_bool_binop-f856ef0.stdout index 3044123cc3..f93267c185 100644 --- a/tests/reference/asr-test_bool_binop-f856ef0.stdout +++ b/tests/reference/asr-test_bool_binop-f856ef0.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 130 + 4 { }) @@ -48,26 +48,6 @@ (SymbolTable 3 { - _lpython_floordiv: - (ExternalSymbol - 3 - _lpython_floordiv - 4 _lpython_floordiv - lpython_builtin - [] - _lpython_floordiv - Private - ), - _lpython_floordiv@__lpython_overloaded_10___lpython_floordiv: - (ExternalSymbol - 3 - _lpython_floordiv@__lpython_overloaded_10___lpython_floordiv - 4 __lpython_overloaded_10___lpython_floordiv - lpython_builtin - [] - __lpython_overloaded_10___lpython_floordiv - Public - ), b1: (Variable 3 @@ -148,7 +128,7 @@ [] .false. ) - [_lpython_floordiv@__lpython_overloaded_10___lpython_floordiv] + [] [] [(= (Var 3 i) @@ -264,23 +244,22 @@ (= (Var 3 i) (Cast - (FunctionCall - 3 _lpython_floordiv@__lpython_overloaded_10___lpython_floordiv - 3 _lpython_floordiv - [((LogicalConstant + (IntrinsicScalarFunction + FloorDiv + [(LogicalConstant .true. (Logical 4) - )) - ((LogicalConstant + ) + (LogicalConstant .true. (Logical 4) - ))] + )] + 0 (Logical 4) (LogicalConstant .true. - (Logical 1) + (Logical 4) ) - () ) LogicalToInteger (Integer 4) @@ -301,23 +280,22 @@ (= (Var 3 i) (Cast - (FunctionCall - 3 _lpython_floordiv@__lpython_overloaded_10___lpython_floordiv - 3 _lpython_floordiv - [((LogicalConstant + (IntrinsicScalarFunction + FloorDiv + [(LogicalConstant .false. (Logical 4) - )) - ((LogicalConstant + ) + (LogicalConstant .true. (Logical 4) - ))] + )] + 0 (Logical 4) (LogicalConstant .false. - (Logical 1) + (Logical 4) ) - () ) LogicalToInteger (Integer 4) @@ -430,20 +408,18 @@ ) }) __main__ - [lpython_builtin] + [] .false. .false. ), - lpython_builtin: - (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable - 131 + 5 { __main__global_stmts: (ExternalSymbol - 131 + 5 __main__global_stmts 2 __main__global_stmts __main__ @@ -455,7 +431,7 @@ main_program [__main__] [(SubroutineCall - 131 __main__global_stmts + 5 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.json b/tests/reference/asr-test_builtin_bin-52ba9fa.json index 57546e707c..7161e3a8b6 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.json +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_bin-52ba9fa.stdout", - "stdout_hash": "1e890169860970de5e3854bf64c7ffbc1fd23b063fce4ab0de9b1e16", + "stdout_hash": "b3d1005ae778682be163f4a836405735b4521430ea2d26bfc49cae12", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_bin-52ba9fa.stdout b/tests/reference/asr-test_builtin_bin-52ba9fa.stdout index a50ed9c0b0..5497b1299d 100644 --- a/tests/reference/asr-test_builtin_bin-52ba9fa.stdout +++ b/tests/reference/asr-test_builtin_bin-52ba9fa.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 130 + 119 { }) @@ -244,11 +244,11 @@ main_program: (Program (SymbolTable - 131 + 120 { __main__global_stmts: (ExternalSymbol - 131 + 120 __main__global_stmts 2 __main__global_stmts __main__ @@ -260,7 +260,7 @@ main_program [__main__] [(SubroutineCall - 131 __main__global_stmts + 120 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_builtin_bool-330223a.json b/tests/reference/asr-test_builtin_bool-330223a.json index 4a7b92ccc3..aa9dd94fda 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.json +++ b/tests/reference/asr-test_builtin_bool-330223a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_bool-330223a.stdout", - "stdout_hash": "377cdab21d1ba71b7d6a3e9bf9f40ba475b5b9b4cd9e006ed667b111", + "stdout_hash": "3752d25de1c20fd790217573771973e3af84ffbb1bdcd345099029e3", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_bool-330223a.stdout b/tests/reference/asr-test_builtin_bool-330223a.stdout index 2d392fb76e..cc514a16d8 100644 --- a/tests/reference/asr-test_builtin_bool-330223a.stdout +++ b/tests/reference/asr-test_builtin_bool-330223a.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 130 + 119 { }) @@ -869,11 +869,11 @@ main_program: (Program (SymbolTable - 131 + 120 { __main__global_stmts: (ExternalSymbol - 131 + 120 __main__global_stmts 2 __main__global_stmts __main__ @@ -885,7 +885,7 @@ main_program [__main__] [(SubroutineCall - 131 __main__global_stmts + 120 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_builtin_hex-64bd268.json b/tests/reference/asr-test_builtin_hex-64bd268.json index 3652308699..06f2572907 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.json +++ b/tests/reference/asr-test_builtin_hex-64bd268.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_hex-64bd268.stdout", - "stdout_hash": "1a7f0461d913632f1ec589d9e7dabb691a6a79867a0bf6a479e63f4c", + "stdout_hash": "3ee188d377c463b59225031d3d1f0bf9384d91a8eef9c203f829fd30", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_hex-64bd268.stdout b/tests/reference/asr-test_builtin_hex-64bd268.stdout index e5d421a35d..c0176738cf 100644 --- a/tests/reference/asr-test_builtin_hex-64bd268.stdout +++ b/tests/reference/asr-test_builtin_hex-64bd268.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 130 + 119 { }) @@ -219,11 +219,11 @@ main_program: (Program (SymbolTable - 131 + 120 { __main__global_stmts: (ExternalSymbol - 131 + 120 __main__global_stmts 2 __main__global_stmts __main__ @@ -235,7 +235,7 @@ main_program [__main__] [(SubroutineCall - 131 __main__global_stmts + 120 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_builtin_oct-20b9066.json b/tests/reference/asr-test_builtin_oct-20b9066.json index d984c8a154..b88e3212f0 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.json +++ b/tests/reference/asr-test_builtin_oct-20b9066.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_oct-20b9066.stdout", - "stdout_hash": "04ee7955a5200e6df2403aca8f3fc666ce2cb55ccbd41a1090f8b237", + "stdout_hash": "1032b2d04f48ec8a0bba1b13fbfe6764465b44b90e51702d9d098ce0", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_oct-20b9066.stdout b/tests/reference/asr-test_builtin_oct-20b9066.stdout index a80105ec3d..0aa9d61529 100644 --- a/tests/reference/asr-test_builtin_oct-20b9066.stdout +++ b/tests/reference/asr-test_builtin_oct-20b9066.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 130 + 119 { }) @@ -219,11 +219,11 @@ main_program: (Program (SymbolTable - 131 + 120 { __main__global_stmts: (ExternalSymbol - 131 + 120 __main__global_stmts 2 __main__global_stmts __main__ @@ -235,7 +235,7 @@ main_program [__main__] [(SubroutineCall - 131 __main__global_stmts + 120 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.json b/tests/reference/asr-test_builtin_pow-f02fcda.json index f7fd73e344..7db2c1efd0 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.json +++ b/tests/reference/asr-test_builtin_pow-f02fcda.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_pow-f02fcda.stdout", - "stdout_hash": "15fe045c2a79d13f694ef48aeeb36591c591c48c1ac1cfa616fd34d5", + "stdout_hash": "a7d94321eaec571a74e7b6c52bd9f200e814ae6511e4425f7363908e", "stderr": "asr-test_builtin_pow-f02fcda.stderr", "stderr_hash": "859ce76c74748f2d32c7eab92cfbba789a78d4cbf5818646b99806ea", "returncode": 0 diff --git a/tests/reference/asr-test_builtin_pow-f02fcda.stdout b/tests/reference/asr-test_builtin_pow-f02fcda.stdout index 0eb947ae52..fb4a5219d8 100644 --- a/tests/reference/asr-test_builtin_pow-f02fcda.stdout +++ b/tests/reference/asr-test_builtin_pow-f02fcda.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 130 + 119 { }) @@ -1892,11 +1892,11 @@ main_program: (Program (SymbolTable - 131 + 120 { __main__global_stmts: (ExternalSymbol - 131 + 120 __main__global_stmts 2 __main__global_stmts __main__ @@ -1908,7 +1908,7 @@ main_program [__main__] [(SubroutineCall - 131 __main__global_stmts + 120 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_builtin_round-7417a21.json b/tests/reference/asr-test_builtin_round-7417a21.json index 94c4d73866..4d65afb41e 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.json +++ b/tests/reference/asr-test_builtin_round-7417a21.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_builtin_round-7417a21.stdout", - "stdout_hash": "0c3484ee554ad7a87897572f1e69a962b2bb507b34ba76d86880b64e", + "stdout_hash": "efced280509a5f5e7b5e8197234ba1bf4bab25aba561082257bf31bc", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_builtin_round-7417a21.stdout b/tests/reference/asr-test_builtin_round-7417a21.stdout index 85f613e93f..28feda2e17 100644 --- a/tests/reference/asr-test_builtin_round-7417a21.stdout +++ b/tests/reference/asr-test_builtin_round-7417a21.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 130 + 119 { }) @@ -892,11 +892,11 @@ main_program: (Program (SymbolTable - 131 + 120 { __main__global_stmts: (ExternalSymbol - 131 + 120 __main__global_stmts 2 __main__global_stmts __main__ @@ -908,7 +908,7 @@ main_program [__main__] [(SubroutineCall - 131 __main__global_stmts + 120 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_complex_01-a6def58.json b/tests/reference/asr-test_complex_01-a6def58.json index c57c3fec00..1d94b533bb 100644 --- a/tests/reference/asr-test_complex_01-a6def58.json +++ b/tests/reference/asr-test_complex_01-a6def58.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_complex_01-a6def58.stdout", - "stdout_hash": "fa123339a9e4fbca85b07a00c17aab429c1bb46deced489478c9873b", + "stdout_hash": "437162e161ea134837f68f4adb7cb115a3ca76bb1fb139ec64a7cff0", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_complex_01-a6def58.stdout b/tests/reference/asr-test_complex_01-a6def58.stdout index 2534b667e8..7255e4941a 100644 --- a/tests/reference/asr-test_complex_01-a6def58.stdout +++ b/tests/reference/asr-test_complex_01-a6def58.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 134 + 123 { }) @@ -1986,11 +1986,11 @@ main_program: (Program (SymbolTable - 135 + 124 { __main__global_stmts: (ExternalSymbol - 135 + 124 __main__global_stmts 2 __main__global_stmts __main__ @@ -2002,7 +2002,7 @@ main_program [__main__] [(SubroutineCall - 135 __main__global_stmts + 124 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_complex_02-782ba2d.json b/tests/reference/asr-test_complex_02-782ba2d.json index a182a53af3..1f5c64e69b 100644 --- a/tests/reference/asr-test_complex_02-782ba2d.json +++ b/tests/reference/asr-test_complex_02-782ba2d.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_complex_02-782ba2d.stdout", - "stdout_hash": "065f842790f986f276b50c69fb831c21de22dcb13fb0e410256ece9d", + "stdout_hash": "6c9aa6962b8460ef6a7854c7a980f9a4fbfc982031fefd110dcff763", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_complex_02-782ba2d.stdout b/tests/reference/asr-test_complex_02-782ba2d.stdout index 9f210e3c30..9935836c29 100644 --- a/tests/reference/asr-test_complex_02-782ba2d.stdout +++ b/tests/reference/asr-test_complex_02-782ba2d.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 133 + 122 { }) @@ -691,11 +691,11 @@ main_program: (Program (SymbolTable - 134 + 123 { __main__global_stmts: (ExternalSymbol - 134 + 123 __main__global_stmts 2 __main__global_stmts __main__ @@ -707,7 +707,7 @@ main_program [__main__] [(SubroutineCall - 134 __main__global_stmts + 123 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_max_min-3c2fc51.json b/tests/reference/asr-test_max_min-3c2fc51.json index 85fb31c8e9..f215c7e43a 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.json +++ b/tests/reference/asr-test_max_min-3c2fc51.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_max_min-3c2fc51.stdout", - "stdout_hash": "a964d176be4ba6471573df6a31c6c4cf316b64cedcefd405aca2a8e4", + "stdout_hash": "5a3cbd3ae5c31da6a1b6f73c630c7182220bc60cefe3368efdae9ca5", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_max_min-3c2fc51.stdout b/tests/reference/asr-test_max_min-3c2fc51.stdout index a0e977b909..21fafa7072 100644 --- a/tests/reference/asr-test_max_min-3c2fc51.stdout +++ b/tests/reference/asr-test_max_min-3c2fc51.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 134 + 123 { }) @@ -787,11 +787,11 @@ main_program: (Program (SymbolTable - 135 + 124 { __main__global_stmts: (ExternalSymbol - 135 + 124 __main__global_stmts 2 __main__global_stmts __main__ @@ -803,7 +803,7 @@ main_program [__main__] [(SubroutineCall - 135 __main__global_stmts + 124 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_numpy_03-e600a49.json b/tests/reference/asr-test_numpy_03-e600a49.json index 5310df1c0a..2423e90a9c 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.json +++ b/tests/reference/asr-test_numpy_03-e600a49.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_numpy_03-e600a49.stdout", - "stdout_hash": "7a6698c2c9b692acd326ecb2d1f9237927d923c4bf28a4ca9463ef7e", + "stdout_hash": "4ed432239936438278e7d3c4db3d9100bb70fbac91710e3961e5569f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_numpy_03-e600a49.stdout b/tests/reference/asr-test_numpy_03-e600a49.stdout index f5bd52338d..f145e74e8e 100644 --- a/tests/reference/asr-test_numpy_03-e600a49.stdout +++ b/tests/reference/asr-test_numpy_03-e600a49.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 229 + 218 { }) @@ -46,11 +46,11 @@ test_1d_to_nd: (Function (SymbolTable - 213 + 202 { a: (Variable - 213 + 202 a [] Local @@ -73,7 +73,7 @@ ), b: (Variable - 213 + 202 b [] Local @@ -92,100 +92,9 @@ Required .false. ), - block: - (Block - (SymbolTable - 220 - { - _lpython_floordiv: - (ExternalSymbol - 220 - _lpython_floordiv - 86 _lpython_floordiv - lpython_builtin - [] - _lpython_floordiv - Private - ), - _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv: - (ExternalSymbol - 220 - _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv - 86 __lpython_overloaded_6___lpython_floordiv - lpython_builtin - [] - __lpython_overloaded_6___lpython_floordiv - Public - ) - }) - block - [(= - (Var 213 i) - (FunctionCall - 220 _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv - 220 _lpython_floordiv - [((Var 213 k)) - ((IntegerConstant 16 (Integer 4)))] - (Integer 4) - () - () - ) - () - ) - (= - (Var 213 j) - (IntegerBinOp - (Var 213 k) - Sub - (IntegerBinOp - (Var 213 i) - Mul - (IntegerConstant 16 (Integer 4)) - (Integer 4) - () - ) - (Integer 4) - () - ) - () - ) - (= - (ArrayItem - (Var 213 b) - [(() - (Var 213 k) - ())] - (Real 8) - RowMajor - () - ) - (RealBinOp - (Cast - (IntegerBinOp - (Var 213 i) - Add - (Var 213 j) - (Integer 4) - () - ) - IntegerToReal - (Real 8) - () - ) - Add - (RealConstant - 0.500000 - (Real 8) - ) - (Real 8) - () - ) - () - )] - ), c: (Variable - 213 + 202 c [] Local @@ -210,7 +119,7 @@ ), d: (Variable - 213 + 202 d [] InOut @@ -231,7 +140,7 @@ ), eps: (Variable - 213 + 202 eps [] Local @@ -247,7 +156,7 @@ ), i: (Variable - 213 + 202 i [] Local @@ -263,7 +172,7 @@ ), j: (Variable - 213 + 202 j [] Local @@ -279,7 +188,7 @@ ), k: (Variable - 213 + 202 k [] Local @@ -295,7 +204,7 @@ ), l: (Variable - 213 + 202 l [] Local @@ -311,7 +220,7 @@ ), newshape: (Variable - 213 + 202 newshape [] Local @@ -332,7 +241,7 @@ ), newshape1: (Variable - 213 + 202 newshape1 [] Local @@ -372,10 +281,10 @@ [] .false. ) - [_lpython_floordiv@__lpython_overloaded_6___lpython_floordiv] - [(Var 213 d)] + [] + [(Var 202 d)] [(= - (Var 213 eps) + (Var 202 eps) (RealConstant 0.000000 (Real 8) @@ -383,7 +292,7 @@ () ) (= - (Var 213 b) + (Var 202 b) (ArrayConstant [] (Array @@ -398,7 +307,7 @@ ) (DoLoop () - ((Var 213 k) + ((Var 202 k) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 256 (Integer 4)) @@ -408,13 +317,71 @@ (IntegerConstant 255 (Integer 4)) ) (IntegerConstant 1 (Integer 4))) - [(BlockCall - -1 - 213 block + [(= + (Var 202 i) + (IntrinsicScalarFunction + FloorDiv + [(Var 202 k) + (IntegerConstant 16 (Integer 4))] + 0 + (Integer 4) + () + ) + () + ) + (= + (Var 202 j) + (IntegerBinOp + (Var 202 k) + Sub + (IntegerBinOp + (Var 202 i) + Mul + (IntegerConstant 16 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (= + (ArrayItem + (Var 202 b) + [(() + (Var 202 k) + ())] + (Real 8) + RowMajor + () + ) + (RealBinOp + (Cast + (IntegerBinOp + (Var 202 i) + Add + (Var 202 j) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + Add + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + ) + () )] ) (= - (Var 213 a) + (Var 202 a) (ArrayConstant [] (Array @@ -430,7 +397,7 @@ () ) (= - (Var 213 newshape) + (Var 202 newshape) (ArrayConstant [] (Array @@ -445,7 +412,7 @@ ) (= (ArrayItem - (Var 213 newshape) + (Var 202 newshape) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -458,7 +425,7 @@ ) (= (ArrayItem - (Var 213 newshape) + (Var 202 newshape) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -470,11 +437,11 @@ () ) (= - (Var 213 a) + (Var 202 a) (ArrayReshape - (Var 213 b) + (Var 202 b) (ArrayPhysicalCast - (Var 213 newshape) + (Var 202 newshape) FixedSizeArray DescriptorArray (Array @@ -497,7 +464,7 @@ ) (DoLoop () - ((Var 213 i) + ((Var 202 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -509,7 +476,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 213 j) + ((Var 202 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -526,12 +493,12 @@ [(RealBinOp (RealBinOp (ArrayItem - (Var 213 a) + (Var 202 a) [(() - (Var 213 i) + (Var 202 i) ()) (() - (Var 213 j) + (Var 202 j) ())] (Real 8) RowMajor @@ -540,9 +507,9 @@ Sub (Cast (IntegerBinOp - (Var 213 i) + (Var 202 i) Add - (Var 213 j) + (Var 202 j) (Integer 4) () ) @@ -566,7 +533,7 @@ () ) LtE - (Var 213 eps) + (Var 202 eps) (Logical 4) () ) @@ -575,7 +542,7 @@ )] ) (= - (Var 213 c) + (Var 202 c) (ArrayConstant [] (Array @@ -593,7 +560,7 @@ () ) (= - (Var 213 newshape1) + (Var 202 newshape1) (ArrayConstant [] (Array @@ -608,7 +575,7 @@ ) (= (ArrayItem - (Var 213 newshape1) + (Var 202 newshape1) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -621,7 +588,7 @@ ) (= (ArrayItem - (Var 213 newshape1) + (Var 202 newshape1) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -634,7 +601,7 @@ ) (= (ArrayItem - (Var 213 newshape1) + (Var 202 newshape1) [(() (IntegerConstant 2 (Integer 4)) ())] @@ -646,11 +613,11 @@ () ) (= - (Var 213 c) + (Var 202 c) (ArrayReshape - (Var 213 d) + (Var 202 d) (ArrayPhysicalCast - (Var 213 newshape1) + (Var 202 newshape1) FixedSizeArray DescriptorArray (Array @@ -673,7 +640,7 @@ ) (DoLoop () - ((Var 213 i) + ((Var 202 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -685,7 +652,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 213 j) + ((Var 202 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -697,7 +664,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 213 k) + ((Var 202 k) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -714,15 +681,15 @@ [(RealBinOp (RealBinOp (ArrayItem - (Var 213 c) + (Var 202 c) [(() - (Var 213 i) + (Var 202 i) ()) (() - (Var 213 j) + (Var 202 j) ()) (() - (Var 213 k) + (Var 202 k) ())] (Real 8) RowMajor @@ -732,14 +699,14 @@ (Cast (IntegerBinOp (IntegerBinOp - (Var 213 i) + (Var 202 i) Add - (Var 213 j) + (Var 202 j) (Integer 4) () ) Add - (Var 213 k) + (Var 202 k) (Integer 4) () ) @@ -763,7 +730,7 @@ () ) LtE - (Var 213 eps) + (Var 202 eps) (Logical 4) () ) @@ -781,11 +748,11 @@ test_nd_to_1d: (Function (SymbolTable - 212 + 201 { a: (Variable - 212 + 201 a [] InOut @@ -808,7 +775,7 @@ ), b: (Variable - 212 + 201 b [] Local @@ -827,284 +794,9 @@ Required .false. ), - block: - (Block - (SymbolTable - 215 - { - _lpython_floordiv: - (ExternalSymbol - 215 - _lpython_floordiv - 86 _lpython_floordiv - lpython_builtin - [] - _lpython_floordiv - Private - ), - _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv: - (ExternalSymbol - 215 - _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv - 86 __lpython_overloaded_6___lpython_floordiv - lpython_builtin - [] - __lpython_overloaded_6___lpython_floordiv - Public - ) - }) - block - [(= - (Var 212 i) - (FunctionCall - 215 _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv - 215 _lpython_floordiv - [((Var 212 k)) - ((IntegerConstant 16 (Integer 4)))] - (Integer 4) - () - () - ) - () - ) - (= - (Var 212 j) - (IntegerBinOp - (Var 212 k) - Sub - (IntegerBinOp - (Var 212 i) - Mul - (IntegerConstant 16 (Integer 4)) - (Integer 4) - () - ) - (Integer 4) - () - ) - () - ) - (Assert - (RealCompare - (IntrinsicScalarFunction - Abs - [(RealBinOp - (RealBinOp - (ArrayItem - (Var 212 b) - [(() - (Var 212 k) - ())] - (Real 8) - RowMajor - () - ) - Sub - (Cast - (IntegerBinOp - (Var 212 i) - Add - (Var 212 j) - (Integer 4) - () - ) - IntegerToReal - (Real 8) - () - ) - (Real 8) - () - ) - Sub - (RealConstant - 0.500000 - (Real 8) - ) - (Real 8) - () - )] - 0 - (Real 8) - () - ) - LtE - (Var 212 eps) - (Logical 4) - () - ) - () - )] - ), - block1: - (Block - (SymbolTable - 219 - { - _lpython_floordiv: - (ExternalSymbol - 219 - _lpython_floordiv - 86 _lpython_floordiv - lpython_builtin - [] - _lpython_floordiv - Private - ), - _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv: - (ExternalSymbol - 219 - _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv - 86 __lpython_overloaded_6___lpython_floordiv - lpython_builtin - [] - __lpython_overloaded_6___lpython_floordiv - Public - ) - }) - block1 - [(= - (Var 212 i) - (Cast - (RealBinOp - (Cast - (Var 212 l) - IntegerToReal - (Real 8) - () - ) - Div - (Cast - (IntegerConstant 256 (Integer 4)) - IntegerToReal - (Real 8) - (RealConstant - 256.000000 - (Real 8) - ) - ) - (Real 8) - () - ) - RealToInteger - (Integer 4) - () - ) - () - ) - (= - (Var 212 j) - (FunctionCall - 219 _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv - 219 _lpython_floordiv - [((IntegerBinOp - (Var 212 l) - Sub - (IntegerBinOp - (Var 212 i) - Mul - (IntegerConstant 256 (Integer 4)) - (Integer 4) - () - ) - (Integer 4) - () - )) - ((IntegerConstant 16 (Integer 4)))] - (Integer 4) - () - () - ) - () - ) - (= - (Var 212 k) - (IntegerBinOp - (IntegerBinOp - (Var 212 l) - Sub - (IntegerBinOp - (Var 212 i) - Mul - (IntegerConstant 256 (Integer 4)) - (Integer 4) - () - ) - (Integer 4) - () - ) - Sub - (IntegerBinOp - (Var 212 j) - Mul - (IntegerConstant 16 (Integer 4)) - (Integer 4) - () - ) - (Integer 4) - () - ) - () - ) - (Assert - (RealCompare - (IntrinsicScalarFunction - Abs - [(RealBinOp - (RealBinOp - (ArrayItem - (Var 212 d) - [(() - (Var 212 l) - ())] - (Real 8) - RowMajor - () - ) - Sub - (Cast - (IntegerBinOp - (IntegerBinOp - (Var 212 i) - Add - (Var 212 j) - (Integer 4) - () - ) - Add - (Var 212 k) - (Integer 4) - () - ) - IntegerToReal - (Real 8) - () - ) - (Real 8) - () - ) - Sub - (RealConstant - 0.500000 - (Real 8) - ) - (Real 8) - () - )] - 0 - (Real 8) - () - ) - LtE - (Var 212 eps) - (Logical 4) - () - ) - () - )] - ), c: (Variable - 212 + 201 c [] Local @@ -1129,7 +821,7 @@ ), d: (Variable - 212 + 201 d [] Local @@ -1150,7 +842,7 @@ ), eps: (Variable - 212 + 201 eps [] Local @@ -1166,7 +858,7 @@ ), i: (Variable - 212 + 201 i [] Local @@ -1182,7 +874,7 @@ ), j: (Variable - 212 + 201 j [] Local @@ -1198,7 +890,7 @@ ), k: (Variable - 212 + 201 k [] Local @@ -1214,7 +906,7 @@ ), l: (Variable - 212 + 201 l [] Local @@ -1230,7 +922,7 @@ ), newshape: (Variable - 212 + 201 newshape [] Local @@ -1251,7 +943,7 @@ ), newshape1: (Variable - 212 + 201 newshape1 [] Local @@ -1293,10 +985,10 @@ [] .false. ) - [_lpython_floordiv@__lpython_overloaded_6___lpython_floordiv] - [(Var 212 a)] + [] + [(Var 201 a)] [(= - (Var 212 eps) + (Var 201 eps) (RealConstant 0.000000 (Real 8) @@ -1304,7 +996,7 @@ () ) (= - (Var 212 b) + (Var 201 b) (ArrayConstant [] (Array @@ -1318,7 +1010,7 @@ () ) (= - (Var 212 newshape) + (Var 201 newshape) (ArrayConstant [] (Array @@ -1333,7 +1025,7 @@ ) (= (ArrayItem - (Var 212 newshape) + (Var 201 newshape) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -1345,11 +1037,11 @@ () ) (= - (Var 212 b) + (Var 201 b) (ArrayReshape - (Var 212 a) + (Var 201 a) (ArrayPhysicalCast - (Var 212 newshape) + (Var 201 newshape) FixedSizeArray DescriptorArray (Array @@ -1372,7 +1064,7 @@ ) (DoLoop () - ((Var 212 k) + ((Var 201 k) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 256 (Integer 4)) @@ -1382,13 +1074,88 @@ (IntegerConstant 255 (Integer 4)) ) (IntegerConstant 1 (Integer 4))) - [(BlockCall - -1 - 212 block + [(= + (Var 201 i) + (IntrinsicScalarFunction + FloorDiv + [(Var 201 k) + (IntegerConstant 16 (Integer 4))] + 0 + (Integer 4) + () + ) + () + ) + (= + (Var 201 j) + (IntegerBinOp + (Var 201 k) + Sub + (IntegerBinOp + (Var 201 i) + Mul + (IntegerConstant 16 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (RealBinOp + (ArrayItem + (Var 201 b) + [(() + (Var 201 k) + ())] + (Real 8) + RowMajor + () + ) + Sub + (Cast + (IntegerBinOp + (Var 201 i) + Add + (Var 201 j) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + (Real 8) + () + ) + Sub + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 201 eps) + (Logical 4) + () + ) + () )] ) (= - (Var 212 c) + (Var 201 c) (ArrayConstant [] (Array @@ -1406,7 +1173,7 @@ () ) (= - (Var 212 c) + (Var 201 c) (ArrayConstant [] (Array @@ -1425,7 +1192,7 @@ ) (DoLoop () - ((Var 212 i) + ((Var 201 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -1437,7 +1204,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 212 j) + ((Var 201 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -1449,7 +1216,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 212 k) + ((Var 201 k) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -1461,15 +1228,15 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 212 c) + (Var 201 c) [(() - (Var 212 i) + (Var 201 i) ()) (() - (Var 212 j) + (Var 201 j) ()) (() - (Var 212 k) + (Var 201 k) ())] (Real 8) RowMajor @@ -1479,14 +1246,14 @@ (Cast (IntegerBinOp (IntegerBinOp - (Var 212 i) + (Var 201 i) Add - (Var 212 j) + (Var 201 j) (Integer 4) () ) Add - (Var 212 k) + (Var 201 k) (Integer 4) () ) @@ -1508,7 +1275,7 @@ )] ) (= - (Var 212 d) + (Var 201 d) (ArrayConstant [] (Array @@ -1522,7 +1289,7 @@ () ) (= - (Var 212 newshape1) + (Var 201 newshape1) (ArrayConstant [] (Array @@ -1537,7 +1304,7 @@ ) (= (ArrayItem - (Var 212 newshape1) + (Var 201 newshape1) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -1549,11 +1316,11 @@ () ) (= - (Var 212 d) + (Var 201 d) (ArrayReshape - (Var 212 c) + (Var 201 c) (ArrayPhysicalCast - (Var 212 newshape1) + (Var 201 newshape1) FixedSizeArray DescriptorArray (Array @@ -1576,7 +1343,7 @@ ) (DoLoop () - ((Var 212 l) + ((Var 201 l) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 4096 (Integer 4)) @@ -1586,9 +1353,143 @@ (IntegerConstant 4095 (Integer 4)) ) (IntegerConstant 1 (Integer 4))) - [(BlockCall - -1 - 212 block1 + [(= + (Var 201 i) + (Cast + (RealBinOp + (Cast + (Var 201 l) + IntegerToReal + (Real 8) + () + ) + Div + (Cast + (IntegerConstant 256 (Integer 4)) + IntegerToReal + (Real 8) + (RealConstant + 256.000000 + (Real 8) + ) + ) + (Real 8) + () + ) + RealToInteger + (Integer 4) + () + ) + () + ) + (= + (Var 201 j) + (IntrinsicScalarFunction + FloorDiv + [(IntegerBinOp + (Var 201 l) + Sub + (IntegerBinOp + (Var 201 i) + Mul + (IntegerConstant 256 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + (IntegerConstant 16 (Integer 4))] + 0 + (Integer 4) + () + ) + () + ) + (= + (Var 201 k) + (IntegerBinOp + (IntegerBinOp + (Var 201 l) + Sub + (IntegerBinOp + (Var 201 i) + Mul + (IntegerConstant 256 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + Sub + (IntegerBinOp + (Var 201 j) + Mul + (IntegerConstant 16 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (Assert + (RealCompare + (IntrinsicScalarFunction + Abs + [(RealBinOp + (RealBinOp + (ArrayItem + (Var 201 d) + [(() + (Var 201 l) + ())] + (Real 8) + RowMajor + () + ) + Sub + (Cast + (IntegerBinOp + (IntegerBinOp + (Var 201 i) + Add + (Var 201 j) + (Integer 4) + () + ) + Add + (Var 201 k) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + (Real 8) + () + ) + Sub + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + )] + 0 + (Real 8) + () + ) + LtE + (Var 201 eps) + (Logical 4) + () + ) + () )] )] () @@ -1600,11 +1501,11 @@ test_reshape_with_argument: (Function (SymbolTable - 214 + 203 { a: (Variable - 214 + 203 a [] Local @@ -1625,159 +1526,9 @@ Required .false. ), - block: - (Block - (SymbolTable - 228 - { - _lpython_floordiv: - (ExternalSymbol - 228 - _lpython_floordiv - 86 _lpython_floordiv - lpython_builtin - [] - _lpython_floordiv - Private - ), - _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv: - (ExternalSymbol - 228 - _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv - 86 __lpython_overloaded_6___lpython_floordiv - lpython_builtin - [] - __lpython_overloaded_6___lpython_floordiv - Public - ) - }) - block - [(= - (Var 214 i) - (Cast - (RealBinOp - (Cast - (Var 214 l) - IntegerToReal - (Real 8) - () - ) - Div - (Cast - (IntegerConstant 256 (Integer 4)) - IntegerToReal - (Real 8) - (RealConstant - 256.000000 - (Real 8) - ) - ) - (Real 8) - () - ) - RealToInteger - (Integer 4) - () - ) - () - ) - (= - (Var 214 j) - (FunctionCall - 228 _lpython_floordiv@__lpython_overloaded_6___lpython_floordiv - 228 _lpython_floordiv - [((IntegerBinOp - (Var 214 l) - Sub - (IntegerBinOp - (Var 214 i) - Mul - (IntegerConstant 256 (Integer 4)) - (Integer 4) - () - ) - (Integer 4) - () - )) - ((IntegerConstant 16 (Integer 4)))] - (Integer 4) - () - () - ) - () - ) - (= - (Var 214 k) - (IntegerBinOp - (IntegerBinOp - (Var 214 l) - Sub - (IntegerBinOp - (Var 214 i) - Mul - (IntegerConstant 256 (Integer 4)) - (Integer 4) - () - ) - (Integer 4) - () - ) - Sub - (IntegerBinOp - (Var 214 j) - Mul - (IntegerConstant 16 (Integer 4)) - (Integer 4) - () - ) - (Integer 4) - () - ) - () - ) - (= - (ArrayItem - (Var 214 d) - [(() - (Var 214 l) - ())] - (Real 8) - RowMajor - () - ) - (RealBinOp - (Cast - (IntegerBinOp - (IntegerBinOp - (Var 214 i) - Add - (Var 214 j) - (Integer 4) - () - ) - Add - (Var 214 k) - (Integer 4) - () - ) - IntegerToReal - (Real 8) - () - ) - Add - (RealConstant - 0.500000 - (Real 8) - ) - (Real 8) - () - ) - () - )] - ), d: (Variable - 214 + 203 d [] Local @@ -1798,7 +1549,7 @@ ), i: (Variable - 214 + 203 i [] Local @@ -1814,7 +1565,7 @@ ), j: (Variable - 214 + 203 j [] Local @@ -1830,7 +1581,7 @@ ), k: (Variable - 214 + 203 k [] Local @@ -1846,7 +1597,7 @@ ), l: (Variable - 214 + 203 l [] Local @@ -1876,12 +1627,11 @@ [] .false. ) - [_lpython_floordiv@__lpython_overloaded_6___lpython_floordiv - test_nd_to_1d + [test_nd_to_1d test_1d_to_nd] [] [(= - (Var 214 a) + (Var 203 a) (ArrayConstant [] (Array @@ -1898,7 +1648,7 @@ ) (DoLoop () - ((Var 214 i) + ((Var 203 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -1910,7 +1660,7 @@ (IntegerConstant 1 (Integer 4))) [(DoLoop () - ((Var 214 j) + ((Var 203 j) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 16 (Integer 4)) @@ -1922,12 +1672,12 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 214 a) + (Var 203 a) [(() - (Var 214 i) + (Var 203 i) ()) (() - (Var 214 j) + (Var 203 j) ())] (Real 8) RowMajor @@ -1936,9 +1686,9 @@ (RealBinOp (Cast (IntegerBinOp - (Var 214 i) + (Var 203 i) Add - (Var 214 j) + (Var 203 j) (Integer 4) () ) @@ -1962,7 +1712,7 @@ 2 test_nd_to_1d () [((ArrayPhysicalCast - (Var 214 a) + (Var 203 a) FixedSizeArray DescriptorArray (Array @@ -1978,7 +1728,7 @@ () ) (= - (Var 214 d) + (Var 203 d) (ArrayConstant [] (Array @@ -1993,7 +1743,7 @@ ) (DoLoop () - ((Var 214 l) + ((Var 203 l) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 4096 (Integer 4)) @@ -2003,16 +1753,133 @@ (IntegerConstant 4095 (Integer 4)) ) (IntegerConstant 1 (Integer 4))) - [(BlockCall - -1 - 214 block + [(= + (Var 203 i) + (Cast + (RealBinOp + (Cast + (Var 203 l) + IntegerToReal + (Real 8) + () + ) + Div + (Cast + (IntegerConstant 256 (Integer 4)) + IntegerToReal + (Real 8) + (RealConstant + 256.000000 + (Real 8) + ) + ) + (Real 8) + () + ) + RealToInteger + (Integer 4) + () + ) + () + ) + (= + (Var 203 j) + (IntrinsicScalarFunction + FloorDiv + [(IntegerBinOp + (Var 203 l) + Sub + (IntegerBinOp + (Var 203 i) + Mul + (IntegerConstant 256 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + (IntegerConstant 16 (Integer 4))] + 0 + (Integer 4) + () + ) + () + ) + (= + (Var 203 k) + (IntegerBinOp + (IntegerBinOp + (Var 203 l) + Sub + (IntegerBinOp + (Var 203 i) + Mul + (IntegerConstant 256 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + Sub + (IntegerBinOp + (Var 203 j) + Mul + (IntegerConstant 16 (Integer 4)) + (Integer 4) + () + ) + (Integer 4) + () + ) + () + ) + (= + (ArrayItem + (Var 203 d) + [(() + (Var 203 l) + ())] + (Real 8) + RowMajor + () + ) + (RealBinOp + (Cast + (IntegerBinOp + (IntegerBinOp + (Var 203 i) + Add + (Var 203 j) + (Integer 4) + () + ) + Add + (Var 203 k) + (Integer 4) + () + ) + IntegerToReal + (Real 8) + () + ) + Add + (RealConstant + 0.500000 + (Real 8) + ) + (Real 8) + () + ) + () )] ) (SubroutineCall 2 test_1d_to_nd () [((ArrayPhysicalCast - (Var 214 d) + (Var 203 d) FixedSizeArray DescriptorArray (Array @@ -2033,8 +1900,7 @@ ) }) __main__ - [lpython_builtin - numpy] + [numpy] .false. .false. ), @@ -2043,11 +1909,11 @@ main_program: (Program (SymbolTable - 230 + 219 { __main__global_stmts: (ExternalSymbol - 230 + 219 __main__global_stmts 2 __main__global_stmts __main__ @@ -2059,7 +1925,7 @@ main_program [__main__] [(SubroutineCall - 230 __main__global_stmts + 219 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_numpy_04-ecbb614.json b/tests/reference/asr-test_numpy_04-ecbb614.json index 40cacfd808..d0e74207c1 100644 --- a/tests/reference/asr-test_numpy_04-ecbb614.json +++ b/tests/reference/asr-test_numpy_04-ecbb614.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_numpy_04-ecbb614.stdout", - "stdout_hash": "c41b1c4320908a096d492b8a92673647857699700cbb28b7aee0e709", + "stdout_hash": "0d7174d8ccec4f912b225d9d579a7f42e550d776dd28dc081fc16711", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-test_numpy_04-ecbb614.stdout b/tests/reference/asr-test_numpy_04-ecbb614.stdout index fbc1c69e5d..90f4b193b1 100644 --- a/tests/reference/asr-test_numpy_04-ecbb614.stdout +++ b/tests/reference/asr-test_numpy_04-ecbb614.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 215 + 204 { }) @@ -46,7 +46,7 @@ check: (Function (SymbolTable - 214 + 203 { }) @@ -89,11 +89,11 @@ test_array_01: (Function (SymbolTable - 212 + 201 { eps: (Variable - 212 + 201 eps [] Local @@ -109,7 +109,7 @@ ), x: (Variable - 212 + 201 x [] Local @@ -147,7 +147,7 @@ [] [] [(= - (Var 212 x) + (Var 201 x) (ArrayConstant [(RealConstant 1.000000 @@ -172,7 +172,7 @@ () ) (= - (Var 212 eps) + (Var 201 eps) (RealConstant 0.000000 (Real 8) @@ -185,7 +185,7 @@ Abs [(RealBinOp (ArrayItem - (Var 212 x) + (Var 201 x) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -206,7 +206,7 @@ () ) Lt - (Var 212 eps) + (Var 201 eps) (Logical 4) () ) @@ -218,7 +218,7 @@ Abs [(RealBinOp (ArrayItem - (Var 212 x) + (Var 201 x) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -239,7 +239,7 @@ () ) Lt - (Var 212 eps) + (Var 201 eps) (Logical 4) () ) @@ -251,7 +251,7 @@ Abs [(RealBinOp (ArrayItem - (Var 212 x) + (Var 201 x) [(() (IntegerConstant 2 (Integer 4)) ())] @@ -272,7 +272,7 @@ () ) Lt - (Var 212 eps) + (Var 201 eps) (Logical 4) () ) @@ -287,11 +287,11 @@ test_array_02: (Function (SymbolTable - 213 + 202 { eps: (Variable - 213 + 202 eps [] Local @@ -307,7 +307,7 @@ ), x: (Variable - 213 + 202 x [] Local @@ -345,7 +345,7 @@ [] [] [(= - (Var 213 x) + (Var 202 x) (ArrayConstant [(IntegerConstant 1 (Integer 4)) (IntegerConstant 2 (Integer 4)) @@ -361,7 +361,7 @@ () ) (= - (Var 213 eps) + (Var 202 eps) (RealConstant 0.000000 (Real 8) @@ -375,7 +375,7 @@ Abs [(IntegerBinOp (ArrayItem - (Var 213 x) + (Var 202 x) [(() (IntegerConstant 0 (Integer 4)) ())] @@ -397,7 +397,7 @@ () ) Lt - (Var 213 eps) + (Var 202 eps) (Logical 4) () ) @@ -410,7 +410,7 @@ Abs [(IntegerBinOp (ArrayItem - (Var 213 x) + (Var 202 x) [(() (IntegerConstant 1 (Integer 4)) ())] @@ -432,7 +432,7 @@ () ) Lt - (Var 213 eps) + (Var 202 eps) (Logical 4) () ) @@ -445,7 +445,7 @@ Abs [(IntegerBinOp (ArrayItem - (Var 213 x) + (Var 202 x) [(() (IntegerConstant 2 (Integer 4)) ())] @@ -467,7 +467,7 @@ () ) Lt - (Var 213 eps) + (Var 202 eps) (Logical 4) () ) @@ -490,11 +490,11 @@ main_program: (Program (SymbolTable - 216 + 205 { __main__global_stmts: (ExternalSymbol - 216 + 205 __main__global_stmts 2 __main__global_stmts __main__ @@ -506,7 +506,7 @@ main_program [__main__] [(SubroutineCall - 216 __main__global_stmts + 205 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_pow-3f5d550.json b/tests/reference/asr-test_pow-3f5d550.json index 85f0c528a4..b65280a0df 100644 --- a/tests/reference/asr-test_pow-3f5d550.json +++ b/tests/reference/asr-test_pow-3f5d550.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-test_pow-3f5d550.stdout", - "stdout_hash": "5582b0edc3023c39d0fb65cc5aaf3c7defb77e787c725b44240bda38", + "stdout_hash": "726fae2bb158304b087ba542674db17a8bc39ba174d234f8dcbe99f3", "stderr": "asr-test_pow-3f5d550.stderr", "stderr_hash": "3d950301563cce75654f28bf41f6f53428ed1f5ae997774345f374a3", "returncode": 0 diff --git a/tests/reference/asr-test_pow-3f5d550.stdout b/tests/reference/asr-test_pow-3f5d550.stdout index 6b3c8a30af..5e658298dc 100644 --- a/tests/reference/asr-test_pow-3f5d550.stdout +++ b/tests/reference/asr-test_pow-3f5d550.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 130 + 119 { }) @@ -132,11 +132,11 @@ main_program: (Program (SymbolTable - 131 + 120 { __main__global_stmts: (ExternalSymbol - 131 + 120 __main__global_stmts 2 __main__global_stmts __main__ @@ -148,7 +148,7 @@ main_program [__main__] [(SubroutineCall - 131 __main__global_stmts + 120 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/asr-test_zero_division-3dd84e8.json b/tests/reference/asr-test_zero_division-3dd84e8.json index 129e181bef..5c135e76d4 100644 --- a/tests/reference/asr-test_zero_division-3dd84e8.json +++ b/tests/reference/asr-test_zero_division-3dd84e8.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_zero_division-3dd84e8.stderr", - "stderr_hash": "9403e36c7ace95241bf1d59a108732b298fbee5425c44455fb81ac77", + "stderr_hash": "e1770a0ba87c5155926e3d6bb3bd67e14a5c040b7584c4cf114a41b2", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_zero_division-3dd84e8.stderr b/tests/reference/asr-test_zero_division-3dd84e8.stderr index 7403437c96..57611f2b32 100644 --- a/tests/reference/asr-test_zero_division-3dd84e8.stderr +++ b/tests/reference/asr-test_zero_division-3dd84e8.stderr @@ -1,5 +1,5 @@ -semantic error: integer division by zero is not allowed +semantic error: Division by 0 is not allowed --> tests/errors/test_zero_division.py:4:16 | 4 | print(i // 0) - | ^ integer division by zero + | ^ diff --git a/tests/reference/asr-test_zero_division2-d84989f.json b/tests/reference/asr-test_zero_division2-d84989f.json index b9a7de7d1e..f1fb7cbb0e 100644 --- a/tests/reference/asr-test_zero_division2-d84989f.json +++ b/tests/reference/asr-test_zero_division2-d84989f.json @@ -8,6 +8,6 @@ "stdout": null, "stdout_hash": null, "stderr": "asr-test_zero_division2-d84989f.stderr", - "stderr_hash": "09fcb9f6244ddf2c2d14cd76ec91274cffd240e24e2b2f1c0697c8b5", + "stderr_hash": "d2bac61e7df0875a7c93edb706661c80154b7b4d05dbf26663c36176", "returncode": 2 } \ No newline at end of file diff --git a/tests/reference/asr-test_zero_division2-d84989f.stderr b/tests/reference/asr-test_zero_division2-d84989f.stderr index 8dc523a2a5..438ee0b6d4 100644 --- a/tests/reference/asr-test_zero_division2-d84989f.stderr +++ b/tests/reference/asr-test_zero_division2-d84989f.stderr @@ -1,5 +1,5 @@ -semantic error: float floor division by zero is not allowed +semantic error: Division by 0 is not allowed --> tests/errors/test_zero_division2.py:4:16 | 4 | print(v // 0.0) - | ^^^ float floor division by zero + | ^^^ diff --git a/tests/reference/asr-vec_01-66ac423.json b/tests/reference/asr-vec_01-66ac423.json index ec8a46f623..bb3dec09d4 100644 --- a/tests/reference/asr-vec_01-66ac423.json +++ b/tests/reference/asr-vec_01-66ac423.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-vec_01-66ac423.stdout", - "stdout_hash": "643cd2876b2aedf265852f3f54f7533ff6036e741287c35d6b22079e", + "stdout_hash": "8d933da14c566fd3d166c58d943c2d912b08f5439c9fd4a6d487b996", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-vec_01-66ac423.stdout b/tests/reference/asr-vec_01-66ac423.stdout index 400ddaff9a..db5dab97b0 100644 --- a/tests/reference/asr-vec_01-66ac423.stdout +++ b/tests/reference/asr-vec_01-66ac423.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 216 + 205 { }) @@ -46,11 +46,11 @@ loop_vec: (Function (SymbolTable - 212 + 201 { a: (Variable - 212 + 201 a [] Local @@ -71,7 +71,7 @@ ), b: (Variable - 212 + 201 b [] Local @@ -92,7 +92,7 @@ ), i: (Variable - 212 + 201 i [] Local @@ -125,7 +125,7 @@ [] [] [(= - (Var 212 a) + (Var 201 a) (ArrayConstant [] (Array @@ -139,7 +139,7 @@ () ) (= - (Var 212 b) + (Var 201 b) (ArrayConstant [] (Array @@ -154,7 +154,7 @@ ) (DoLoop () - ((Var 212 i) + ((Var 201 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 9216 (Integer 4)) @@ -166,9 +166,9 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 212 b) + (Var 201 b) [(() - (Var 212 i) + (Var 201 i) ())] (Real 8) RowMajor @@ -183,7 +183,7 @@ ) (DoLoop () - ((Var 212 i) + ((Var 201 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 9216 (Integer 4)) @@ -195,18 +195,18 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 212 a) + (Var 201 a) [(() - (Var 212 i) + (Var 201 i) ())] (Real 8) RowMajor () ) (ArrayItem - (Var 212 b) + (Var 201 b) [(() - (Var 212 i) + (Var 201 i) ())] (Real 8) RowMajor @@ -217,7 +217,7 @@ ) (DoLoop () - ((Var 212 i) + ((Var 201 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 9216 (Integer 4)) @@ -230,9 +230,9 @@ [(Assert (RealCompare (ArrayItem - (Var 212 a) + (Var 201 a) [(() - (Var 212 i) + (Var 201 i) ())] (Real 8) RowMajor @@ -266,11 +266,11 @@ main_program: (Program (SymbolTable - 217 + 206 { __main__global_stmts: (ExternalSymbol - 217 + 206 __main__global_stmts 2 __main__global_stmts __main__ @@ -282,7 +282,7 @@ main_program [__main__] [(SubroutineCall - 217 __main__global_stmts + 206 __main__global_stmts 2 __main__global_stmts [] () diff --git a/tests/reference/c-expr7-bb2692a.json b/tests/reference/c-expr7-bb2692a.json index d1716d5861..84ee9e5ed5 100644 --- a/tests/reference/c-expr7-bb2692a.json +++ b/tests/reference/c-expr7-bb2692a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "c-expr7-bb2692a.stdout", - "stdout_hash": "92e36dc1146bef152cab7c8086ce6de203a3d966dc5415331bd27257", + "stdout_hash": "1d75b4cf61dcee73adafec2a5448c953bae5476aab2502115df2eecb", "stderr": "c-expr7-bb2692a.stderr", "stderr_hash": "6e9790ac88db1a9ead8f64a91ba8a6605de67167037908a74b77be0c", "returncode": 0 diff --git a/tests/reference/c-expr7-bb2692a.stdout b/tests/reference/c-expr7-bb2692a.stdout index cfd6f33429..b85fda16c9 100644 --- a/tests/reference/c-expr7-bb2692a.stdout +++ b/tests/reference/c-expr7-bb2692a.stdout @@ -8,6 +8,26 @@ #include #include +float _lcompilers_optimization_floordiv_f32(float a, float b); +double _lcompilers_optimization_floordiv_f64(double a, double b); +int16_t _lcompilers_optimization_floordiv_i16(int16_t a, int16_t b); +int32_t _lcompilers_optimization_floordiv_i32(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i321(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i3210(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i322(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i323(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i324(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i325(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i326(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i327(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i328(int32_t a, int32_t b); +int32_t _lcompilers_optimization_floordiv_i329(int32_t a, int32_t b); +int64_t _lcompilers_optimization_floordiv_i64(int64_t a, int64_t b); +int8_t _lcompilers_optimization_floordiv_i8(int8_t a, int8_t b); +uint16_t _lcompilers_optimization_floordiv_u16(uint16_t a, uint16_t b); +uint32_t _lcompilers_optimization_floordiv_u32(uint32_t a, uint32_t b); +uint64_t _lcompilers_optimization_floordiv_u64(uint64_t a, uint64_t b); +uint8_t _lcompilers_optimization_floordiv_u8(uint8_t a, uint8_t b); void test_pow(); int32_t test_pow_1(int32_t a, int32_t b); void main0(); @@ -16,6 +36,286 @@ void __main__global_stmts(); // Implementations +float _lcompilers_optimization_floordiv_f32(float a, float b) +{ + double r; + float result; + int64_t tmp; + r = a/b; + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (float)(tmp); + return result; +} + +double _lcompilers_optimization_floordiv_f64(double a, double b) +{ + double r; + double result; + int64_t tmp; + r = a/b; + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (double)(tmp); + return result; +} + +int16_t _lcompilers_optimization_floordiv_i16(int16_t a, int16_t b) +{ + double r; + int16_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i32(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i321(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i3210(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i322(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i323(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i324(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i325(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i326(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i327(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i328(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int32_t _lcompilers_optimization_floordiv_i329(int32_t a, int32_t b) +{ + double r; + int32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int64_t _lcompilers_optimization_floordiv_i64(int64_t a, int64_t b) +{ + double r; + int64_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +int8_t _lcompilers_optimization_floordiv_i8(int8_t a, int8_t b) +{ + double r; + int8_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = tmp; + return result; +} + +uint16_t _lcompilers_optimization_floordiv_u16(uint16_t a, uint16_t b) +{ + double r; + uint16_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (uint16_t)(tmp); + return result; +} + +uint32_t _lcompilers_optimization_floordiv_u32(uint32_t a, uint32_t b) +{ + double r; + uint32_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (uint32_t)(tmp); + return result; +} + +uint64_t _lcompilers_optimization_floordiv_u64(uint64_t a, uint64_t b) +{ + double r; + uint64_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (uint64_t)(tmp); + return result; +} + +uint8_t _lcompilers_optimization_floordiv_u8(uint8_t a, uint8_t b) +{ + double r; + uint8_t result; + int64_t tmp; + r = (double)(a)/(double)(b); + tmp = (int64_t)(r); + if (r < 0.00000000000000000e+00 && (double)(tmp) != r) { + tmp = tmp - 1; + } + result = (uint8_t)(tmp); + return result; +} + double __lpython_overloaded_0__pow(int32_t x, int32_t y) { double _lpython_return_variable; diff --git a/tests/reference/cpp-expr8-704cece.json b/tests/reference/cpp-expr8-704cece.json index 93e5f33d99..1fac6d1530 100644 --- a/tests/reference/cpp-expr8-704cece.json +++ b/tests/reference/cpp-expr8-704cece.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "cpp-expr8-704cece.stdout", - "stdout_hash": "0f4e0ff2a1834e007029e4c961274f83da2e9111631f1df71ce989ac", + "stdout_hash": "7ac638e8146f048bd5444436ee2b2ac4f85ffa7a1d791cf526adacb4", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/cpp-expr8-704cece.stdout b/tests/reference/cpp-expr8-704cece.stdout index 21488af77a..ea744708f9 100644 --- a/tests/reference/cpp-expr8-704cece.stdout +++ b/tests/reference/cpp-expr8-704cece.stdout @@ -18,16 +18,10 @@ Kokkos::View from_std_vector(const std::vector &v) } // Forward declarations -float _lfortran_caimag(std::complex x); -double _lfortran_zaimag(std::complex x); namespace { } // Implementations -float _lfortran_caimag(std::complex x); - -double _lfortran_zaimag(std::complex x); - namespace { void main2() { diff --git a/tests/reference/cpp-test_builtin_pow-56b3f92.json b/tests/reference/cpp-test_builtin_pow-56b3f92.json index dd338f3662..a18ad0aab9 100644 --- a/tests/reference/cpp-test_builtin_pow-56b3f92.json +++ b/tests/reference/cpp-test_builtin_pow-56b3f92.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "cpp-test_builtin_pow-56b3f92.stdout", - "stdout_hash": "65d68d4aa112fa00894bf7023d10caa4cdfeb7b9656a7769e5b86121", + "stdout_hash": "dec0af96e013cd38032672f4812f876e586bf697757278addd17b591", "stderr": "cpp-test_builtin_pow-56b3f92.stderr", "stderr_hash": "859ce76c74748f2d32c7eab92cfbba789a78d4cbf5818646b99806ea", "returncode": 0 diff --git a/tests/reference/cpp-test_builtin_pow-56b3f92.stdout b/tests/reference/cpp-test_builtin_pow-56b3f92.stdout index cb9f353759..8c7a59f313 100644 --- a/tests/reference/cpp-test_builtin_pow-56b3f92.stdout +++ b/tests/reference/cpp-test_builtin_pow-56b3f92.stdout @@ -30,10 +30,8 @@ float __lpython_overloaded_2__pow(float x, float y); double __lpython_overloaded_3__pow(double x, double y); float __lpython_overloaded_4__pow(int32_t x, float y); float __lpython_overloaded_5__pow(float x, int32_t y); -int32_t __lpython_overloaded_6___lpython_floordiv(int32_t a, int32_t b); double __lpython_overloaded_6__pow(int32_t x, double y); double __lpython_overloaded_7__pow(double x, int32_t y); -int64_t __lpython_overloaded_8___lpython_floordiv(int64_t a, int64_t b); int64_t __lpython_overloaded_8___mod(int64_t a, int64_t b); int32_t __lpython_overloaded_8__pow(bool x, bool y); std::complex __lpython_overloaded_9__complex(int32_t x, int32_t y); @@ -51,25 +49,10 @@ double __lpython_overloaded_0__pow(int32_t x, int32_t y) return _lpython_return_variable; } -int32_t __lpython_overloaded_6___lpython_floordiv(int32_t a, int32_t b) -{ - int32_t _lpython_return_variable; - double r; - int32_t result; - r = (double)(a)/(double)(b); - result = (int32_t)(r); - if (r >= 0.00000000000000000e+00 || (double)(result) == r) { - _lpython_return_variable = result; - return _lpython_return_variable; - } - _lpython_return_variable = result - 1; - return _lpython_return_variable; -} - int32_t __lpython_overloaded_2___mod(int32_t a, int32_t b) { int32_t _lpython_return_variable; - _lpython_return_variable = a - __lpython_overloaded_6___lpython_floordiv(a, b)*b; + _lpython_return_variable = a - floordiv(a)*b; return _lpython_return_variable; } @@ -86,25 +69,10 @@ int32_t __lpython_overloaded_10__pow(int32_t x, int32_t y, int32_t z) return _lpython_return_variable; } -int64_t __lpython_overloaded_8___lpython_floordiv(int64_t a, int64_t b) -{ - int64_t _lpython_return_variable; - double r; - int64_t result; - r = (double)(a)/(double)(b); - result = (int64_t)(r); - if (r >= 0.00000000000000000e+00 || (double)(result) == r) { - _lpython_return_variable = result; - return _lpython_return_variable; - } - _lpython_return_variable = result - 1; - return _lpython_return_variable; -} - int64_t __lpython_overloaded_8___mod(int64_t a, int64_t b) { int64_t _lpython_return_variable; - _lpython_return_variable = a - __lpython_overloaded_8___lpython_floordiv(a, b)*b; + _lpython_return_variable = a - floordiv(a)*b; return _lpython_return_variable; } diff --git a/tests/reference/pass_loop_vectorise-vec_01-be9985e.json b/tests/reference/pass_loop_vectorise-vec_01-be9985e.json index 0b42498fc6..7fc7fff2e5 100644 --- a/tests/reference/pass_loop_vectorise-vec_01-be9985e.json +++ b/tests/reference/pass_loop_vectorise-vec_01-be9985e.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "pass_loop_vectorise-vec_01-be9985e.stdout", - "stdout_hash": "8dd25f677c4ef92c4aaa4879cee7c623d6ccfcb8fb24dc46bc5c8e48", + "stdout_hash": "baa381dd5d203052002c17261471a3018958490dc0bc8d7d03f95219", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout b/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout index 1b4daf5af2..9add220de0 100644 --- a/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout +++ b/tests/reference/pass_loop_vectorise-vec_01-be9985e.stdout @@ -10,7 +10,7 @@ __main__global_stmts: (Function (SymbolTable - 216 + 205 { }) @@ -46,11 +46,11 @@ loop_vec: (Function (SymbolTable - 212 + 201 { a: (Variable - 212 + 201 a [] Local @@ -71,7 +71,7 @@ ), b: (Variable - 212 + 201 b [] Local @@ -92,7 +92,7 @@ ), i: (Variable - 212 + 201 i [] Local @@ -109,11 +109,11 @@ vector_copy_f64[9216]f64[9216]i32@IntrinsicOptimization: (Function (SymbolTable - 218 + 207 { __1_k: (Variable - 218 + 207 __1_k [] Local @@ -129,7 +129,7 @@ ), arg0: (Variable - 218 + 207 arg0 [] In @@ -150,7 +150,7 @@ ), arg1: (Variable - 218 + 207 arg1 [] In @@ -171,7 +171,7 @@ ), arg2: (Variable - 218 + 207 arg2 [] In @@ -187,7 +187,7 @@ ), arg3: (Variable - 218 + 207 arg3 [] In @@ -203,7 +203,7 @@ ), arg4: (Variable - 218 + 207 arg4 [] In @@ -219,7 +219,7 @@ ), arg5: (Variable - 218 + 207 arg5 [] In @@ -265,18 +265,18 @@ .false. ) [] - [(Var 218 arg0) - (Var 218 arg1) - (Var 218 arg2) - (Var 218 arg3) - (Var 218 arg4) - (Var 218 arg5)] + [(Var 207 arg0) + (Var 207 arg1) + (Var 207 arg2) + (Var 207 arg3) + (Var 207 arg4) + (Var 207 arg5)] [(= - (Var 218 __1_k) + (Var 207 __1_k) (IntegerBinOp - (Var 218 arg2) + (Var 207 arg2) Sub - (Var 218 arg4) + (Var 207 arg4) (Integer 4) () ) @@ -286,23 +286,23 @@ () (IntegerCompare (IntegerBinOp - (Var 218 __1_k) + (Var 207 __1_k) Add - (Var 218 arg4) + (Var 207 arg4) (Integer 4) () ) Lt - (Var 218 arg3) + (Var 207 arg3) (Logical 4) () ) [(= - (Var 218 __1_k) + (Var 207 __1_k) (IntegerBinOp - (Var 218 __1_k) + (Var 207 __1_k) Add - (Var 218 arg4) + (Var 207 arg4) (Integer 4) () ) @@ -310,18 +310,18 @@ ) (= (ArrayItem - (Var 218 arg0) + (Var 207 arg0) [(() - (Var 218 __1_k) + (Var 207 __1_k) ())] (Real 8) RowMajor () ) (ArrayItem - (Var 218 arg1) + (Var 207 arg1) [(() - (Var 218 __1_k) + (Var 207 __1_k) ())] (Real 8) RowMajor @@ -355,7 +355,7 @@ [vector_copy_f64[9216]f64[9216]i32@IntrinsicOptimization] [] [(= - (Var 212 a) + (Var 201 a) (ArrayConstant [] (Array @@ -369,7 +369,7 @@ () ) (= - (Var 212 b) + (Var 201 b) (ArrayConstant [] (Array @@ -384,7 +384,7 @@ ) (DoLoop () - ((Var 212 i) + ((Var 201 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 9216 (Integer 4)) @@ -396,9 +396,9 @@ (IntegerConstant 1 (Integer 4))) [(= (ArrayItem - (Var 212 b) + (Var 201 b) [(() - (Var 212 i) + (Var 201 i) ())] (Real 8) RowMajor @@ -413,17 +413,17 @@ ) (DoLoop () - ((Var 212 i) + ((Var 201 i) (IntegerConstant 0 (Integer 4)) (IntegerConstant 1151 (Integer 4)) (IntegerConstant 1 (Integer 4))) [(SubroutineCall - 212 vector_copy_f64[9216]f64[9216]i32@IntrinsicOptimization + 201 vector_copy_f64[9216]f64[9216]i32@IntrinsicOptimization () - [((Var 212 a)) - ((Var 212 b)) + [((Var 201 a)) + ((Var 201 b)) ((IntegerBinOp - (Var 212 i) + (Var 201 i) Mul (IntegerConstant 8 (Integer 4)) (Integer 4) @@ -431,7 +431,7 @@ )) ((IntegerBinOp (IntegerBinOp - (Var 212 i) + (Var 201 i) Add (IntegerConstant 1 (Integer 4)) (Integer 4) @@ -449,7 +449,7 @@ ) (DoLoop () - ((Var 212 i) + ((Var 201 i) (IntegerConstant 0 (Integer 4)) (IntegerBinOp (IntegerConstant 9216 (Integer 4)) @@ -462,9 +462,9 @@ [(Assert (RealCompare (ArrayItem - (Var 212 a) + (Var 201 a) [(() - (Var 212 i) + (Var 201 i) ())] (Real 8) RowMajor @@ -498,11 +498,11 @@ main_program: (Program (SymbolTable - 217 + 206 { __main__global_stmts: (ExternalSymbol - 217 + 206 __main__global_stmts 2 __main__global_stmts __main__ @@ -514,7 +514,7 @@ main_program [__main__] [(SubroutineCall - 217 __main__global_stmts + 206 __main__global_stmts 2 __main__global_stmts [] () From bc4cf51e97a4d8d1c040279ecf1197d4948d363e Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 21:31:50 +0530 Subject: [PATCH 10/12] TEST: Add for floordiv with Const var --- integration_tests/CMakeLists.txt | 1 + integration_tests/intrinsics_02.py | 42 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 integration_tests/intrinsics_02.py diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 89f79379d6..645015e999 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -799,6 +799,7 @@ RUN(NAME callback_04 IMPORT_PATH .. LABELS cpython) # Intrinsic Functions RUN(NAME intrinsics_01 LABELS cpython llvm NOFAST) # any +RUN(NAME intrinsics_02 LABELS cpython llvm c) # floordiv # lpython decorator RUN(NAME lpython_decorator_01 LABELS cpython) diff --git a/integration_tests/intrinsics_02.py b/integration_tests/intrinsics_02.py new file mode 100644 index 0000000000..c37d0aad3d --- /dev/null +++ b/integration_tests/intrinsics_02.py @@ -0,0 +1,42 @@ +from lpython import Const, i32, f32, f64 + +foo: Const[i32] = 4 +bar: Const[i32] = foo // 2 + +print(bar) +assert bar == 2 + +def floordiv1(): + a: f64 + b: f64 + c: f64 + a = 5.0 + b = 2.0 + c = a // b + + print(c) + assert c == 2.0 + +def floordiv2(): + a: Const[f32] = f32(5.0) + b: Const[f32] = f32(2.0) + c: f32 + c = a // b + + print(c) + assert c == f32(2.0) + +def floordiv3(): + a: f64 + b: f64 + c: f64 + a = 5.0 + b = -2.0 + c = a // b + + print(c) + assert c == -3.0 + +floordiv1() +floordiv2() +floordiv3() From 17be47df973d9b3e49c865a0b02782219b10c003 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 23:55:07 +0530 Subject: [PATCH 11/12] WASM: Fix getting kind for Real and Logical Constants --- src/libasr/codegen/asr_to_wasm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libasr/codegen/asr_to_wasm.cpp b/src/libasr/codegen/asr_to_wasm.cpp index e6bd2567e7..f23e120eeb 100644 --- a/src/libasr/codegen/asr_to_wasm.cpp +++ b/src/libasr/codegen/asr_to_wasm.cpp @@ -2299,7 +2299,7 @@ class ASRToWASMVisitor : public ASR::BaseVisitor { void visit_RealConstant(const ASR::RealConstant_t &x) { double val = x.m_r; - int a_kind = ((ASR::Real_t *)(&(x.m_type->base)))->m_kind; + int a_kind = ASRUtils::extract_kind_from_ttype_t(x.m_type); switch (a_kind) { case 4: { m_wa.emit_f32_const(val); @@ -2318,7 +2318,7 @@ class ASRToWASMVisitor : public ASR::BaseVisitor { void visit_LogicalConstant(const ASR::LogicalConstant_t &x) { bool val = x.m_value; - int a_kind = ((ASR::Logical_t *)(&(x.m_type->base)))->m_kind; + int a_kind = ASRUtils::extract_kind_from_ttype_t(x.m_type); switch (a_kind) { case 4: { m_wa.emit_i32_const(val); From 235117b74e63ff43e5440e575608f6be55e22445 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sat, 7 Oct 2023 23:56:14 +0530 Subject: [PATCH 12/12] WASM: Apply intrinsic_function pass after unused_functions --- src/libasr/codegen/asr_to_wasm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libasr/codegen/asr_to_wasm.cpp b/src/libasr/codegen/asr_to_wasm.cpp index f23e120eeb..86c2856334 100644 --- a/src/libasr/codegen/asr_to_wasm.cpp +++ b/src/libasr/codegen/asr_to_wasm.cpp @@ -3222,7 +3222,7 @@ Result> asr_to_wasm_bytes_stream(ASR::TranslationUnit_t &asr, pass_options.dump_all_passes = co.dump_all_passes; std::vector passes = {"pass_array_by_data", "array_op", "implied_do_loops", "print_arr", "do_loops", "select_case", - "intrinsic_function", "nested_vars", "unused_functions"}; + "nested_vars", "unused_functions", "intrinsic_function"}; LCompilers::PassManager pass_manager; pass_manager.apply_passes(al, &asr, passes, pass_options, diagnostics);