[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 --check-prefix=CH

[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 --check-prefix=CHECK-N

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

[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 --check-prefix=CHECK-N

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

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

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

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

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

2024-07-23 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/99723 >From 869385fd8d7738b041149d88d5f427b5039c5921 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 6 May 2024 10:07:52 -0700 Subject: [PATCH 1/3] [Driver] Clean up fp-contract handling in clang driver This

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

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

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

2024-07-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/100453 This change modifies -ffp-model=fast to select options that more closely match -funsafe-math-optimizations, and introduces a new model, -ffp-model=aggressive which matches the existing behavior (except for a m

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

2024-07-24 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > Should include a driver test with an offload language to see it gets applied > to both compiles I think that's a good idea, but I don't think it's directly related to this PR. https://github.com/llvm/llvm-project/pull/100453 ___ c

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

2024-07-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/100453 >From cf7bf482e7ce11f0ca1add4b0bb62a327ac56b71 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 15:34:03 -0700 Subject: [PATCH 1/2] [Driver] Introduce ffp-model=aggressive This change modifi

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

2024-07-25 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > It seems a bit confusing to me to create a situation where `-ffast-math` is > equivalent to `-ffp-model=aggressive`, not `-ffp-model=fast`. I can understand that, but the problem I'm trying to fix is that the naming of fast-math options we inherited from gcc is counter-intu

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

2024-07-25 Thread Andy Kaylor via cfe-commits
andykaylor wrote: FWIW, here is a comparison of clang to the two other non-LLVM-based compilers I'm aware of that implement an option equivalent to `-ffp-model=fast` https://godbolt.org/z/anjs78bj1 https://github.com/llvm/llvm-project/pull/100453 ___

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

2024-07-29 Thread Andy Kaylor via cfe-commits
@@ -102,6 +102,16 @@ Deprecated Compiler Flags Modified Compiler Flags --- +- The ``-ffp-model`` option has been updated to enable a more limited set of + optimizations when the ``fast`` argument is used and to accept a new argument, + ``aggressive``. Th

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

2024-07-30 Thread Andy Kaylor via cfe-commits
andykaylor wrote: Providing a bit more context here, the change to remove the finite-math-only assumption from `-ffp-model=fast` is intended to avoid problems like https://github.com/llvm/llvm-project/issues/69089. In that case, more aggressive optimizations based on the `ninf` fast-math flag

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

2024-07-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/99723 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] [Driver] Clean up fp-contract handling in clang driver (PR #99723)

2024-07-19 Thread Andy Kaylor via cfe-commits
andykaylor wrote: This is a refreshed version of https://github.com/llvm/llvm-project/pull/91271. Given how long it's been since I updated that PR, it seemed better to just start fresh. https://github.com/llvm/llvm-project/pull/99723 ___ cfe-commits

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

2024-07-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/99723 >From 869385fd8d7738b041149d88d5f427b5039c5921 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 6 May 2024 10:07:52 -0700 Subject: [PATCH 1/2] [Driver] Clean up fp-contract handling in clang driver This

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

2024-07-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/91271 ___ 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
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. https://github

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

[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] 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 &Args, ToolChain::addProfileRTLibs(Args, CmdArgs); } -llvm::DenormalMode -Linux::getDefaultDenormalModeForType(const llvm::opt::ArgList &DriverArgs, - const JobAct

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

[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 &Args, ToolChain::addProfileRTLibs(Args, CmdArgs); } -llvm::DenormalMode -Linux::getDefaultDenormalModeForType(const llvm::opt::ArgList &DriverArgs, - const JobAct

[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. https:/

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

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

[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] 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] 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 ___ cfe-comm

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

[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 &Args, Arg *A = Args.getLastArg(options::OPT_ffast_math, options::OPT_fno_fast_math, options::OPT_funsafe_math_optimizations, - options::OPT_fn

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

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

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

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

[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 ___ cfe-co

[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. https://github.com/ll

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

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

[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] [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] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

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

[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

2024-08-27 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/105746 >From 973e7fb1a09f5479f88616e19642a71edc977b4a Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Thu, 22 Aug 2024 15:35:07 -0700 Subject: [PATCH 1/2] Honor pragmas with -ffp-contract=fast, depecate fast-honor

[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

2024-08-27 Thread Andy Kaylor via cfe-commits
andykaylor wrote: This may not be as bad as I thought. After looking more closely at the one test case that was failing with this change, it turned out that the failure was happening because the test contained a pragma to turn contraction off but checks to verify that the fma was generated any

[clang] The pragma STDC CX_LIMITED_RANGE ON should have precedence. (PR #98520)

2024-07-12 Thread Andy Kaylor via cfe-commits
@@ -218,28 +214,31 @@ _Complex float pragma_default_div(_Complex float a, _Complex float b) { // IMPRVD-NEXT: fsub float // IMPRVD-NEXT: fdiv float - // PRMTD: load float, ptr {{.*}} - // PRMTD: fpext float {{.*}} to double - // PRMTD-NEXT: fpext float {{.*}} to double

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

[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 &TC, const Driver &D, // Validate and pass through -ffp-contract option. case options::OPT_ffp_contract: { StringRef Val = A->getValue(); - if (PreciseFPModel) { a

[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 &TC, const Driver &D, if (!FPContract.empty()) CmdArgs.push_back(Args.MakeArgString("-ffp-contract=" + FPContract)); - if (!RoundingFPMath) -CmdArgs.push_back(Args.MakeArgString("-fno-ro

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

[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] [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] [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 &TC, const Driver &D, AssociativeMath = false; ReciprocalMath = false; SignedZeros = true; - FPContract = "on"; andykaylor wrote: It was unnecessary. Only one

[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] Introduce ffp-model=aggressive (PR #100453)

2024-08-07 Thread Andy Kaylor via cfe-commits
andykaylor wrote: @MaskRay @jyknight @jcranmer-intel Any more comments on this? 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] [Driver] Introduce ffp-model=aggressive (PR #100453)

2024-08-19 Thread Andy Kaylor via cfe-commits
@@ -163,23 +183,41 @@ // CHECK-FEB-IGNORE: "-fno-rounding-math" // CHECK-FEB-IGNORE: "-ffp-exception-behavior=ignore" -// RUN: %clang -### -nostdinc -Werror -ffast-math -ffp-model=fast -c %s 2>&1 \ +// RUN: %clang -### -nostdinc -Werror -ffast-math -ffp-model=aggressive -c %s

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

2024-08-19 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > > @MaskRay Are you OK with this change? > > Sorry for the delay. I've read through > https://discourse.llvm.org/t/making-ffp-model-fast-more-user-friendly/78402, > how we ended up with `-ffp-contract=fast-honor-pragmas` beside `=fast` (GCC > compatibility, sigh), some note

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

2024-08-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/100453 >From cf7bf482e7ce11f0ca1add4b0bb62a327ac56b71 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 15:34:03 -0700 Subject: [PATCH 1/4] [Driver] Introduce ffp-model=aggressive This change modifi

[clang] [Driver] Make ffp-model=fast honor non-finite-values, introduce ffp-model=aggressive (PR #100453)

2024-08-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited 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 bug with -ffp-contract=fast-honor-pragmas (PR #104854)

2024-08-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/104854 This fixes a problem which caused clang to assert in the Sema pragma handling if it encountered "#pragma STDC FP_CONTRACT DEFAULT" when compiling with the -ffp-contract=fast-honor-pragmas option. This fixes h

[clang] Fix bug with -ffp-contract=fast-honor-pragmas (PR #104857)

2024-08-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/104857 This fixes a problem which caused clang to assert in the Sema pragma handling if it encountered "#pragma STDC FP_CONTRACT DEFAULT" when compiling with the -ffp-contract=fast-honor-pragmas option. This fixes h

[clang] Fix bug with -ffp-contract=fast-honor-pragmas (PR #104854)

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

[clang] [Driver] Make ffp-model=fast honor non-finite-values, introduce ffp-model=aggressive (PR #100453)

2024-08-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/100453 >From 59ac754b9a88037e2348f16e5dc7efbd437d65cb Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 19 Aug 2024 13:41:40 -0700 Subject: [PATCH 1/5] Fix bug with -ffp-contract=fast-honor-pragmas This fixes a

[clang] [Driver] Make ffp-model=fast honor non-finite-values, introduce ffp-model=aggressive (PR #100453)

2024-08-19 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/100453 >From 9ee59aa30aa3eb4aba986d8cdfb65fbfc7591f0b Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Fri, 19 Apr 2024 15:34:03 -0700 Subject: [PATCH 1/4] [Driver] Introduce ffp-model=aggressive This change modifi

[clang] [Driver] Make ffp-model=fast honor non-finite-values, introduce ffp-model=aggressive (PR #100453)

2024-08-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed 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 bug with -ffp-contract=fast-honor-pragmas (PR #104857)

2024-08-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/104857 >From 59ac754b9a88037e2348f16e5dc7efbd437d65cb Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 19 Aug 2024 13:41:40 -0700 Subject: [PATCH 1/2] Fix bug with -ffp-contract=fast-honor-pragmas This fixes a

[clang] Fix bug with -ffp-contract=fast-honor-pragmas (PR #104857)

2024-08-20 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > LGTM. Thanks. I had to double check, but it looks like the LIT test > `ffp-contract-fast-honor-pragma-option.cpp` has the same behavior with and > without this patch. Right? Aren't there already tests that check the output > of the option? Yes, the `ffp-contract-fast-honor

[clang] Fix bug with -ffp-contract=fast-honor-pragmas (PR #104857)

2024-08-20 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/104857 >From 59ac754b9a88037e2348f16e5dc7efbd437d65cb Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 19 Aug 2024 13:41:40 -0700 Subject: [PATCH 1/3] Fix bug with -ffp-contract=fast-honor-pragmas This fixes a

[clang] Fix bug with -ffp-contract=fast-honor-pragmas (PR #104857)

2024-08-21 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/104857 >From 59ac754b9a88037e2348f16e5dc7efbd437d65cb Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 19 Aug 2024 13:41:40 -0700 Subject: [PATCH 1/3] Fix bug with -ffp-contract=fast-honor-pragmas This fixes a

[clang] Fix bug with -ffp-contract=fast-honor-pragmas (PR #104857)

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

[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

2024-08-22 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/105746 Change the handling of -ffp-contract=fast such that the contract semantics described in the IR are always respected. The front end was already generating IR that enabled or disabled contraction as requested by

[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

2024-08-22 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > Is the backend actually ready for this? Looking quickly at the backend, it > looks like target-independent code is fine, but some of the target-specific > code doesn't respect the "contract" flag on instructions. Doesn't respect it in what way? Do you mean it doesn't attemp

[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

2024-08-22 Thread Andy Kaylor via cfe-commits
@@ -3178,6 +3178,13 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D, StringRef Val = A->getValue(); if (Val == "fast" || Val == "on" || Val == "off" || Val == "fast-honor-pragmas") { +// fast-honor-pragmas is depreca

[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

2024-08-22 Thread Andy Kaylor via cfe-commits
@@ -68,35 +68,12 @@ // RUN: -O3 -target-cpu gfx906 -o - -x ir %t.ll \ // RUN: | FileCheck -check-prefixes=COMMON,AMD-OPT-FASTSTD %s -// Explicit -ffp-contract=fast-honor-pragmas -// In IR, fmul/fadd instructions with contract flag are emitted. -// In backend -//nvptx/a

[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

2024-08-22 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > Is the backend actually ready for this? Looking quickly at the backend, it > looks like target-independent code is fine, but some of the target-specific > code doesn't respect the "contract" flag on instructions. I didn't realize I wasn't building all targets in my local sa

[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

2024-08-23 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > Is the backend actually ready for this? Looking quickly at the backend, it > looks like target-independent code is fine, but some of the target-specific > code doesn't respect the "contract" flag on instructions. As I just mentioned on my RFC, it turns out the state of back

[clang] Honor pragmas with -ffp-contract=fast, depecate fast-honor-pragmas (PR #105746)

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

[clang] [clang] Allow `ConditionalOperator` fast-math flags to be overridden by `pragma float_control` (PR #105912)

2024-10-08 Thread Andy Kaylor via cfe-commits
andykaylor wrote: @rjmccall I understand your point, and I think you're raising a good question. Let's walk through an example that illustrates why we currently want FMF on phis and selects and see if we can agree on an alternative way to handle it. In a comment on https://github.com/llvm/llvm

[clang] [clang] Allow `ConditionalOperator` fast-math flags to be overridden by `pragma float_control` (PR #105912)

2024-10-08 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > Yeah, the conditional operator doesn't do any floating-path math itself. If > the first operand is a floating-point expression, we should always be > modeling that with a float-to-boolean conversion, and the flags should go > there (if they're necessary — I didn't think com

[clang] [clang] Allow `ConditionalOperator` fast-math flags to be overridden by `pragma float_control` (PR #105912)

2024-10-08 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > Are you suggesting that loads need to have fast-math flags attached to them? > Because this sounds like a bad representation in IR. What I'm primarily suggesting is that we should be handling conditional operators consistently in the presence of pragmas. Whether that can be

[clang] [clang] constexpr built-in fma function. (PR #113020)

2024-10-29 Thread Andy Kaylor via cfe-commits
@@ -549,6 +562,22 @@ static bool interp__builtin_fpclassify(InterpState &S, CodePtr OpPC, return true; } +static bool interp__builtin_fma(InterpState &S, CodePtr OpPC, +const InterpFrame *Frame, const Function *Func, +

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-24 Thread Andy Kaylor via cfe-commits
@@ -2994,6 +2994,29 @@ A "convergencectrl" operand bundle is only valid on a ``convergent`` operation. When present, the operand bundle must contain exactly one value of token type. See the :doc:`ConvergentOperations` document for details. +.. _ob_fpe: + +Floating-point Envir

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-24 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor commented: I don't think attaching these operand bundles to the existing set of intrinsics is what we want to do. I'd prefer to deprecate the existing intrinsics and define some new scheme that uses these bundles on intrinsics that may be used in other ways. One

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-24 Thread Andy Kaylor via cfe-commits
@@ -43,6 +43,15 @@ enum ExceptionBehavior : uint8_t { } +inline bool isValidExceptionBehavior(unsigned X) { andykaylor wrote: Do you know why the exception behaviors aren't handled in FloatingPointMode.h? https://github.com/llvm/llvm-project/pull/109798 ___

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-24 Thread Andy Kaylor via cfe-commits
@@ -2994,6 +2994,29 @@ A "convergencectrl" operand bundle is only valid on a ``convergent`` operation. When present, the operand bundle must contain exactly one value of token type. See the :doc:`ConvergentOperations` document for details. +.. _ob_fpe: + +Floating-point Envir

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-24 Thread Andy Kaylor via cfe-commits
@@ -47,6 +47,15 @@ enum class RoundingMode : int8_t { Invalid = -1///< Denotes invalid value. }; +inline bool isValidRoundingMode(int X) { + return X >= 0 && X <= static_cast(RoundingMode::Dynamic); andykaylor wrote: This isn't a sufficient check. For

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

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

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-24 Thread Andy Kaylor via cfe-commits
@@ -357,6 +357,9 @@ class IRBuilderBase { void setConstrainedFPCallAttr(CallBase *I) { I->addFnAttr(Attribute::StrictFP); +MemoryEffects ME = MemoryEffects::inaccessibleMemOnly(); andykaylor wrote: I think all of the constrained intrinsics currently

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-26 Thread Andy Kaylor via cfe-commits
andykaylor wrote: > With the constrained intrinsics the default is safe because optimizations > don't recognize the constrained intrinsic and thus don't know how to optimize > it. If we instead rely on the strictfp attribute then we'll need possibly > thousands of checks for this attribute, we

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-26 Thread Andy Kaylor via cfe-commits
@@ -2994,6 +2994,29 @@ A "convergencectrl" operand bundle is only valid on a ``convergent`` operation. When present, the operand bundle must contain exactly one value of token type. See the :doc:`ConvergentOperations` document for details. +.. _ob_fpe: + +Floating-point Envir

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-26 Thread Andy Kaylor via cfe-commits
@@ -357,6 +357,9 @@ class IRBuilderBase { void setConstrainedFPCallAttr(CallBase *I) { I->addFnAttr(Attribute::StrictFP); +MemoryEffects ME = MemoryEffects::inaccessibleMemOnly(); andykaylor wrote: >From the LangRef "Calls and invokes with operand b

[clang] [clang] Allow `pragma float_control(precise, *)` to... (PR #105912)

2024-09-27 Thread Andy Kaylor via cfe-commits
@@ -4210,26 +4210,45 @@ class AbstractConditionalOperator : public Expr { /// ConditionalOperator - The ?: ternary operator. The GNU "missing /// middle" extension is a BinaryConditionalOperator. -class ConditionalOperator : public AbstractConditionalOperator { +class Conditi

[clang] [CIR] Initial implementation of CIR-to-LLVM IR lowering pass (PR #125260)

2025-02-03 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/125260 >From 4801886dd4c45d32891a7337ad7430a6c5137929 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 28 Jan 2025 12:28:58 -0800 Subject: [PATCH 01/11] [CIR] Initial implementation of CIR-to-LLVM IR lowering

[clang] [CIR] Initial implementation of CIR-to-LLVM IR lowering pass (PR #125260)

2025-02-03 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor updated https://github.com/llvm/llvm-project/pull/125260 >From 4801886dd4c45d32891a7337ad7430a6c5137929 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 28 Jan 2025 12:28:58 -0800 Subject: [PATCH 01/11] [CIR] Initial implementation of CIR-to-LLVM IR lowering

<    1   2   3   4   5   6   7   >