-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating point llvm lowering of intrinsics #1497
Comments
It's a first-cut implementation that handles only 32- and 64-bit types. I've been thinking we might adjust the implementation of the numeric intrinsics. Roughly, I think we should implement the Fortran intrinsics using the available intrinsics from the standard and quadmath libraries. The focus of this library would be coverage of all of the intrinsics across all of the KINDs we which to support. The resulting library would be used in the compiler for folding and also in the runtime when llvm intrinsics are not available. Perhaps the mlir math dialect needs extending with more intrinsics or fir can be used. |
Thanks @sscalpone for the reply. Apologies for the delay in my response.
I am guessing you mean the standard math library here when you mention standard.
Are you suggesting a wrapper library (like pgmath) here?
And since math library subsequently lowers to LLVM or makes calls to the math library, can we effective replace the existing lowering to llvm intrinsics? |
The floating-point lowering of Fortran intrinsics like
abs
uses the llvm intrinsics. Currently, we only have the f32 and f64 floating types handled. If a quad precision or a half-precision then this will result in being converted to a 32 bit type and then thellvm.fabs.f32
llvm intrinsic is used to handle the conversion. For a precision higher than 64 this will cause an assert in a build with assert but will proceed with conversions in a release build. The documentation forllvm.fabs
mentions several types that can be used with the fabs intrinsic but also cautions that all targets might not support these.I am in the process of upstreaming this code, and I have the following questions,
The text was updated successfully, but these errors were encountered: