[clang] [flang] [mlir] [flang,acc] Support -ffp-maxmin-behavior option in lowering. (PR #184730)

Tarun Prabhu via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 5 07:20:38 PST 2026


================
@@ -0,0 +1,40 @@
+//===- Support/FPMaxminBehavior.h - FP max/min behavior option --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Shared definition of FP max/min behavior for MAX/MIN and [max|min][loc|val].
+/// Used by CodeGenOptions, LoweringOptions, and other components.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef FORTRAN_SUPPORT_FPMAXMINBEHAVIOR_H_
+#define FORTRAN_SUPPORT_FPMAXMINBEHAVIOR_H_
+
+#include "llvm/ADT/StringRef.h"
+
+namespace Fortran::common {
+
+/// Control for MAX/MIN and [max|min][loc|val] lowering, constant folding, and
+/// related behavior. Legacy: current Flang behavior (always cmp+select).
+/// Portable: same as Legacy but may use arith.maxnumf under
+/// '-fno-signed-zeros -fno-honor-nans'. Extremum/Extremenum: maximumf/minnumf.
+/// Legacy is transitional and will eventually be replaced by Portable.
----------------
tarunprabhu wrote:

Does this mean that the "Legacy" option here will eventually go away, or does this refer to the default? If it is the latter, I don't think we need to mention it here since this documentation is only for the definition of this num - not necessarily its use. There is also a risk of the sentence become out of date.

https://github.com/llvm/llvm-project/pull/184730


More information about the cfe-commits mailing list