diff --git a/flang/include/flang/Optimizer/Builder/FIRBuilder.h b/flang/include/flang/Optimizer/Builder/FIRBuilder.h --- a/flang/include/flang/Optimizer/Builder/FIRBuilder.h +++ b/flang/include/flang/Optimizer/Builder/FIRBuilder.h @@ -456,6 +456,20 @@ /// Get current FastMathFlags value. mlir::arith::FastMathFlags getFastMathFlags() const { return fastMathFlags; } + /// Stringify FastMathFlags set in a way + /// that the string may be used for mangling a function name. + /// If FastMathFlags are set to 'none', then the result is an empty + /// string. + std::string getFastMathFlagsString() { + mlir::arith::FastMathFlags flags = getFastMathFlags(); + if (flags == mlir::arith::FastMathFlags::none) + return {}; + + std::string fmfString{mlir::arith::stringifyFastMathFlags(flags)}; + std::replace(fmfString.begin(), fmfString.end(), ',', '_'); + return fmfString; + } + /// Dump the current function. (debug) LLVM_DUMP_METHOD void dumpFunc(); diff --git a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp --- a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp +++ b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp @@ -47,6 +47,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/raw_ostream.h" #include #define DEBUG_TYPE "flang-lower-intrinsic" @@ -1624,6 +1625,7 @@ // its calls will be. auto localBuilder = std::make_unique(function, builder.getKindMap()); + localBuilder->setFastMathFlags(builder.getFastMathFlags()); localBuilder->setInsertionPointToStart(&function.front()); // Location of code inside wrapper of the wrapper is independent from // the location of the intrinsic call. @@ -1689,7 +1691,13 @@ } mlir::FunctionType funcType = getFunctionType(resultType, args, builder); - mlir::func::FuncOp wrapper = getWrapper(generator, name, funcType); + std::string funcName{name}; + llvm::raw_string_ostream nameOS{funcName}; + if (std::string fmfString{builder.getFastMathFlagsString()}; + !fmfString.empty()) { + nameOS << '.' << fmfString; + } + mlir::func::FuncOp wrapper = getWrapper(generator, funcName, funcType); return builder.create(loc, wrapper, args).getResult(0); } diff --git a/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp b/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp --- a/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp +++ b/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp @@ -125,20 +125,6 @@ return builder; } -/// Stringify FastMathFlags set for the given \p builder in a way -/// that the string may be used for mangling a function name. -/// If FastMathFlags are set to 'none', then the result is an empty -/// string. -static std::string getFastMathFlagsString(const fir::FirOpBuilder &builder) { - mlir::arith::FastMathFlags flags = builder.getFastMathFlags(); - if (flags == mlir::arith::FastMathFlags::none) - return {}; - - std::string fmfString{mlir::arith::stringifyFastMathFlags(flags)}; - std::replace(fmfString.begin(), fmfString.end(), ',', '_'); - return fmfString; -} - /// Generate function type for the simplified version of RTNAME(Sum) and /// similar functions with a fir.box type returning \p elementType. static mlir::FunctionType genNoneBoxType(fir::FirOpBuilder &builder, @@ -1071,7 +1057,7 @@ mlir::SymbolRefAttr callee = call.getCalleeAttr(); fir::FirOpBuilder builder{getSimplificationBuilder(call, kindMap)}; - std::string fmfString{getFastMathFlagsString(builder)}; + std::string fmfString{builder.getFastMathFlagsString()}; std::string funcName = (mlir::Twine{callee.getLeafReference().getValue(), "x"} + mlir::Twine{rank} + @@ -1204,7 +1190,7 @@ mlir::Value outputAlloc = outputDef->getOperand(0); mlir::Type outType = hlfir::getFortranElementType(outputAlloc.getType()); - std::string fmfString{getFastMathFlagsString(builder)}; + std::string fmfString{builder.getFastMathFlagsString()}; std::string funcName = (mlir::Twine{callee.getLeafReference().getValue(), "x"} + mlir::Twine{rank} + @@ -1298,7 +1284,7 @@ fir::FirOpBuilder builder{getSimplificationBuilder(op, kindMap)}; // Stringize the builder's FastMathFlags flags for mangling // the generated function name. - std::string fmfString{getFastMathFlagsString(builder)}; + std::string fmfString{builder.getFastMathFlagsString()}; mlir::Type type = call.getResult(0).getType(); if (!type.isa() && !type.isa()) diff --git a/flang/test/Lower/Intrinsics/exp.f90 b/flang/test/Lower/Intrinsics/exp.f90 --- a/flang/test/Lower/Intrinsics/exp.f90 +++ b/flang/test/Lower/Intrinsics/exp.f90 @@ -10,7 +10,7 @@ subroutine exp_testr(a, b) real :: a, b ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref -! CHECK: %[[RES:.*]] = fir.call @fir.exp.f32.f32(%[[A]]) {{.*}}: (f32) -> f32 +! CHECK: %[[RES:.*]] = fir.call @fir.exp.contract.f32.f32(%[[A]]) {{.*}}: (f32) -> f32 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref b = exp(a) end subroutine @@ -20,7 +20,7 @@ subroutine exp_testd(a, b) real(kind=8) :: a, b ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref -! CHECK: %[[RES:.*]] = fir.call @fir.exp.f64.f64(%[[A]]) {{.*}}: (f64) -> f64 +! CHECK: %[[RES:.*]] = fir.call @fir.exp.contract.f64.f64(%[[A]]) {{.*}}: (f64) -> f64 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref b = exp(a) end subroutine @@ -30,7 +30,7 @@ subroutine exp_testc(a, b) complex :: a, b ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref> -! CHECK: %[[RES:.*]] = fir.call @fir.exp.z4.z4(%[[A]]) {{.*}}: (!fir.complex<4>) -> !fir.complex<4> +! CHECK: %[[RES:.*]] = fir.call @fir.exp.contract.z4.z4(%[[A]]) {{.*}}: (!fir.complex<4>) -> !fir.complex<4> ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref> b = exp(a) end subroutine @@ -40,33 +40,33 @@ subroutine exp_testcd(a, b) complex(kind=8) :: a, b ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref> -! CHECK: %[[RES:.*]] = fir.call @fir.exp.z8.z8(%[[A]]) {{.*}}: (!fir.complex<8>) -> !fir.complex<8> +! CHECK: %[[RES:.*]] = fir.call @fir.exp.contract.z8.z8(%[[A]]) {{.*}}: (!fir.complex<8>) -> !fir.complex<8> ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref> b = exp(a) end subroutine -! CHECK-LABEL: private @fir.exp.f32.f32 +! CHECK-LABEL: private @fir.exp.contract.f32.f32 ! CHECK-SAME: (%[[ARG32_OUTLINE:.*]]: f32) -> f32 -! CHECK: %[[RESULT32_OUTLINE:.*]] = math.exp %[[ARG32_OUTLINE]] : f32 +! CHECK: %[[RESULT32_OUTLINE:.*]] = math.exp %[[ARG32_OUTLINE]] fastmath : f32 ! CHECK: return %[[RESULT32_OUTLINE]] : f32 -! CHECK-LABEL: private @fir.exp.f64.f64 +! CHECK-LABEL: private @fir.exp.contract.f64.f64 ! CHECK-SAME: (%[[ARG64_OUTLINE:.*]]: f64) -> f64 -! CHECK: %[[RESULT64_OUTLINE:.*]] = math.exp %[[ARG64_OUTLINE]] : f64 +! CHECK: %[[RESULT64_OUTLINE:.*]] = math.exp %[[ARG64_OUTLINE]] fastmath : f64 ! CHECK: return %[[RESULT64_OUTLINE]] : f64 -! CMPLX-LABEL: private @fir.exp.z4.z4 +! CMPLX-LABEL: private @fir.exp.contract.z4.z4 ! CMPLX-SAME: (%[[ARG32_OUTLINE:.*]]: !fir.complex<4>) -> !fir.complex<4> ! CMPLX-FAST: %[[C:.*]] = fir.convert %[[ARG32_OUTLINE]] : (!fir.complex<4>) -> complex ! CMPLX-FAST: %[[E:.*]] = complex.exp %[[C]] : complex ! CMPLX-FAST: %[[RESULT32_OUTLINE:.*]] = fir.convert %[[E]] : (complex) -> !fir.complex<4> -! CMPLX-PRECISE: %[[RESULT32_OUTLINE:.*]] = fir.call @cexpf(%[[ARG32_OUTLINE]]) : (!fir.complex<4>) -> !fir.complex<4> +! CMPLX-PRECISE: %[[RESULT32_OUTLINE:.*]] = fir.call @cexpf(%[[ARG32_OUTLINE]]) fastmath : (!fir.complex<4>) -> !fir.complex<4> ! CMPLX: return %[[RESULT32_OUTLINE]] : !fir.complex<4> -! CMPLX-LABEL: private @fir.exp.z8.z8 +! CMPLX-LABEL: private @fir.exp.contract.z8.z8 ! CMPLX-SAME: (%[[ARG64_OUTLINE:.*]]: !fir.complex<8>) -> !fir.complex<8> ! CMPLX-FAST: %[[C:.*]] = fir.convert %[[ARG64_OUTLINE]] : (!fir.complex<8>) -> complex ! CMPLX-FAST: %[[E:.*]] = complex.exp %[[C]] : complex ! CMPLX-FAST: %[[RESULT64_OUTLINE:.*]] = fir.convert %[[E]] : (complex) -> !fir.complex<8> -! CMPLX-PRECISE: %[[RESULT64_OUTLINE:.*]] = fir.call @cexp(%[[ARG64_OUTLINE]]) : (!fir.complex<8>) -> !fir.complex<8> +! CMPLX-PRECISE: %[[RESULT64_OUTLINE:.*]] = fir.call @cexp(%[[ARG64_OUTLINE]]) fastmath : (!fir.complex<8>) -> !fir.complex<8> ! CMPLX: return %[[RESULT64_OUTLINE]] : !fir.complex<8> diff --git a/flang/test/Lower/Intrinsics/log.f90 b/flang/test/Lower/Intrinsics/log.f90 --- a/flang/test/Lower/Intrinsics/log.f90 +++ b/flang/test/Lower/Intrinsics/log.f90 @@ -10,7 +10,7 @@ subroutine log_testr(a, b) real :: a, b ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref -! CHECK: %[[RES:.*]] = fir.call @fir.log.f32.f32(%[[A]]) {{.*}}: (f32) -> f32 +! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.f32.f32(%[[A]]) {{.*}}: (f32) -> f32 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref b = log(a) end subroutine @@ -20,7 +20,7 @@ subroutine log_testd(a, b) real(kind=8) :: a, b ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref -! CHECK: %[[RES:.*]] = fir.call @fir.log.f64.f64(%[[A]]) {{.*}}: (f64) -> f64 +! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.f64.f64(%[[A]]) {{.*}}: (f64) -> f64 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref b = log(a) end subroutine @@ -30,7 +30,7 @@ subroutine log_testc(a, b) complex :: a, b ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref> -! CHECK: %[[RES:.*]] = fir.call @fir.log.z4.z4(%[[A]]) {{.*}}: (!fir.complex<4>) -> !fir.complex<4> +! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.z4.z4(%[[A]]) {{.*}}: (!fir.complex<4>) -> !fir.complex<4> ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref> b = log(a) end subroutine @@ -40,7 +40,7 @@ subroutine log_testcd(a, b) complex(kind=8) :: a, b ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref> -! CHECK: %[[RES:.*]] = fir.call @fir.log.z8.z8(%[[A]]) {{.*}}: (!fir.complex<8>) -> !fir.complex<8> +! CHECK: %[[RES:.*]] = fir.call @fir.log.contract.z8.z8(%[[A]]) {{.*}}: (!fir.complex<8>) -> !fir.complex<8> ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref> b = log(a) end subroutine @@ -50,7 +50,7 @@ subroutine log10_testr(a, b) real :: a, b ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref -! CHECK: %[[RES:.*]] = fir.call @fir.log10.f32.f32(%[[A]]) {{.*}}: (f32) -> f32 +! CHECK: %[[RES:.*]] = fir.call @fir.log10.contract.f32.f32(%[[A]]) {{.*}}: (f32) -> f32 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref b = log10(a) end subroutine @@ -60,43 +60,43 @@ subroutine log10_testd(a, b) real(kind=8) :: a, b ! CHECK: %[[A:.*]] = fir.load %[[AREF:.*]] : !fir.ref -! CHECK: %[[RES:.*]] = fir.call @fir.log10.f64.f64(%[[A]]) {{.*}}: (f64) -> f64 +! CHECK: %[[RES:.*]] = fir.call @fir.log10.contract.f64.f64(%[[A]]) {{.*}}: (f64) -> f64 ! CHECK: fir.store %[[RES]] to %[[BREF]] : !fir.ref b = log10(a) end subroutine -! CHECK-LABEL: private @fir.log.f32.f32 +! CHECK-LABEL: private @fir.log.contract.f32.f32 ! CHECK-SAME: (%[[ARG32_OUTLINE:.*]]: f32) -> f32 -! CHECK: %[[RESULT32_OUTLINE:.*]] = math.log %[[ARG32_OUTLINE]] : f32 +! CHECK: %[[RESULT32_OUTLINE:.*]] = math.log %[[ARG32_OUTLINE]] fastmath : f32 ! CHECK: return %[[RESULT32_OUTLINE]] : f32 -! CHECK-LABEL: private @fir.log.f64.f64 +! CHECK-LABEL: private @fir.log.contract.f64.f64 ! CHECK-SAME: (%[[ARG64_OUTLINE:.*]]: f64) -> f64 -! CHECK: %[[RESULT64_OUTLINE:.*]] = math.log %[[ARG64_OUTLINE]] : f64 +! CHECK: %[[RESULT64_OUTLINE:.*]] = math.log %[[ARG64_OUTLINE]] fastmath : f64 ! CHECK: return %[[RESULT64_OUTLINE]] : f64 -! CMPLX-LABEL: private @fir.log.z4.z4 +! CMPLX-LABEL: private @fir.log.contract.z4.z4 ! CMPLX-SAME: (%[[ARG32_OUTLINE:.*]]: !fir.complex<4>) -> !fir.complex<4> ! CMPLX-FAST: %[[C:.*]] = fir.convert %[[ARG32_OUTLINE]] : (!fir.complex<4>) -> complex ! CMPLX-FAST: %[[E:.*]] = complex.log %[[C]] : complex ! CMPLX-FAST: %[[RESULT32_OUTLINE:.*]] = fir.convert %[[E]] : (complex) -> !fir.complex<4> -! CMPLX-PRECISE: %[[RESULT32_OUTLINE:.*]] = fir.call @clogf(%[[ARG32_OUTLINE]]) : (!fir.complex<4>) -> !fir.complex<4> +! CMPLX-PRECISE: %[[RESULT32_OUTLINE:.*]] = fir.call @clogf(%[[ARG32_OUTLINE]]) fastmath : (!fir.complex<4>) -> !fir.complex<4> ! CMPLX: return %[[RESULT32_OUTLINE]] : !fir.complex<4> -! CMPLX-LABEL: private @fir.log.z8.z8 +! CMPLX-LABEL: private @fir.log.contract.z8.z8 ! CMPLX-SAME: (%[[ARG64_OUTLINE:.*]]: !fir.complex<8>) -> !fir.complex<8> ! CMPLX-FAST: %[[C:.*]] = fir.convert %[[ARG64_OUTLINE]] : (!fir.complex<8>) -> complex ! CMPLX-FAST: %[[E:.*]] = complex.log %[[C]] : complex ! CMPLX-FAST: %[[RESULT64_OUTLINE:.*]] = fir.convert %[[E]] : (complex) -> !fir.complex<8> -! CMPLX-PRECISE: %[[RESULT64_OUTLINE:.*]] = fir.call @clog(%[[ARG64_OUTLINE]]) : (!fir.complex<8>) -> !fir.complex<8> +! CMPLX-PRECISE: %[[RESULT64_OUTLINE:.*]] = fir.call @clog(%[[ARG64_OUTLINE]]) fastmath : (!fir.complex<8>) -> !fir.complex<8> ! CMPLX: return %[[RESULT64_OUTLINE]] : !fir.complex<8> -! CHECK-LABEL: private @fir.log10.f32.f32 +! CHECK-LABEL: private @fir.log10.contract.f32.f32 ! CHECK-SAME: (%[[ARG32_OUTLINE:.*]]: f32) -> f32 -! CHECK: %[[RESULT32_OUTLINE:.*]] = math.log10 %[[ARG32_OUTLINE]] : f32 +! CHECK: %[[RESULT32_OUTLINE:.*]] = math.log10 %[[ARG32_OUTLINE]] fastmath : f32 ! CHECK: return %[[RESULT32_OUTLINE]] : f32 -! CHECK-LABEL: private @fir.log10.f64.f64 +! CHECK-LABEL: private @fir.log10.contract.f64.f64 ! CHECK-SAME: (%[[ARG64_OUTLINE:.*]]: f64) -> f64 -! CHECK: %[[RESULT64_OUTLINE:.*]] = math.log10 %[[ARG64_OUTLINE]] : f64 +! CHECK: %[[RESULT64_OUTLINE:.*]] = math.log10 %[[ARG64_OUTLINE]] fastmath : f64 ! CHECK: return %[[RESULT64_OUTLINE]] : f64 diff --git a/flang/test/Lower/Intrinsics/math-runtime-options.f90 b/flang/test/Lower/Intrinsics/math-runtime-options.f90 --- a/flang/test/Lower/Intrinsics/math-runtime-options.f90 +++ b/flang/test/Lower/Intrinsics/math-runtime-options.f90 @@ -8,22 +8,22 @@ ! CHECK-LABEL: cos_testr subroutine cos_testr(a, b) real :: a, b -! FIR: fir.call @fir.cos.f32.f32 +! FIR: fir.call @fir.cos.contract.f32.f32 b = cos(a) end subroutine ! CHECK-LABEL: cos_testd subroutine cos_testd(a, b) real(kind=8) :: a, b -! FIR: fir.call @fir.cos.f64.f64 +! FIR: fir.call @fir.cos.contract.f64.f64 b = cos(a) end subroutine -! FIR: @fir.cos.f32.f32(%arg0: f32) -> f32 attributes -! FAST: math.cos %arg0 : f32 -! RELAXED: math.cos %arg0 : f32 -! PRECISE: fir.call @cosf(%arg0) : (f32) -> f32 -! FIR: @fir.cos.f64.f64(%arg0: f64) -> f64 -! FAST: math.cos %arg0 : f64 -! RELAXED: math.cos %arg0 : f64 -! PRECISE: fir.call @cos(%arg0) : (f64) -> f64 +! FIR: @fir.cos.contract.f32.f32(%arg0: f32) -> f32 attributes +! FAST: math.cos %arg0 fastmath : f32 +! RELAXED: math.cos %arg0 fastmath : f32 +! PRECISE: fir.call @cosf(%arg0) fastmath : (f32) -> f32 +! FIR: @fir.cos.contract.f64.f64(%arg0: f64) -> f64 +! FAST: math.cos %arg0 fastmath : f64 +! RELAXED: math.cos %arg0 fastmath : f64 +! PRECISE: fir.call @cos(%arg0) fastmath : (f64) -> f64 diff --git a/flang/test/Lower/array-expression-slice-1.f90 b/flang/test/Lower/array-expression-slice-1.f90 --- a/flang/test/Lower/array-expression-slice-1.f90 +++ b/flang/test/Lower/array-expression-slice-1.f90 @@ -43,7 +43,7 @@ ! CHECK: fir.store %[[VAL_41]] to %[[VAL_31]] : !fir.ref ! CHECK: %[[VAL_42:.*]] = fir.load %[[VAL_31]] : !fir.ref ! CHECK: %[[VAL_43:.*]] = fir.convert %[[VAL_42]] : (i32) -> f32 -! CHECK: %[[VAL_44:.*]] = fir.call @fir.cos.f32.f32(%[[VAL_43]]) {{.*}}: (f32) -> f32 +! CHECK: %[[VAL_44:.*]] = fir.call @fir.cos.contract.f32.f32(%[[VAL_43]]) {{.*}}: (f32) -> f32 ! CHECK: %[[VAL_45:.*]] = fir.load %[[VAL_28]] : !fir.ref ! CHECK: %[[VAL_46:.*]] = fir.convert %[[VAL_45]] : (i32) -> i64 ! CHECK: %[[VAL_47:.*]] = arith.subi %[[VAL_46]], %[[VAL_20]] : i64 @@ -60,7 +60,7 @@ ! CHECK: fir.store %[[VAL_36]] to %[[VAL_28]] : !fir.ref ! CHECK: %[[VAL_55:.*]] = fir.load %[[VAL_31]] : !fir.ref ! CHECK: %[[VAL_56:.*]] = fir.convert %[[VAL_55]] : (i32) -> f32 -! CHECK: %[[VAL_57:.*]] = fir.call @fir.sin.f32.f32(%[[VAL_56]]) {{.*}}: (f32) -> f32 +! CHECK: %[[VAL_57:.*]] = fir.call @fir.sin.contract.f32.f32(%[[VAL_56]]) {{.*}}: (f32) -> f32 ! CHECK: %[[VAL_58:.*]] = fir.load %[[VAL_30]] : !fir.ref ! CHECK: %[[VAL_59:.*]] = fir.convert %[[VAL_58]] : (i32) -> i64 ! CHECK: %[[VAL_60:.*]] = arith.subi %[[VAL_59]], %[[VAL_20]] : i64 diff --git a/flang/test/Lower/dummy-procedure.f90 b/flang/test/Lower/dummy-procedure.f90 --- a/flang/test/Lower/dummy-procedure.f90 +++ b/flang/test/Lower/dummy-procedure.f90 @@ -154,14 +154,14 @@ ! CHECK-LABEL: func private @fir.acos.f32.ref_f32(%arg0: !fir.ref) -> f32 !CHECK: %[[load:.*]] = fir.load %arg0 - !CHECK: %[[res:.*]] = fir.call @acosf(%[[load]]) : (f32) -> f32 + !CHECK: %[[res:.*]] = fir.call @acosf(%[[load]]) fastmath : (f32) -> f32 !CHECK: return %[[res]] : f32 ! CHECK-LABEL: func private @fir.atan2.f32.ref_f32.ref_f32( ! CHECK-SAME: %[[x:.*]]: !fir.ref, %[[y:.*]]: !fir.ref) -> f32 ! CHECK-DAG: %[[xload:.*]] = fir.load %[[x]] : !fir.ref ! CHECK-DAG: %[[yload:.*]] = fir.load %[[y]] : !fir.ref - ! CHECK: %[[atan2:.*]] = math.atan2 %[[xload]], %[[yload]] : f32 + ! CHECK: %[[atan2:.*]] = math.atan2 %[[xload]], %[[yload]] fastmath : f32 ! CHECK: return %[[atan2]] : f32 !CHECK-LABEL: func private @fir.aimag.f32.ref_z4(%arg0: !fir.ref>) diff --git a/flang/test/Lower/intrinsic-procedure-wrappers.f90 b/flang/test/Lower/intrinsic-procedure-wrappers.f90 --- a/flang/test/Lower/intrinsic-procedure-wrappers.f90 +++ b/flang/test/Lower/intrinsic-procedure-wrappers.f90 @@ -7,4 +7,4 @@ foo = acos(x) end function -! CHECK: llvm.func internal @fir.acos.f32.f32 +! CHECK: llvm.func internal @fir.acos.contract.f32.f32 diff --git a/flang/test/Lower/sqrt.f90 b/flang/test/Lower/sqrt.f90 --- a/flang/test/Lower/sqrt.f90 +++ b/flang/test/Lower/sqrt.f90 @@ -8,41 +8,41 @@ ! CHECK-LABEL: sqrt_testr subroutine sqrt_testr(a, b) real :: a, b -! CHECK: fir.call @fir.sqrt.f32.f32 +! CHECK: fir.call @fir.sqrt.contract.f32.f32 b = sqrt(a) end subroutine ! CHECK-LABEL: sqrt_testd subroutine sqrt_testd(a, b) real(kind=8) :: a, b -! CHECK: fir.call @fir.sqrt.f64.f64 +! CHECK: fir.call @fir.sqrt.contract.f64.f64 b = sqrt(a) end subroutine ! CHECK-LABEL: sqrt_testc subroutine sqrt_testc(z) complex :: z -! CHECK: fir.call @fir.sqrt.z4.z4 +! CHECK: fir.call @fir.sqrt.contract.z4.z4 z = sqrt(z) end subroutine ! CHECK-LABEL: sqrt_testcd subroutine sqrt_testcd(z) complex(kind=8) :: z -! CHECK: fir.call @fir.sqrt.z8.z8 +! CHECK: fir.call @fir.sqrt.contract.z8.z8 z = sqrt(z) end subroutine -! CHECK-LABEL: @fir.sqrt.f32.f32 +! CHECK-LABEL: @fir.sqrt.contract.f32.f32 ! CHECK: math.sqrt %{{.*}} : f32 -! CHECK-LABEL: @fir.sqrt.f64.f64 +! CHECK-LABEL: @fir.sqrt.contract.f64.f64 ! CHECK: math.sqrt %{{.*}} : f64 -! CHECK-LABEL: func private @fir.sqrt.z4.z4 +! CHECK-LABEL: func private @fir.sqrt.contract.z4.z4 ! CMPLX-FAST: complex.sqrt %{{.*}} : complex ! CMPLX-PRECISE: fir.call @csqrtf -! CHECK-LABEL: @fir.sqrt.z8.z8 +! CHECK-LABEL: @fir.sqrt.contract.z8.z8 ! CMPLX-FAST: complex.sqrt %{{.*}} : complex ! CMPLX-PRECISE: fir.call @csqrt diff --git a/flang/test/Lower/trigonometric-intrinsics.f90 b/flang/test/Lower/trigonometric-intrinsics.f90 --- a/flang/test/Lower/trigonometric-intrinsics.f90 +++ b/flang/test/Lower/trigonometric-intrinsics.f90 @@ -5,245 +5,245 @@ ! CHECK-LABEL: tan_testr subroutine tan_testr(a, b) real :: a, b -! CHECK: fir.call @fir.tan.f32.f32 +! CHECK: fir.call @fir.tan.contract.f32.f32 b = tan(a) end subroutine ! CHECK-LABEL: tan_testd subroutine tan_testd(a, b) real(kind=8) :: a, b -! CHECK: fir.call @fir.tan.f64.f64 +! CHECK: fir.call @fir.tan.contract.f64.f64 b = tan(a) end subroutine ! CHECK-LABEL: tan_testc subroutine tan_testc(z) complex :: z -! CHECK: fir.call @fir.tan.z4.z4 +! CHECK: fir.call @fir.tan.contract.z4.z4 z = tan(z) end subroutine ! CHECK-LABEL: tan_testcd subroutine tan_testcd(z) complex(kind=8) :: z -! CHECK: fir.call @fir.tan.z8.z8 +! CHECK: fir.call @fir.tan.contract.z8.z8 z = tan(z) end subroutine ! CHECK-LABEL: atan_testr subroutine atan_testr(a, b) real :: a, b -! CHECK: fir.call @fir.atan.f32.f32 +! CHECK: fir.call @fir.atan.contract.f32.f32 b = atan(a) end subroutine ! CHECK-LABEL: atan_testd subroutine atan_testd(a, b) real(kind=8) :: a, b -! CHECK: fir.call @fir.atan.f64.f64 +! CHECK: fir.call @fir.atan.contract.f64.f64 b = atan(a) end subroutine ! CHECK-LABEL: atan_testc subroutine atan_testc(z) complex :: z -! CHECK: fir.call @fir.atan.z4.z4 +! CHECK: fir.call @fir.atan.contract.z4.z4 z = atan(z) end subroutine ! CHECK-LABEL: atan_testcd subroutine atan_testcd(z) complex(kind=8) :: z -! CHECK: fir.call @fir.atan.z8.z8 +! CHECK: fir.call @fir.atan.contract.z8.z8 z = atan(z) end subroutine ! CHECK-LABEL: cos_testr subroutine cos_testr(a, b) real :: a, b -! CHECK: fir.call @fir.cos.f32.f32 +! CHECK: fir.call @fir.cos.contract.f32.f32 b = cos(a) end subroutine ! CHECK-LABEL: cos_testd subroutine cos_testd(a, b) real(kind=8) :: a, b -! CHECK: fir.call @fir.cos.f64.f64 +! CHECK: fir.call @fir.cos.contract.f64.f64 b = cos(a) end subroutine ! CHECK-LABEL: cos_testc subroutine cos_testc(z) complex :: z -! CHECK: fir.call @fir.cos.z4.z4 +! CHECK: fir.call @fir.cos.contract.z4.z4 z = cos(z) end subroutine ! CHECK-LABEL: cos_testcd subroutine cos_testcd(z) complex(kind=8) :: z -! CHECK: fir.call @fir.cos.z8.z8 +! CHECK: fir.call @fir.cos.contract.z8.z8 z = cos(z) end subroutine ! CHECK-LABEL: cosh_testr subroutine cosh_testr(a, b) real :: a, b -! CHECK: fir.call @fir.cosh.f32.f32 +! CHECK: fir.call @fir.cosh.contract.f32.f32 b = cosh(a) end subroutine ! CHECK-LABEL: cosh_testd subroutine cosh_testd(a, b) real(kind=8) :: a, b -! CHECK: fir.call @fir.cosh.f64.f64 +! CHECK: fir.call @fir.cosh.contract.f64.f64 b = cosh(a) end subroutine ! CHECK-LABEL: cosh_testc subroutine cosh_testc(z) complex :: z -! CHECK: fir.call @fir.cosh.z4.z4 +! CHECK: fir.call @fir.cosh.contract.z4.z4 z = cosh(z) end subroutine ! CHECK-LABEL: cosh_testcd subroutine cosh_testcd(z) complex(kind=8) :: z -! CHECK: fir.call @fir.cosh.z8.z8 +! CHECK: fir.call @fir.cosh.contract.z8.z8 z = cosh(z) end subroutine ! CHECK-LABEL: sin_testr subroutine sin_testr(a, b) real :: a, b -! CHECK: fir.call @fir.sin.f32.f32 +! CHECK: fir.call @fir.sin.contract.f32.f32 b = sin(a) end subroutine ! CHECK-LABEL: sin_testd subroutine sin_testd(a, b) real(kind=8) :: a, b -! CHECK: fir.call @fir.sin.f64.f64 +! CHECK: fir.call @fir.sin.contract.f64.f64 b = sin(a) end subroutine ! CHECK-LABEL: sin_testc subroutine sin_testc(z) complex :: z -! CHECK: fir.call @fir.sin.z4.z4 +! CHECK: fir.call @fir.sin.contract.z4.z4 z = sin(z) end subroutine ! CHECK-LABEL: sin_testcd subroutine sin_testcd(z) complex(kind=8) :: z -! CHECK: fir.call @fir.sin.z8.z8 +! CHECK: fir.call @fir.sin.contract.z8.z8 z = sin(z) end subroutine ! CHECK-LABEL: sinh_testr subroutine sinh_testr(a, b) real :: a, b -! CHECK: fir.call @fir.sinh.f32.f32 +! CHECK: fir.call @fir.sinh.contract.f32.f32 b = sinh(a) end subroutine ! CHECK-LABEL: sinh_testd subroutine sinh_testd(a, b) real(kind=8) :: a, b -! CHECK: fir.call @fir.sinh.f64.f64 +! CHECK: fir.call @fir.sinh.contract.f64.f64 b = sinh(a) end subroutine ! CHECK-LABEL: sinh_testc subroutine sinh_testc(z) complex :: z -! CHECK: fir.call @fir.sinh.z4.z4 +! CHECK: fir.call @fir.sinh.contract.z4.z4 z = sinh(z) end subroutine ! CHECK-LABEL: sinh_testcd subroutine sinh_testcd(z) complex(kind=8) :: z -! CHECK: fir.call @fir.sinh.z8.z8 +! CHECK: fir.call @fir.sinh.contract.z8.z8 z = sinh(z) end subroutine -! CHECK-LABEL: @fir.tan.f32.f32 +! CHECK-LABEL: @fir.tan.contract.f32.f32 ! CHECK: math.tan %{{.*}} : f32 -! CHECK-LABEL: @fir.tan.f64.f64 +! CHECK-LABEL: @fir.tan.contract.f64.f64 ! CHECK: math.tan %{{.*}} : f64 -! CHECK-LABEL: @fir.tan.z4.z4 +! CHECK-LABEL: @fir.tan.contract.z4.z4 ! CMPLX-FAST: complex.tan %{{.*}} : complex ! CMPLX-PRECISE: fir.call @ctanf -! CHECK-LABEL: @fir.tan.z8.z8 +! CHECK-LABEL: @fir.tan.contract.z8.z8 ! CMPLX-FAST: complex.tan %{{.*}} : complex ! CMPLX-PRECISE: fir.call @ctan -! CHECK-LABEL: @fir.atan.f32.f32 +! CHECK-LABEL: @fir.atan.contract.f32.f32 ! CHECK: math.atan %{{.*}} : f32 -! CHECK-LABEL: @fir.atan.f64.f64 +! CHECK-LABEL: @fir.atan.contract.f64.f64 ! CHECK: math.atan %{{.*}} : f64 -! CHECK-LABEL: @fir.atan.z4.z4 +! CHECK-LABEL: @fir.atan.contract.z4.z4 ! CHECK: fir.call @catanf -! CHECK-LABEL: @fir.atan.z8.z8 +! CHECK-LABEL: @fir.atan.contract.z8.z8 ! CHECK: fir.call @catan -! CHECK-LABEL: @fir.cos.f32.f32 +! CHECK-LABEL: @fir.cos.contract.f32.f32 ! CHECK: math.cos %{{.*}} : f32 -! CHECK-LABEL: @fir.cos.f64.f64 +! CHECK-LABEL: @fir.cos.contract.f64.f64 ! CHECK: math.cos %{{.*}} : f64 -! CHECK-LABEL: @fir.cos.z4.z4 +! CHECK-LABEL: @fir.cos.contract.z4.z4 ! CMPLX-FAST: complex.cos %{{.*}} : complex ! CMPLX-PRECISE: fir.call @ccosf -! CHECK-LABEL: @fir.cos.z8.z8 +! CHECK-LABEL: @fir.cos.contract.z8.z8 ! CMPLX-FAST: complex.cos %{{.*}} : complex ! CMPLX-PRECISE: fir.call @ccos -! CHECK-LABEL: @fir.cosh.f32.f32 +! CHECK-LABEL: @fir.cosh.contract.f32.f32 ! CHECK: fir.call {{.*}}cosh -! CHECK-LABEL: @fir.cosh.f64.f64 +! CHECK-LABEL: @fir.cosh.contract.f64.f64 ! CHECK: fir.call {{.*}}cosh -! CHECK-LABEL: @fir.cosh.z4.z4 +! CHECK-LABEL: @fir.cosh.contract.z4.z4 ! CHECK: fir.call @ccoshf -! CHECK-LABEL: @fir.cosh.z8.z8 +! CHECK-LABEL: @fir.cosh.contract.z8.z8 ! CHECK: fir.call @ccosh -! CHECK-LABEL: @fir.sin.f32.f32 +! CHECK-LABEL: @fir.sin.contract.f32.f32 ! CHECK: math.sin %{{.*}} : f32 -! CHECK-LABEL: @fir.sin.f64.f64 +! CHECK-LABEL: @fir.sin.contract.f64.f64 ! CHECK: math.sin %{{.*}} : f64 -! CHECK-LABEL: @fir.sin.z4.z4 +! CHECK-LABEL: @fir.sin.contract.z4.z4 ! CMPLX-FAST: complex.sin %{{.*}} : complex ! CMPLX-PRECISE: fir.call @csinf -! CHECK-LABEL: @fir.sin.z8.z8 +! CHECK-LABEL: @fir.sin.contract.z8.z8 ! CMPLX-FAST: complex.sin %{{.*}} : complex ! CMPLX-PRECISE: fir.call @csin -! CHECK-LABEL: @fir.sinh.f32.f32 +! CHECK-LABEL: @fir.sinh.contract.f32.f32 ! CHECK: fir.call {{.*}}sinh -! CHECK-LABEL: @fir.sinh.f64.f64 +! CHECK-LABEL: @fir.sinh.contract.f64.f64 ! CHECK: fir.call {{.*}}sinh -! CHECK-LABEL: @fir.sinh.z4.z4 +! CHECK-LABEL: @fir.sinh.contract.z4.z4 ! CHECK: fir.call @csinhf -! CHECK-LABEL: @fir.sinh.z8.z8 +! CHECK-LABEL: @fir.sinh.contract.z8.z8 ! CHECK: fir.call @csinh