Update SIR to use Dawn intrinsics (min, max etc).
At the moment Fortran intrinsics are replaced by equivalent code before being transformed to SIR. However, Dawn does support a number of intrinsics so these can be translated directly.
The Fortran intrinsics used in the tracer advection example are MAX, SIGN, MIN and ABS.
I can't find any examples of using intrinsics in the dawn repo or in any previously supplied code so I've contacted Matthias requesting an example.
Created branch 1826_sir_intrinsics
Matthias has kindly pointed me at the following https://github.com/MeteoSwiss-APN/dawn/blob/407c03b2024e5a224548b173a39e7ba2245ca060/dawn/test/integration-test/dawn4py-tests/ICON_laplacian_diamond_stencil.py#L179
Essentially the structure appears to be ...
serial_utils.make_fun_call_expr("intrinsic",[args])
Done a first implementation which probably has various syntax errors but they can be simply fixed. The main question is how to deal with sign as apparently C does not have a standard implementation of SIGN. Perhaps I should just use the transformation. I'll ask Matthias what he thinks as he has talked about using an intrinsic in the past.
C does have its own implementation of copysign since C99: https://en.cppreference.com/w/c/numeric/math/copysign
Is this different to Fortran's? I remember using it (or my own implementation of it due to performance) in the Regent version of NemoLite2D