[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 07:42:52 PDT 2020


jeanPerier created this revision.
jeanPerier added reviewers: klausler, schweitz, sscalpone.
jeanPerier added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch changes speficic extremum functions rewrite to generic MIN/MAX.
It applies to AMAX0, AMIN0, AMAX1, AMIN1, MAX0, MIN0, MAX1, MIN1, DMAX1,
and DMIN1.

- Do not re-write specific extremums to MAX/MIN in intrinsic Probe and let

folding rewrite it and introduc the conversion on the MIN/MAX result.

- Also make operand promotion explicit in MIN/MAX folding.

For instance, after this patch:
AMAX0(int8, int4) is rewritten to REAL(MAX(int8, INT(int4, 8)))

All this care is to avoid rewritting it to MAX(REAL(int8), REAL(int4))
that may not always be numerically equivalent to the first rewrite.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81940

Files:
  flang/lib/Evaluate/fold-implementation.h
  flang/lib/Evaluate/fold-integer.cpp
  flang/lib/Evaluate/fold-real.cpp
  flang/lib/Evaluate/intrinsics.cpp
  flang/test/Evaluate/folding04.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81940.271092.patch
Type: text/x-patch
Size: 9480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200616/bf36920d/attachment-0001.bin>


More information about the flang-commits mailing list