[clang] [Driver] Clean up fp-contract handling in clang driver (PR #91271)

2024-05-10 Thread Andy Kaylor via cfe-commits
@@ -238,3 +238,17 @@ // RUN: %clang -### -fno-unsafe-math-optimizations -funsafe-math-optimizations \ // RUN: -ffp-contract=off -c %s 2>&1 | FileCheck --check-prefix=CHECK-FPC-OFF %s +// RUN: %clang -### -funsafe-math-optimizations -ffp-contract=off -c %s 2>&1 \

[clang] [Driver] Clean up fp-contract handling in clang driver (PR #91271)

2024-05-07 Thread Andy Kaylor via cfe-commits
@@ -2893,7 +2915,6 @@ static void RenderFloatingPointOptions(const ToolChain , const Driver , AssociativeMath = false; ReciprocalMath = false; SignedZeros = true; - FPContract = "on"; andykaylor wrote: It was unnecessary. Only one of

[clang] [Driver] Clean up fp-contract handling in clang driver (PR #91271)

2024-05-06 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/91271 This change refactors the fp-contract handling in RenderFloatingPointOptions in the clang driver code and fixes some inconsistencies in the way warnings are reported for changes in the fp-contract behavior.

[clang] [NFC][Driver] Clean up RenderFloatingPointOptions() (PR #91017)

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

[clang] [NFC][Driver] Clean up RenderFloatingPointOptions() (PR #91017)

2024-05-06 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/91017 >From 82e51e4cea0cb889842273fcac874bb52d6bd780 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 3 May 2024 14:14:58 -0700 Subject: [PATCH 1/2] [NFC][Driver] Clean up RenderFloatingPointOptions() This

[clang] [NFC][Driver] Clean up RenderFloatingPointOptions() (PR #91017)

2024-05-03 Thread Andy Kaylor via cfe-commits
@@ -3225,11 +3204,10 @@ static void RenderFloatingPointOptions(const ToolChain , const Driver , if (!FPContract.empty()) CmdArgs.push_back(Args.MakeArgString("-ffp-contract=" + FPContract)); - if (!RoundingFPMath) -

[clang] [NFC][Driver] Clean up RenderFloatingPointOptions() (PR #91017)

2024-05-03 Thread Andy Kaylor via cfe-commits
@@ -3010,13 +2995,8 @@ static void RenderFloatingPointOptions(const ToolChain , const Driver , // Validate and pass through -ffp-contract option. case options::OPT_ffp_contract: { StringRef Val = A->getValue(); - if (PreciseFPModel) {

[clang] [NFC][Driver] Clean up RenderFloatingPointOptions() (PR #91017)

2024-05-03 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/91017 This change refactors RenderFloatingPointOptions() to eliminate some excessively complicated logic and a redundant switch statement. The logic being simplified is an artifact of the original -ffp-model

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

2024-04-30 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/89473 ___ 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-30 Thread Andy Kaylor via cfe-commits
andykaylor wrote: ping for review https://github.com/llvm/llvm-project/pull/89473 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Clean up denormal handling with fast-math-related options (PR #89477)

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

[clang] [Driver] Clean up denormal handling with fast-math-related options (PR #89477)

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

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

2024-04-29 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/89477 >From 8ab931c4506f08685758a58f4cf7974c5254c3fa Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 17:53:52 -0700 Subject: [PATCH 1/8] Clean up denormal handling with -ffp-model, -ffast-math,

[clang] [clang][CodeGen] Propagate pragma set fast-math flags to floating point builtins (PR #90377)

2024-04-29 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. This looks right to me, but @zahiraam is more familiar with this code than I am. Zahira, do you have any comments? https://github.com/llvm/llvm-project/pull/90377 ___ cfe-commits mailing list

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

2024-04-26 Thread Andy Kaylor via cfe-commits
@@ -64,7 +64,8 @@ // RUN: %clang -### -ffp-model=strict -fdenormal-fp-math=preserve-sign,preserve-sign -c %s 2>&1 \ andykaylor wrote: I didn't intend to change the logic of this test. The behavior here should be target-independent now.

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

2024-04-26 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > LGTM. May be no need for the "etc" in the title of the patch? Thanks. The "etc." is eliding -fno-fast-math, -funsafe-math-optimizations, and -fno-unsafe-math-optimizations https://github.com/llvm/llvm-project/pull/89477 ___

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

2024-04-26 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/89477 >From 8ab931c4506f08685758a58f4cf7974c5254c3fa Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 17:53:52 -0700 Subject: [PATCH 1/7] Clean up denormal handling with -ffp-model, -ffast-math,

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

2024-04-26 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/89477 >From 8ab931c4506f08685758a58f4cf7974c5254c3fa Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 17:53:52 -0700 Subject: [PATCH 1/6] Clean up denormal handling with -ffp-model, -ffast-math,

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

2024-04-26 Thread Andy Kaylor via cfe-commits
@@ -75,6 +76,7 @@ // RUN: --check-prefix=WARN12 %s // RUN: %clang -### -ffast-math -ffp-model=strict -c %s 2>&1 | FileCheck \ // RUN: --check-prefix=WARN12 %s +// WARN12: clang andykaylor wrote: The only purpose of the check here is to establish a

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

2024-04-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/89477 >From 8ab931c4506f08685758a58f4cf7974c5254c3fa Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 17:53:52 -0700 Subject: [PATCH 1/5] Clean up denormal handling with -ffp-model, -ffast-math,

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

2024-04-25 Thread Andy Kaylor via cfe-commits
@@ -1314,11 +1314,17 @@ bool ToolChain::isFastMathRuntimeAvailable(const ArgList , Arg *A = Args.getLastArg(options::OPT_ffast_math, options::OPT_fno_fast_math, options::OPT_funsafe_math_optimizations, -

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

2024-04-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/89477 >From 8ab931c4506f08685758a58f4cf7974c5254c3fa Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 17:53:52 -0700 Subject: [PATCH 1/4] Clean up denormal handling with -ffp-model, -ffast-math,

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

2024-04-25 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I've updated this change to account for the changes made in https://github.com/llvm/llvm-project/pull/80475 and made corresponding updated to the PR title and description. https://github.com/llvm/llvm-project/pull/89477 ___

[clang] Clean up denormal handling with -ffp-model, -ffast-math, etc. (PR #89477)

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

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

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

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

2024-04-25 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/89477 >From 8ab931c4506f08685758a58f4cf7974c5254c3fa Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 17:53:52 -0700 Subject: [PATCH 1/3] Clean up denormal handling with -ffp-model, -ffast-math,

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

2024-04-24 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > One final nit before you submit, though: please update the PR description and > the release notes to also mention that x86 no longer modifies > `-fdenormal-fp-math` based on `-ffast-math`. The Clang User's Manual makes some contradictory statements about this. In one

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

2024-04-24 Thread Andy Kaylor via cfe-commits
andykaylor wrote: This patch will need extensive changes once https://github.com/llvm/llvm-project/pull/80475 lands. We're basically decoupling "denormal-fp-math" from fast-math, but I think we still want to link "crtfastmath.o" when --fp-model=fast is used, as we do with -ffast-math.

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

2024-04-24 Thread Andy Kaylor via cfe-commits
@@ -842,25 +842,6 @@ void Linux::addProfileRTLibs(const llvm::opt::ArgList , ToolChain::addProfileRTLibs(Args, CmdArgs); } -llvm::DenormalMode -Linux::getDefaultDenormalModeForType(const llvm::opt::ArgList , - const JobAction , -

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

2024-04-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/89473 >From a137c023aaf5ccc174d347b7bda403bf15d683ae Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Wed, 24 Apr 2024 12:35:49 -0700 Subject: [PATCH] Fix -fno-unsafe-math-optimizations behavior This changes the

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

2024-04-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. https://github.com/llvm/llvm-project/pull/80475 ___ 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-04-24 Thread Andy Kaylor via cfe-commits
@@ -842,25 +842,6 @@ void Linux::addProfileRTLibs(const llvm::opt::ArgList , ToolChain::addProfileRTLibs(Args, CmdArgs); } -llvm::DenormalMode -Linux::getDefaultDenormalModeForType(const llvm::opt::ArgList , - const JobAction , -

[clang] fast math test overhaul (PR #89687)

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

[clang] fast math test overhaul (PR #89687)

2024-04-23 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/89687 >From 8c23afa9fd069fece39f3fa7a913d93aee082c77 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 23 Apr 2024 14:29:00 -0700 Subject: [PATCH] Clean up the checks in the fast-math driver test This change

[clang] fast math test overhaul (PR #89687)

2024-04-23 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > I think this works for the test. I'm slightly confused by the PR not-stacking > with the test changes on top of the other PR That's user error on my part. There are commits here that I didn't intend to be part of this PR. I'll clean it up before I submit it.

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

2024-04-22 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I've made extensive changes to the fast-math.c test here: https://github.com/llvm/llvm-project/pull/89687 That update isn't intended to change any existing behavior. A few things worked differently than I expected, but I left the checks consistent with the current behavior

[clang] fast math test overhaul (PR #89687)

2024-04-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/89687 - Fix -fno-unsafe-math-optimizations behavior - [WIP] Major change to fast-math.c lit test - Clean up the checks in the fast-math driver test >From 100fc9dfb2b071877d758ce71bddeec693d986da Mon Sep 17

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

2024-04-22 Thread Andy Kaylor via cfe-commits
andykaylor wrote: I've made some minor changes to clean up the LIT test checks for this PR. I started to clean up the entire test, but it quickly became obvious that I should put that into a separate PR. I will submit a new PR to clean up the entire fast-math.c test. I have an idea that I

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

2024-04-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/89473 >From 100fc9dfb2b071877d758ce71bddeec693d986da Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 16:35:00 -0700 Subject: [PATCH 1/2] Fix -fno-unsafe-math-optimizations behavior This changes

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

2024-04-22 Thread Andy Kaylor via cfe-commits
@@ -318,12 +320,12 @@ // RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ // RUN: -fno-trapping-math -ftrapping-math -c %s 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-NO-REASSOC-NO-UNSAFE-MATH %s +// RUN: | FileCheck

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

2024-04-22 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > This effort is highly desirable, c.f. this [blog > post](https://moyix.blogspot.com/2022/09/someones-been-messing-with-my-subnormals.html), > so thanks for that! > > Xref: #57589, #80475, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 My patch here still leaves the

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

2024-04-22 Thread Andy Kaylor via cfe-commits
@@ -318,12 +320,12 @@ // RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ // RUN: -fno-trapping-math -ftrapping-math -c %s 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-NO-REASSOC-NO-UNSAFE-MATH %s +// RUN: | FileCheck

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

2024-04-22 Thread Andy Kaylor via cfe-commits
@@ -271,30 +271,32 @@ // RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s // RUN: %clang -### -funsafe-math-optimizations -fno-reciprocal-math -c %s \ -// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s +// RUN: 2>&1 | FileCheck

[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

[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

[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

[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

[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 ); - 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
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
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

[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 , const Driver , 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
@@ -794,8 +834,10 @@ ComplexPairTy ComplexExprEmitter::EmitBinMul(const BinOpInfo ) { ResR = Builder.CreateFSub(AC, BD, "mul_r"); ResI = Builder.CreateFAdd(AD, BC, "mul_i"); - if (Op.FPFeatures.getComplexRange() == LangOptions::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 ) { llvm::Value *OrigLHSi = LHSi; if (!LHSi) LHSi = llvm::Constant::getNullValue(RHSi->getType()); -if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Fortran) +

[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 , const Driver , 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 ) { llvm::Value *OrigLHSi = LHSi; if (!LHSi) LHSi = llvm::Constant::getNullValue(RHSi->getType()); -if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Fortran) +

[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 , const Driver , FPExceptionBehavior = ""; // If fast-math is set then set the fp-contract mode to fast. FPContract = "fast"; -// ffast-math enables limited range rules for complex

[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 ) { ResR = Builder.CreateFSub(AC, BD, "mul_r"); ResI = Builder.CreateFAdd(AD, BC, "mul_i"); - if (Op.FPFeatures.getComplexRange() == LangOptions::CX_Limited || -

[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 bool IgnoreReal; bool IgnoreImag; -public: - ComplexExprEmitter(CodeGenFunction , bool ir=false, bool ii=false) -: CGF(cgf), Builder(CGF.Builder), IgnoreReal(ir), IgnoreImag(ii) { - } +

[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 , const Driver , FPExceptionBehavior = ""; // If fast-math is set then set the fp-contract mode to fast. FPContract = "fast"; -// ffast-math enables limited range rules for complex

[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

[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 ); - QualType getPromotionType(QualType Ty) { + QualType HigherPrecisionTypeForComplexArithmetic(QualType

[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

[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 :

[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 :

[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-21 Thread Andy Kaylor via cfe-commits
@@ -283,9 +283,48 @@ class ComplexExprEmitter ComplexPairTy EmitComplexBinOpLibCall(StringRef LibCallName, const BinOpInfo ); - QualType getPromotionType(QualType Ty) { + QualType HigherPrecisionTypeForComplexArithmetic(QualType

[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

[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

[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

[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 ); - QualType getPromotionType(QualType Ty) { + QualType HigherPrecisionTypeForComplexArithmetic(QualType

[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 :

[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

[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

[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

[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 { +///

[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

[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

[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

[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

[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

[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 ); - QualType getPromotionType(QualType Ty) { + QualType getPromotionType(QualType Ty, bool IsDivOpCode =

[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

[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] 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

[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

[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
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] [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-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

[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

[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,

[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] [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 , const Driver , << Args.MakeArgString("-ffp-model=" + FPModel) << Args.MakeArgString("-ffp-model=" + Val); if (Val.equals("fast")) { -optID =

[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 , const Driver , << Args.MakeArgString("-ffp-model=" + FPModel) << Args.MakeArgString("-ffp-model=" + Val); if (Val.equals("fast")) { -optID =

[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 , const Driver , 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 not

[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

[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 >

[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

[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

  1   2   >