[flang-commits] [clang] [flang] [Flang] Add -ffast-real-mod and direct code for MOD on REAL types (PR #160660)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Thu Sep 25 02:24:19 PDT 2025
================
@@ -7022,9 +7044,18 @@ 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) {
+ // If fast MOD for REAL has been requested, generate less precise,
+ // but faster code directly.
+ assert(resultType.isFloat() &&
+ "non floating-point type hit for fast real MOD");
----------------
tblah wrote:
Maybe this should just be part of the condition above
```
if (useFastRealMod && resultType.isFloat())
```
https://github.com/llvm/llvm-project/pull/160660
More information about the flang-commits
mailing list