[flang-commits] [flang] [flang] Fix for atand(Y, X), and implment atan2d(Y, X) (PR #79002)
Yi Wu via flang-commits
flang-commits at lists.llvm.org
Thu Jan 25 03:42:09 PST 2024
================
@@ -333,11 +333,15 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
common::Intent::In, {ArgFlag::canBeNull}}},
DefaultLogical, Rank::elemental, IntrinsicClass::inquiryFunction},
{"atan", {{"x", SameFloating}}, SameFloating},
- {"atand", {{"x", SameFloating}}, SameFloating},
{"atan", {{"y", OperandReal}, {"x", OperandReal}}, OperandReal},
- {"atand", {{"y", OperandReal}, {"x", OperandReal}}, OperandReal},
+ {"atand",
+ {{"y", SameReal, Rank::scalar, Optionality::required,
+ common::Intent::In},
+ {"x", SameReal, Rank::scalar, Optionality::optional,
+ common::Intent::In}},
+ SameReal, Rank::scalar, IntrinsicClass::inquiryFunction},
----------------
yi-wu-arm wrote:
It is possible to have intrinsics with the same name but different para list here, like how it was done before. Having an `atand(X)`, and `atand(Y,X)`. But in the `intrinsicCall.cpp`, they seem only different from each other by `args.size()`. I do have another implementation by have both `atand(X)` and `atand(Y,X)`, and treat them both in `genAtand` by using `args.size()` for each case. I'm not sure if using `args.size()` is the safe/correct way to do this. I can use `atand([Y],X)` if `args.size()` could not be used.
The reason for me to use `atand(Y,[X])` here is that if X is not present, it would be treated as `atand(X)`. This definitely does not make sense in terms of naming, because I am actually using Y as X for the one input version `atand(X)`.
I will change it back from `SameReal` to `OperandReal` regard to the relaxation of same kind rule, and also update all other `atan` with the zero check.
https://github.com/llvm/llvm-project/pull/79002
More information about the flang-commits
mailing list