[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-10 Thread Tarun Prabhu via cfe-commits
https://github.com/tarunprabhu closed https://github.com/llvm/llvm-project/pull/143418 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Cameron McInally via cfe-commits
mcinally wrote: > Thanks for the changes, Cameron. LGTM. Thanks! Would you mind merging yet again? I still don't have access yet. https://github.com/llvm/llvm-project/pull/143418 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
https://github.com/tarunprabhu approved this pull request. Thanks for the changes, Cameron. LGTM. https://github.com/llvm/llvm-project/pull/143418 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Cameron McInally via cfe-commits
https://github.com/mcinally updated https://github.com/llvm/llvm-project/pull/143418 >From f4812aacb17aaf535f454c82e4ef29c5c9950a12 Mon Sep 17 00:00:00 2001 From: Cameron McInally Date: Mon, 9 Jun 2025 11:19:36 -0700 Subject: [PATCH 1/2] [flang] Add support for -mrecip[=] This patch adds suppo

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
@@ -2636,6 +2636,11 @@ void ModuleImport::processFunctionAttributes(llvm::Function *func, funcOp.setTargetFeaturesAttr( LLVM::TargetFeaturesAttr::get(context, attr.getValueAsString())); + if (llvm::Attribute attr = func->getFnAttribute("reciprocal-estimates"); +

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
@@ -1549,6 +1549,9 @@ LogicalResult ModuleTranslation::convertOneFunction(LLVMFuncOp func) { if (auto tuneCpu = func.getTuneCpu()) llvmFunc->addFnAttr("tune-cpu", *tuneCpu); + if (auto reciprocalEstimates = func.getReciprocalEstimates()) tarunprabhu wr

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Cameron McInally via cfe-commits
@@ -2636,6 +2636,11 @@ void ModuleImport::processFunctionAttributes(llvm::Function *func, funcOp.setTargetFeaturesAttr( LLVM::TargetFeaturesAttr::get(context, attr.getValueAsString())); + if (llvm::Attribute attr = func->getFnAttribute("reciprocal-estimates"); +

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
@@ -0,0 +1,27 @@ +! Test that -mrecip[=] works as expected. + tarunprabhu wrote: Since you have added both `FlangOption` and `FC1Option` in `Options.td`, could we test that the option is recognized by the main driver as well, not just `-fc1`? https://github.co

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
@@ -0,0 +1,9 @@ +; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s + +; CHECK-LABEL: llvm.func @reciprocal_estimates() +; CHECK-SAME: reciprocal_estimates = "all" +define void @reciprocal_estimates() #0 { + ret void +} + +attributes #0 = { "reciprocal-estimat

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Cameron McInally via cfe-commits
@@ -1549,6 +1549,9 @@ LogicalResult ModuleTranslation::convertOneFunction(LLVMFuncOp func) { if (auto tuneCpu = func.getTuneCpu()) llvmFunc->addFnAttr("tune-cpu", *tuneCpu); + if (auto reciprocalEstimates = func.getReciprocalEstimates()) mcinally wrote

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Cameron McInally via cfe-commits
@@ -0,0 +1,9 @@ +; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s + +; CHECK-LABEL: llvm.func @reciprocal_estimates() +; CHECK-SAME: reciprocal_estimates = "all" +define void @reciprocal_estimates() #0 { + ret void +} + +attributes #0 = { "reciprocal-estimat

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
@@ -1549,6 +1549,9 @@ LogicalResult ModuleTranslation::convertOneFunction(LLVMFuncOp func) { if (auto tuneCpu = func.getTuneCpu()) llvmFunc->addFnAttr("tune-cpu", *tuneCpu); + if (auto reciprocalEstimates = func.getReciprocalEstimates()) tarunprabhu wr

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
@@ -2636,6 +2636,11 @@ void ModuleImport::processFunctionAttributes(llvm::Function *func, funcOp.setTargetFeaturesAttr( LLVM::TargetFeaturesAttr::get(context, attr.getValueAsString())); + if (llvm::Attribute attr = func->getFnAttribute("reciprocal-estimates"); +

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
https://github.com/tarunprabhu edited https://github.com/llvm/llvm-project/pull/143418 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
@@ -56,6 +56,9 @@ class CodeGenOptions : public CodeGenOptionsBase { // The prefered vector width, if requested by -mprefer-vector-width. std::string PreferVectorWidth; + // List of reciprocal estimate sub-options. tarunprabhu wrote: Should this be a doc

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
@@ -3189,3 +3189,144 @@ StringRef tools::ParseMPreferVectorWidthOption(clang::DiagnosticsEngine &Diags, return Value; } + +// This is a helper function for validating the optional refinement step +// parameter in reciprocal argument strings. Return false if there is an erro

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Tarun Prabhu via cfe-commits
https://github.com/tarunprabhu commented: Thanks for this. Just some minor comments. https://github.com/llvm/llvm-project/pull/143418 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Slava Zakharin via cfe-commits
https://github.com/vzakhari approved this pull request. Looks great! Thank you, Cameron! https://github.com/llvm/llvm-project/pull/143418 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-flang-driver Author: Cameron McInally (mcinally) Changes This patch adds support for the -mrecip command line option. The parsing of this options is equivalent to Clang's and it is implemented by setting the "reciprocal-estimates" function attribute.

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-mlir Author: Cameron McInally (mcinally) Changes This patch adds support for the -mrecip command line option. The parsing of this options is equivalent to Clang's and it is implemented by setting the "reciprocal-estimates" function attribute. Also mov

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Cameron McInally (mcinally) Changes This patch adds support for the -mrecip command line option. The parsing of this options is equivalent to Clang's and it is implemented by setting the "reciprocal-estimates" function attribute. Also mo

[clang] [flang] [mlir] [flang] Add support for -mrecip[=] (PR #143418)

2025-06-09 Thread Cameron McInally via cfe-commits
https://github.com/mcinally created https://github.com/llvm/llvm-project/pull/143418 This patch adds support for the -mrecip command line option. The parsing of this options is equivalent to Clang's and it is implemented by setting the "reciprocal-estimates" function attribute. Also move the