[lld] [compiler-rt] [llvm] [openmp] [clang-tools-extra] [clang] [mlir] [ADT] Make SmallVectorImpl destructor protected (PR #71437)

2023-11-06 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/71437 Because the SmallVectorImpl destructor is not virtual, the destructor of derived classes will not be called if pointers to the SmallVectorImpl class are deleted directly. Making the SmallVectorImpl destructor

[lld] [compiler-rt] [llvm] [openmp] [clang-tools-extra] [clang] [mlir] [ADT] Make SmallVectorImpl destructor protected (PR #71437)

2023-11-06 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/71437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[flang] [libcxx] [libc] [compiler-rt] [llvm] [clang-tools-extra] [clang] [mlir] Make SmallVectorImpl destructor protected (PR #71439)

2023-11-06 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/71439 Because the SmallVectorImpl destructor is not virtual, the destructor of derived classes will not be called if pointers to the SmallVectorImpl class are deleted directly. Making the SmallVectorImpl destructor

[flang] [clang] [libcxx] [mlir] [compiler-rt] [libc] [llvm] [clang-tools-extra] Make SmallVectorImpl destructor protected (PR #71439)

2023-11-06 Thread Andy Kaylor via cfe-commits
@@ -95,7 +95,7 @@ class SerializeToHsacoPass std::unique_ptr> serializeISA(const std::string &isa) override; - std::unique_ptr> assembleIsa(const std::string &isa); + std::unique_ptr> assembleIsa(const std::string &isa); andykaylor wrote: I'm not famili

[libc] [llvm] [compiler-rt] [flang] [clang-tools-extra] [libcxx] [mlir] [clang] Make SmallVectorImpl destructor protected (PR #71439)

2023-11-07 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > We probably (pretty sure) don't want to add a virtual dtor to SmallVector - > that'd add a vtable pointer, increasing the size in ways that are probably > unacceptable given the pervasive use of the data structure. > > We should make the Impl dtor protected so it can't be p

[libc] [clang-tools-extra] [libcxx] [clang] [llvm] [flang] [compiler-rt] [mlir] Make SmallVectorImpl destructor protected (PR #71439)

2023-11-07 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I don't think this change is time-critical. I can wait a few days for the SerializeToHsaco fix, but if it's going to be more than a few days, I'd prefer to land this change with an interim fix in SerializeToHsaco. @krzysz00 what's your preference? https://github.com/llvm/llv

[clang] [llvm] Reapply "InstCombine: Introduce SimplifyDemandedUseFPClass"" (PR #74056)

2023-12-21 Thread Andy Kaylor via cfe-commits
andykaylor wrote: It seems like there are two possible interpretations of -ffinite-math-only: 1. There will be no NaN or inf values seen anywhere in the program (other than loads and stores?). 2. No floating-point operation (other than compares?) will have NaN or inf inputs or results. The te

[clang] [llvm] Reapply "InstCombine: Introduce SimplifyDemandedUseFPClass"" (PR #74056)

2023-12-21 Thread Andy Kaylor via cfe-commits
andykaylor wrote: For those who haven't already seen it, there was a related discussion here: https://discourse.llvm.org/t/should-isnan-be-optimized-out-in-fast-math-mode/5 I think that discussion could be fairly summarized by saying that no consensus was reached, and many people wished th

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/76873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -6771,6 +6771,9 @@ def warn_pointer_sub_null_ptr : Warning< def warn_floatingpoint_eq : Warning< "comparing floating point with == or != is unsafe">, InGroup>, DefaultIgnore; +def warn_fast_floatingpoint_eq : Warning< + "explicit comparison with %0 in fast floating poin

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: Expanding the scope a bit, it would also be useful to have warnings for constant NaN or Inf values passed as arguments or used in binary operations. https://github.com/llvm/llvm-project/pull/76873 ___ cfe-commi

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -2245,6 +2246,11 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, case Builtin::BI__builtin_islessequal: case Builtin::BI__builtin_islessgreater: case Builtin::BI__builtin_isunordered: +if (BuiltinID == Builtin::BI__builtin_isunordered) {

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -13846,6 +13880,37 @@ Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType, CheckPPCMMAType(RetValExp->getType(), ReturnLoc); } +/// Diagnose comparison to NAN or INFINITY in fast math modes. +/// The comparison to NaN or INFINITY is always false in +/// fast mod

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -2267,6 +2273,16 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, case Builtin::BI__builtin_signbit: case Builtin::BI__builtin_signbitf: case Builtin::BI__builtin_signbitl: +FPO = TheCall->getFPFeaturesInEffect(getLangOpts()); ---

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -13044,9 +13044,12 @@ static QualType checkArithmeticOrEnumeralCompare(Sema &S, ExprResult &LHS, if (Type->isAnyComplexType() && BinaryOperator::isRelationalOp(Opc)) return S.InvalidOperands(Loc, LHS, RHS); - // Check for comparisons of floating point operands using

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -13846,6 +13880,37 @@ Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType, CheckPPCMMAType(RetValExp->getType(), ReturnLoc); } +/// Diagnose comparison to NAN or INFINITY in fast math modes. +/// The comparison to NaN or INFINITY is always false in +/// fast mod

[llvm] [clang] [clang-tools-extra] DAG: Implement promotion for strict_fp_round (PR #74332)

2024-01-04 Thread Andy Kaylor via cfe-commits
@@ -2621,6 +2642,29 @@ SDValue DAGTypeLegalizer::PromoteFloatRes_FP_ROUND(SDNode *N) { return DAG.getNode(GetPromotionOpcode(VT, NVT), DL, NVT, Round); } +// Explicit operation to reduce precision. Reduce the value to half precision +// and promote it back to the legal typ

[clang-tools-extra] [clang] [llvm] DAG: Implement promotion for strict_fp_round (PR #74332)

2024-01-04 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/74332 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] [llvm] DAG: Implement promotion for strict_fp_round (PR #74332)

2024-01-04 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. This looks good to me. I've added Phoebe Wang as a reviewer because she knows the SelectionDAG code better than I do and might want to take a look. I'm assuming you have reviewed the AMDGPU-specific parts of this with someone who knows

[clang] [CLANG] Add warning when comparing to INF or NAN in fast math mode. (PR #76873)

2024-01-05 Thread Andy Kaylor via cfe-commits
@@ -13846,6 +13880,37 @@ Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType, CheckPPCMMAType(RetValExp->getType(), ReturnLoc); } +/// Diagnose comparison to NAN or INFINITY in fast math modes. +/// The comparison to NaN or INFINITY is always false in +/// fast mod

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-14 Thread Andy Kaylor via cfe-commits
@@ -2807,9 +2791,17 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, FPExceptionBehavior = ""; // If fast-math is set then set the fp-contract mode to fast. FPContract = "fast"; -// ffast-math enables limited range rules for compl

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-14 Thread Andy Kaylor via cfe-commits
@@ -51,11 +51,12 @@ class ComplexExprEmitter CGBuilderTy &Builder; bool IgnoreReal; bool IgnoreImag; -public: - ComplexExprEmitter(CodeGenFunction &cgf, bool ir=false, bool ii=false) -: CGF(cgf), Builder(CGF.Builder), IgnoreReal(ir), IgnoreImag(ii) { - } + LangOpti

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-14 Thread Andy Kaylor via cfe-commits
@@ -794,8 +834,10 @@ ComplexPairTy ComplexExprEmitter::EmitBinMul(const BinOpInfo &Op) { ResR = Builder.CreateFSub(AC, BD, "mul_r"); ResI = Builder.CreateFAdd(AD, BC, "mul_i"); - if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Limited || - Op.

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-14 Thread Andy Kaylor via cfe-commits
@@ -2807,9 +2791,17 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, FPExceptionBehavior = ""; // If fast-math is set then set the fp-contract mode to fast. FPContract = "fast"; -// ffast-math enables limited range rules for compl

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-14 Thread Andy Kaylor via cfe-commits
@@ -986,13 +1028,17 @@ ComplexPairTy ComplexExprEmitter::EmitBinDiv(const BinOpInfo &Op) { llvm::Value *OrigLHSi = LHSi; if (!LHSi) LHSi = llvm::Constant::getNullValue(RHSi->getType()); -if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Fortran) +Qua

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-14 Thread Andy Kaylor via cfe-commits
@@ -2824,26 +2816,89 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, switch (optID) { default: break; -case options::OPT_fcx_limited_range: { - EmitComplexRangeDiag(D, Range, LangOptions::ComplexRangeKind::CX_Limited); -

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-14 Thread Andy Kaylor via cfe-commits
@@ -986,13 +1028,17 @@ ComplexPairTy ComplexExprEmitter::EmitBinDiv(const BinOpInfo &Op) { llvm::Value *OrigLHSi = LHSi; if (!LHSi) LHSi = llvm::Constant::getNullValue(RHSi->getType()); -if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Fortran) +Qua

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-15 Thread Andy Kaylor via cfe-commits
@@ -794,8 +834,10 @@ ComplexPairTy ComplexExprEmitter::EmitBinMul(const BinOpInfo &Op) { ResR = Builder.CreateFSub(AC, BD, "mul_r"); ResI = Builder.CreateFAdd(AD, BC, "mul_i"); - if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Limited || - Op.

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-15 Thread Andy Kaylor via cfe-commits
@@ -2824,26 +2816,89 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, switch (optID) { default: break; -case options::OPT_fcx_limited_range: { - EmitComplexRangeDiag(D, Range, LangOptions::ComplexRangeKind::CX_Limited); -

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-15 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: Except for lacking a couple of tests, I think this looks good. @jcranmer-intel do you agree? https://github.com/llvm/llvm-project/pull/81514 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-15 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/81514 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-15 Thread Andy Kaylor via cfe-commits
@@ -287,9 +288,47 @@ class ComplexExprEmitter ComplexPairTy EmitComplexBinOpLibCall(StringRef LibCallName, const BinOpInfo &Op); - QualType getPromotionType(QualType Ty) { + QualType GetHigherPrecisionFPType(QualType ElementType) { +

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-15 Thread Andy Kaylor via cfe-commits
andykaylor wrote: Can you add test cases for targets that will have problems with promotion. Something like this? ``` // RUN: %clang_cc1 -triple x86_64-windows-pc \ // RUN: -complex-range=promoted -emit-llvm -o - %s \ // RUN: | FileCheck %s --check-prefix=X86W

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-18 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. This looks good to me. Thanks for the updates! https://github.com/llvm/llvm-project/pull/81514 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-06 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > > I may have mentioned a few times that I don't like function attributes > > controlling fast-math behaviors. > > It doesn't control it, it's informative. You just get undefined behavior if > you end up calling mismatched mode functions. What I meant to say was that I don'

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-06 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > > > So, alternatively...we could just go with the simplest solution, and use > > > "ieee" as the default even under -ffast-math. > > +1. **There hasn't been a performance reason to use FTZ/DAZ since ~2011.** > Maybe there's still a power benefit? But in that case you could

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-07 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > Just to be clear: I'm not proposing entirely eliminating the "link against > crtfastmath.o" behavior, when linking a binary with `-ffast-math` (though, > separately from _this_ review, that may be worth considering!). I only meant > we should stop attempting to infer anythi

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-08 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > I'm suggesting that we modify Clang so that `-ffast-math` _doesn't affect_ > `denormal-fp-math`, by (as I mentioned before) removing the overload > [Linux::getDefaultDenormalModeForType](https://github.com/llvm/llvm-project/blob/d4c5acac99e83ffa12d2d720c9e502a181cbd7ea/clang

[clang] [NFC] Refactor fast-math handling for clang driver (PR #81173)

2024-02-08 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/81173 This refactors the fast-math handling in the clang driver, moving the settings into a lambda that is shared by the -ffp-model=fast and -ffast-math code. Previously the -ffp-model=fast handler changed the loca

[clang] [NFC] Refactor fast-math handling for clang driver (PR #81173)

2024-02-08 Thread Andy Kaylor via cfe-commits
@@ -3061,22 +3080,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, continue; [[fallthrough]]; andykaylor wrote: This is falling through from OPT_Ofast to OPT_ffast_math. I think we still want that to happen. It's

[clang] [NFC] Refactor fast-math handling for clang driver (PR #81173)

2024-02-08 Thread Andy Kaylor via cfe-commits
@@ -2842,9 +2862,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, << Args.MakeArgString("-ffp-model=" + FPModel) << Args.MakeArgString("-ffp-model=" + Val); if (Val.equals("fast")) { -optID = options::OPT_f

[clang] [NFC] Refactor fast-math handling for clang driver (PR #81173)

2024-02-08 Thread Andy Kaylor via cfe-commits
@@ -2842,9 +2862,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, << Args.MakeArgString("-ffp-model=" + FPModel) << Args.MakeArgString("-ffp-model=" + Val); if (Val.equals("fast")) { -optID = options::OPT_f

[clang] [NFC] Refactor fast-math handling for clang driver (PR #81173)

2024-02-08 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/81173 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-08 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > > I'd like to see this change land, but with the "-mdaz-ftz" option removed > > (because I don't think it's useful). That would fix the critical problem of > > fast-math infecting shared libraries with the ftz setting, and we could > > straighten out the other problems, whi

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-08 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > > I don't see why the current denormal-fp-math setting behavior is a blocking > > issue for this change > > Because this PR as-is causes us to start parsing the "-shared" flag for > compilation actions in order to determine which denormal-fp-math setting to > use. Users sh

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-08 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I just created https://github.com/llvm/llvm-project/issues/81204 to describe the linking versus compiling problem. https://github.com/llvm/llvm-project/pull/80475 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] [llvm] InstCombine: Enable SimplifyDemandedUseFPClass and remove flag (PR #81108)

2024-02-08 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/81108 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-09 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > I don't think it's unreasonable to switch the logic of `-mdaz-ftz` from > linking a file with a global initializer that sets the flags to making it > emit the entry-point call to such a function instead, it still largely > follows the same logic to me. And having a command

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-09 Thread Andy Kaylor via cfe-commits
@@ -1569,6 +1569,40 @@ // RUN:--gcc-toolchain="" \ // RUN:--sysroot=%S/Inputs/basic_linux_tree 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s +// Don't link crtfastmath.o with -shared +// RUN: %clang --target=x86_64-unknown-linux -no-pie -###

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-09 Thread Andy Kaylor via cfe-commits
@@ -117,6 +117,11 @@ C23 Feature Support Non-comprehensive list of changes in this release - +* Code compiled with ``-shared`` and ``-ffast-math`` will no longer enable + flush-to-zero floating-point mode by default. This decisi

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-09 Thread Andy Kaylor via cfe-commits
@@ -117,6 +117,11 @@ C23 Feature Support Non-comprehensive list of changes in this release - +* Code compiled with ``-shared`` and ``-ffast-math`` will no longer enable andykaylor wrote: ```suggestion * Code com

[clang] [NFC] Refactor fast-math handling for clang driver (PR #81173)

2024-02-12 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/81173 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-12 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,25 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-12 Thread Andy Kaylor via cfe-commits
@@ -283,9 +283,23 @@ class ComplexExprEmitter ComplexPairTy EmitComplexBinOpLibCall(StringRef LibCallName, const BinOpInfo &Op); - QualType getPromotionType(QualType Ty) { + QualType getPromotionType(QualType Ty, bool IsDivOpCode = f

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-12 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,25 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-12 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,25 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-12 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,25 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-12 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,25 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-12 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,25 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-01 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,33 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-01 Thread Andy Kaylor via cfe-commits
@@ -283,9 +283,46 @@ class ComplexExprEmitter ComplexPairTy EmitComplexBinOpLibCall(StringRef LibCallName, const BinOpInfo &Op); - QualType getPromotionType(QualType Ty) { + QualType HigherPrecisionTypeForComplexArithmetic(QualType E

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-03-01 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,50 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. +.. option:: -fcomplex-arithmetic=: + + This option specifies the impl

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-05 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I don't know anything about how non-x86 targets implement DAZ/FTZ, but for x86-based targets, I think trying to make any assumptions about the setting is bound to be wrong. In theory, it's part of the floating-point environment and shouldn't be modified during execution unles

[clang] Disable FTZ/DAZ when compiling shared libraries by default. (PR #80475)

2024-02-05 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > > (Sidenote: "dynamic" isn't even > > [documented](https://clang.llvm.org/docs/UsersManual.html#cmdoption-fdenormal-fp-math)). > > It's not a selectable enum of the Clang `-fdenormal-fp-math` flag, but it is > one for the LLVM function attribute `denormal-fp-math`. This is

[clang] [CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (PR #76873)

2024-01-11 Thread Andy Kaylor via cfe-commits
@@ -6771,6 +6771,11 @@ def warn_pointer_sub_null_ptr : Warning< def warn_floatingpoint_eq : Warning< "comparing floating point with == or != is unsafe">, InGroup>, DefaultIgnore; +def warn_fast_floatingpoint_eq : Warning< + "use of %select{infinity|NaN}0 will always be 'fa

[lldb] [flang] [libcxx] [lld] [clang] [compiler-rt] [libcxxabi] [libunwind] [libc] [llvm] [clang-tools-extra] Fix a bug in Smith's algorithm used in complex div/mul. (PR #78330)

2024-01-17 Thread Andy Kaylor via cfe-commits
@@ -2780,24 +2781,24 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, case options::OPT_fcx_limited_range: { EmitComplexRangeDiag(D, Range, LangOptions::ComplexRangeKind::CX_Limited); Range = LangOptions::ComplexRangeKind::CX_Lim

[clang] [Driver,sanitizer] Remove RequiresPIE and msan's NeedPIE setting (PR #77689)

2024-01-18 Thread Andy Kaylor via cfe-commits
andykaylor wrote: @MaskRay I see that in 3bbc912d37f03d9ad3be330b81d91c2eaf6c37f2 you removed some tests that fail because of this change. Why do you think that is an appropriate solution? I have some other tests in a downstream product that are failing because we build with CLANG_DEFAULT_PIE_

[flang] [lld] [compiler-rt] [clang-tools-extra] [clang] [libc] [libcxx] [libunwind] [llvm] [lldb] [libcxxabi] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

2024-01-18 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > I mean that we could lazily emit a helper function like > `__clang_smiths_division_double` and call it instead of emitting like twenty > instructions inline. That's a reasonable suggestion. We may also want to add the ability to emit a helper function to handle the full ra

[clang] [Driver,sanitizer] Remove RequiresPIE and msan's NeedPIE setting (PR #77689)

2024-01-18 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > > @MaskRay I see that in > > [3bbc912](https://github.com/llvm/llvm-project/commit/3bbc912d37f03d9ad3be330b81d91c2eaf6c37f2) > > you removed some tests that fail because of this change. Why do you think > > that is an appropriate solution? I have some other tests in a downs

[clang] [clang-tools-extra] [llvm] [CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (PR #76873)

2024-01-18 Thread Andy Kaylor via cfe-commits
@@ -2835,6 +2835,9 @@ class Preprocessor { if (Identifier.getIdentifierInfo()->isRestrictExpansion() && !SourceMgr.isInMainFile(Identifier.getLocation())) emitRestrictExpansionWarning(Identifier); + +if (Identifier.getIdentifierInfo()->getName() == "INFINI

[libcxxabi] [clang] [lld] [lldb] [flang] [libunwind] [compiler-rt] [libc] [libcxx] [llvm] [clang-tools-extra] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

2024-01-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/78330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang-tools-extra] [CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (PR #76873)

2024-01-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. I'm happy with this. https://github.com/llvm/llvm-project/pull/76873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix build warning caused by mixed signed/unsigned compare (PR #69797)

2023-10-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/69797 None >From 856a471b40f19f5fcf6aab7591009555b6a3841f Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 20 Oct 2023 12:33:51 -0700 Subject: [PATCH 1/2] Update SimplifyIndVar.cpp In SimplifyIndvar::replaceF

[clang] Fix build warning caused by mixed signed/unsigned compare (PR #69797)

2023-10-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/69797 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] clang: Add pragma clang fp reciprocal (PR #68267)

2023-10-06 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/68267 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] clang: Add pragma clang fp reciprocal (PR #68267)

2023-10-06 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: Thanks for adding this! I have just a few minor comments. https://github.com/llvm/llvm-project/pull/68267 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] clang: Add pragma clang fp reciprocal (PR #68267)

2023-10-06 Thread Andy Kaylor via cfe-commits
@@ -4609,6 +4609,22 @@ The pragma can take two values: ``on`` and ``off``. float v = t + z; } +``#pragma clang fp reciprocal`` allows control over using reciprocal +approximations in floating point expressions. When enabled, this +pragma allows the expression ``x / y`` t

[clang] clang: Add pragma clang fp reciprocal (PR #68267)

2023-10-06 Thread Andy Kaylor via cfe-commits
@@ -1309,6 +1309,13 @@ void Sema::ActOnPragmaFPReassociate(SourceLocation Loc, bool IsEnabled) { CurFPFeatures = NewFPFeatures.applyOverrides(getLangOpts()); } +void Sema::ActOnPragmaFPReciprocal(SourceLocation Loc, bool IsEnabled) { andykaylor wrote: This

[clang] clang: Add pragma clang fp reciprocal (PR #68267)

2023-10-06 Thread Andy Kaylor via cfe-commits
andykaylor wrote: err_pragma_fp_invalid_option needs to be updated to add 'reciprocal' https://github.com/llvm/llvm-project/pull/68267 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] clang: Add pragma clang fp reciprocal (PR #68267)

2023-10-06 Thread Andy Kaylor via cfe-commits
@@ -1309,6 +1309,13 @@ void Sema::ActOnPragmaFPReassociate(SourceLocation Loc, bool IsEnabled) { CurFPFeatures = NewFPFeatures.applyOverrides(getLangOpts()); } +void Sema::ActOnPragmaFPReciprocal(SourceLocation Loc, bool IsEnabled) { andykaylor wrote: Ther

[clang] Fix math-errno issue (PR #66381)

2023-09-15 Thread Andy Kaylor via cfe-commits
@@ -2339,6 +2345,28 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // LLVM counterparts if the call is marked 'const' (known to never set errno). // In case FP exceptions are enabled, the experimental versions of the // intrinsics mo

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -396,7 +396,41 @@ class LangOptionsBase { IncompleteOnly = 3, }; - enum ComplexRangeKind { CX_Full, CX_Limited, CX_Fortran, CX_None }; + /// Controls the various implementations for complex multiplication and + // division. + enum ComplexRangeKind { +/// Imple

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,33 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -79,29 +91,152 @@ _Complex float pragma_on_div(_Complex float a, _Complex float b) { // LMTD-NEXT: fdiv float // LMTD-NEXT: fdiv float - // FRTRN: fmul float - // FRTRN-NEXT: fmul float - // FRTRN-NEXT: fadd float - // FRTRN-NEXT: fmul float - // FRTRN-NEXT: fmul

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,33 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,33 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -1041,28 +1041,15 @@ defm offload_uniform_block : BoolFOption<"offload-uniform-block", NegFlag, BothFlags<[], [ClangOption], " that kernels are launched with uniform block sizes (default true for CUDA/HIP and false otherwise)">>; -def fcx_limited_range : Joined<["-"],

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -283,9 +283,48 @@ class ComplexExprEmitter ComplexPairTy EmitComplexBinOpLibCall(StringRef LibCallName, const BinOpInfo &Op); - QualType getPromotionType(QualType Ty) { + QualType HigherPrecisionTypeForComplexArithmetic(QualType E

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,33 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,33 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -1847,19 +1847,33 @@ floating point semantic models: precise (the default), strict, and fast. * ``16`` - Forces ``_Float16`` operations to be emitted without using excess precision arithmetic. -.. option:: -fcx-limited-range: - - This option enables the naive mat

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -283,9 +283,48 @@ class ComplexExprEmitter ComplexPairTy EmitComplexBinOpLibCall(StringRef LibCallName, const BinOpInfo &Op); - QualType getPromotionType(QualType Ty) { + QualType HigherPrecisionTypeForComplexArithmetic(QualType E

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-21 Thread Andy Kaylor via cfe-commits
@@ -67,41 +79,164 @@ _Complex float pragma_on_div(_Complex float a, _Complex float b) { // FULL-NEXT: fdiv float // FULL: fdiv float - // LMTD: fmul float - // LMTD-NEXT: fmul float - // LMTD-NEXT: fadd float - // LMTD-NEXT: fmul float - // LMTD-NEXT: fmul float - /

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-22 Thread Andy Kaylor via cfe-commits
@@ -1041,28 +1041,15 @@ defm offload_uniform_block : BoolFOption<"offload-uniform-block", NegFlag, BothFlags<[], [ClangOption], " that kernels are launched with uniform block sizes (default true for CUDA/HIP and false otherwise)">>; -def fcx_limited_range : Joined<["-"],

[clang] [CLANG] Full support of complex multiplication and division. (PR #81514)

2024-02-22 Thread Andy Kaylor via cfe-commits
@@ -1041,28 +1041,15 @@ defm offload_uniform_block : BoolFOption<"offload-uniform-block", NegFlag, BothFlags<[], [ClangOption], " that kernels are launched with uniform block sizes (default true for CUDA/HIP and false otherwise)">>; -def fcx_limited_range : Joined<["-"],

[clang] [NFC] Add assertion to ensure FiniteMathOnly is in sync with HonorINFs and HonorNANs. (PR #97342)

2024-07-03 Thread Andy Kaylor via cfe-commits
@@ -816,6 +816,11 @@ class FPOptions { setAllowFPReassociate(LO.AllowFPReassoc); setNoHonorNaNs(LO.NoHonorNaNs); setNoHonorInfs(LO.NoHonorInfs); +// Ensure that if FiniteMathOnly is enabled, NoHonorNaNs and NoHonorInfs are +// also enabled. This is because

[clang] [Driver] Introduce ffp-model=aggressive (PR #100453)

2024-08-13 Thread Andy Kaylor via cfe-commits
andykaylor wrote: @kpneal I think the tolerance of excess precision is mostly a concession to the hardware limitations. I believe we only apply it when half-precision types are used but the hardware doesn't support native half-precision operations. In this sense, it is equivalent to the situat

[clang] [Driver] Introduce ffp-model=aggressive (PR #100453)

2024-08-15 Thread Andy Kaylor via cfe-commits
andykaylor wrote: @MaskRay Are you OK with this change? https://github.com/llvm/llvm-project/pull/100453 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix -fno-unsafe-math-optimizations behavior (PR #89473)

2024-04-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/89473 This changes the handling of -fno-unsafe-fp-math to stop having that option imply -ftrapping-math. In gcc, -fno-unsafe-math-optimizations sets -ftrapping-math, but that dependency is based on the fact the -ftra

[clang] Align -ffp-model=fast denormal handling with -ffast-math (PR #89477)

2024-04-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/89477 This is an attempt to better align the denormal handling of -ffp-model=fast with the behavior of -ffast-math. The clang user's manual claims that -ffp-model=fast "behaves identically to specifying both -ffast-m

  1   2   3   4   5   6   7   >