As Fortran 2018 16.9.170, the argument of selected_real_kind is integer
scalar, and result is default integer scalar. The constant expression in
this intrinsic has been supported by folding the constant expression.
This supports lowering this intrinsic for variables using runtime.
Details
Diff Detail
Event Timeline
flang/lib/Optimizer/Builder/Runtime/Numeric.cpp | ||
---|---|---|
164 | I am thinking if it is possible to refactor the Forced### ? For multiple arguments, the combination will result in a large amount of helpers. Or leave it there when more intrinsics have this problem. |
I think this is way too much entry point for a not so performance critical important intrinsic (that is folded 90% of the cases).
Have you considered using a single select_real_kind(void* precision , int precisionKind, void* range, int rangeKind, void* radix, int radixKind) interface ? It should also allow a better handling of the dynamically absent cases.
(Simplifying the interface for select_int_kind is also actually probably worth it, but since it is simpler, I am also OK with its current form).
flang/runtime/numeric.cpp | ||
---|---|---|
148 | Right now I think there would be an issue if RADIX is absent, lowering would set it to zero, causing the runtime to return an error while the runtime says there is no requirement is about the radix if it is dynamically absent (say it is an absent optional). I think it would be better to have the runtime interface be const Descriptor*/void* so that the dynamically absent case can be handled by the runtime. |
I am thinking if it is possible to refactor the Forced### ? For multiple arguments, the combination will result in a large amount of helpers. Or leave it there when more intrinsics have this problem.