[flang-commits] [PATCH] D81940: [flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 16 11:00:13 PDT 2020


jeanPerier added inline comments.


================
Comment at: flang/lib/Evaluate/fold-implementation.h:700
+      }
+    } else if (resultType.category() == TypeCategory::Integer) {
+      resultTypeArg = &args[j];
----------------
klausler wrote:
> Why is this limited to `INTEGER` here?  Do `AMAX0`, `AMIN0`, `DMAX1`, and `DMIN1` have separate handling elsewhere?
No, the real case is handled implicitly in the "then" just above. If the arguments are all real they will all be processed in the first case.
This "else" is only here to handle mixed integer/real operands (in case all previous operands were integer, the first real operand gives the intermediate MIN/MAX result type).
Currently, the intrinsic probing does not prevent such mixed category cases (a warning is emitted, like with non standard kind). So `AMAX0(int4, real4)` is rewritten to `REAL(MAX(real4, int4))` = `MAX(real4, REAL(int4))`.
I can add a small comment to clarify this here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81940/new/

https://reviews.llvm.org/D81940





More information about the flang-commits mailing list