[all-commits] [llvm/llvm-project] f1fa3b: [flang] AMAX0, MIN1... rewrite to MAX/MIN: make re...

jeanPerier via All-commits all-commits at lists.llvm.org
Wed Jun 17 23:15:16 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f1fa3b7f6ee958ec4dfb7104bd0ae64ec0061551
      https://github.com/llvm/llvm-project/commit/f1fa3b7f6ee958ec4dfb7104bd0ae64ec0061551
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2020-06-18 (Thu, 18 Jun 2020)

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

  Log Message:
  -----------
  [flang] AMAX0, MIN1... rewrite to MAX/MIN: make result conversion explicit

Summary:
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.

Reviewers: klausler, schweitz, sscalpone, jdoerfert, DavidTruby

Reviewed By: klausler, schweitz

Subscribers: llvm-commits, flang-commits

Tags: #flang, #llvm

Differential Revision: https://reviews.llvm.org/D81940




More information about the All-commits mailing list