@@ -46,6 +46,7 @@ enum SpecialFunc {
46
46
Sin,
47
47
Cos,
48
48
AMax,
49
+ AMin,
49
50
Sum,
50
51
Range,
51
52
Size,
@@ -70,6 +71,7 @@ std::map<std::string, SpecialFunc> special_function_map = {
70
71
{" sin" , SpecialFunc::Sin},
71
72
{" cos" , SpecialFunc::Cos},
72
73
{" amax" , SpecialFunc::AMax},
74
+ {" amin" , SpecialFunc::AMin},
73
75
{" sum" , SpecialFunc::Sum},
74
76
{" range" , SpecialFunc::Range},
75
77
{" size" , SpecialFunc::Size},
@@ -626,6 +628,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
626
628
array_indices.p , array_indices.size (),
627
629
ASRUtils::extract_type (ASRUtils::expr_type (obj)),
628
630
ASR::arraystorageType::RowMajor, nullptr );
631
+ } else if ( ASR::is_a<ASR::IntrinsicArrayFunction_t>(*obj) ) {
632
+ tmp = (ASR::asr_t *) obj;
629
633
} else {
630
634
throw std::runtime_error (" Only indexing arrays is supported for now with operator()." );
631
635
}
@@ -943,7 +947,15 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
943
947
static_cast <int64_t >(ASRUtils::IntrinsicArrayFunctions::MaxVal),
944
948
args.p , 1 , 0 , ASRUtils::extract_type (ASRUtils::expr_type (args.p [0 ])),
945
949
nullptr );
946
- } else if ( sf == SpecialFunc::Sum ) {
950
+ } else if ( sf == SpecialFunc::AMin ) {
951
+ if ( args.size () > 1 && args.p [1 ] != nullptr ) {
952
+ throw std::runtime_error (" dim argument not yet supported with " + func_name);
953
+ }
954
+ tmp = ASRUtils::make_IntrinsicArrayFunction_t_util (al, Lloc (x),
955
+ static_cast <int64_t >(ASRUtils::IntrinsicArrayFunctions::MinVal),
956
+ args.p , 1 , 0 , ASRUtils::extract_type (ASRUtils::expr_type (args.p [0 ])),
957
+ nullptr );
958
+ } else if ( sf == SpecialFunc::Sum ) {
947
959
if ( args.size () > 1 && args.p [1 ] != nullptr ) {
948
960
throw std::runtime_error (" dim argument not yet supported with " + func_name);
949
961
}
@@ -1531,7 +1543,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
1531
1543
name == " range" || name == " pow" || name == " equal" ||
1532
1544
name == " operator<" || name == " operator<=" || name == " operator>=" ||
1533
1545
name == " operator!=" || name == " operator\"\" i" || name == " sin" ||
1534
- name == " cos" ) {
1546
+ name == " cos" || name == " amin " ) {
1535
1547
if ( sym != nullptr && ASR::is_a<ASR::Function_t>(
1536
1548
*ASRUtils::symbol_get_past_external (sym)) ) {
1537
1549
throw std::runtime_error (" Special function " + name + " cannot be overshadowed yet." );
0 commit comments