[clang] [flang] [Flang] Add -ffast-real-mod and direct code for MOD on REAL types (PR #160660)
Slava Zakharin via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 29 09:14:39 PDT 2025
================
@@ -7022,9 +7045,16 @@ mlir::Value IntrinsicLibrary::genMod(mlir::Type resultType,
if (mlir::isa<mlir::IntegerType>(resultType))
return mlir::arith::RemSIOp::create(builder, loc, args[0], args[1]);
- // Use runtime.
- return builder.createConvert(
- loc, resultType, fir::runtime::genMod(builder, loc, args[0], args[1]));
+ if (useFastRealMod && resultType.isFloat()) {
----------------
vzakhari wrote:
It sounds okay to me. I would recommend enabling this optimization whenever `afn` is set (i.e. under `-ffast-math` or under `-fapprox-func`), and allow to override this with `-fno-fast-real-mod`.
https://github.com/llvm/llvm-project/pull/160660
More information about the cfe-commits
mailing list