Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions src/fparser/two/Fortran2008/intrinsics_f08.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,82 @@ class Intrinsic_Name(F2003_Intrinsic_Name):

f08_math_intrinsics = {
"ERF": {"min": 1, "max": 1},
"ERFC": {"min": 1, "max": 1},
"ERFC_SCALED": {"min": 1, "max": 1},
"GAMMA": {"min": 1, "max": 1},
"HYPOT": {"min": 2, "max": 2},
"LOG_GAMMA": {"min": 1, "max": 1},
"NORM2": {"min": 1, "max": 2},
}

f08_bitsequence_comparison_intrinsics = {
"BGE": {"min": 2, "max": 2},
"BGT": {"min": 2, "max": 2},
"BLE": {"min": 2, "max": 2},
"BLT": {"min": 2, "max": 2},
}

f08_bitshift_intrinsics = {
"DSHIFTL": {"min": 3, "max": 3},
"DSHIFTR": {"min": 3, "max": 3},
"SHIFTL": {"min": 2, "max": 2},
"SHIFTR": {"min": 2, "max": 2},
"SHIFTA": {"min": 2, "max": 2},
"MERGE_BITS": {"min": 3, "max": 3},
}

f08_counting_bit_intrinsics = {
"LEADZ": {"min": 1, "max": 1},
"POPCNT": {"min": 1, "max": 1},
"POPPAR": {"min": 1, "max": 1},
"TRAILZ": {"min": 1, "max": 1},
}

f08_masking_bit_intrinsics = {
"MASKL": {"min": 1, "max": 2},
"MASKR": {"min": 1, "max": 2},
}

f08_bit_transformation_intrinsics = {
"IALL": {"min": 1, "max": 3},
"IANY": {"min": 1, "max": 3},
"IPARITY": {"min": 1, "max": 3},
}

f08_other_intrinsics = {
"STORAGE_SIZE": {"min": 1, "max": 3},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be max 2 I think?

"PARITY": {"min": 1, "max": 2},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"EXECUTE_COMMAND_LINE": {"min": 1, "max": 5},
"FINDLOC": {"min": 2, "max": 6},
}

f08_trig_and_hyper_functions = {
"ACOSH": {"min": 1, "max": 1},
"ASINH": {"min": 1, "max": 1},
"ATANH": {"min": 1, "max": 1},
}

f08_bessel_functions = {
"BESSEL_J0": {"min": 1, "max": 1},
"BESSEL_J1": {"min": 1, "max": 1},
"BESSEL_JN": {"min": 2, "max": 3},
"BESSEL_Y0": {"min": 1, "max": 1},
"BESSEL_Y1": {"min": 1, "max": 1},
"BESSEL_YN": {"min": 2, "max": 3},
}

# Create the dicts (not inherited from F2003_Intrinsic_Name)
generic_function_names = {}
generic_function_names.update(F2003_Intrinsic_Name.generic_function_names)
generic_function_names.update(f08_math_intrinsics)
generic_function_names.update(f08_bitsequence_comparison_intrinsics)
generic_function_names.update(f08_bitshift_intrinsics)
generic_function_names.update(f08_counting_bit_intrinsics)
generic_function_names.update(f08_masking_bit_intrinsics)
generic_function_names.update(f08_bit_transformation_intrinsics)
generic_function_names.update(f08_other_intrinsics)
generic_function_names.update(f08_trig_and_hyper_functions)
generic_function_names.update(f08_bessel_functions)

specific_function_names = F2003_Intrinsic_Name.specific_function_names

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need some tests :-) One for each new group added here will do I think. We could probably ask Claude to write a whole suite of tests for all of the intrinsics if you fancy trying that? Or could be a challenge for Hannah?

Expand Down
Loading