[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 627bcb3bde64a780ed2b99267d97c9679f9c Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 26 Nov 2025 17:45:00 +0530 Subject: [PATCH 1/2] Add CIR sqrt builtin support

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 edited https://github.com/llvm/llvm-project/pull/169310 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 edited https://github.com/llvm/llvm-project/pull/169310 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 edited https://github.com/llvm/llvm-project/pull/169310 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
Priyanshu3820 wrote: just saw PR #165682 has been merged, which removes these x86 sqrt builtins from clang. I'm waiting for guidance on whether CIR should still implement these or follow upstream's direction with __builtin_elementwise_sqrt. https://github.com/llvm/llvm-project/pull/169310

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 627bcb3bde64a780ed2b99267d97c9679f9c Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 26 Nov 2025 17:45:00 +0530 Subject: [PATCH] Add CIR sqrt builtin support for

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
Priyanshu3820 wrote: > Yes, exactly. AFAICT you're implementing functionality which will be removed. > More generally, you might want to check whether any builtins generate > platform-specific IR instructions. If no, there is (or should) probably be a > generic version, which the x86 builtins

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
Priyanshu3820 wrote: hi @andykaylor, @philnik777's PR #165682 is removing the x86 sqrt builtins from Clang and replacing them with generic __builtin_elementwise_sqrt versions. I just wanted to clarify whether removing these builtins from clang also mean that we will be going to remove them fro

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
Priyanshu3820 wrote: > I think #165682 is removing all the builtins implemented here. Thanks for letting me know. Just to clarify, my PR is implementing CIR lowering for these builtins, not modifying Clang's builtin definitions themselves. But you raised a good point that if #165682 removes th

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 627bcb3bde64a780ed2b99267d97c9679f9c Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 26 Nov 2025 17:45:00 +0530 Subject: [PATCH] Add CIR sqrt builtin support for

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 627bcb3bde64a780ed2b99267d97c9679f9c Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 26 Nov 2025 17:45:00 +0530 Subject: [PATCH] Add CIR sqrt builtin support for

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -0,0 +1,27 @@ +//===- CIROps.h - CIR dialect operations *- C++ -*-===// Priyanshu3820 wrote: Done https://github.com/llvm/llvm-project/pull/169310 ___ cfe-commits mailing list cfe-commits@li

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 627bcb3bde64a780ed2b99267d97c9679f9c Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 26 Nov 2025 17:45:00 +0530 Subject: [PATCH] Add CIR sqrt builtin support for

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
Priyanshu3820 wrote: @andykaylor Apologies for the noise - I had some git issues that accidentally included unrelated LLVM changes, which triggered auto-assignment of many reviewers. The PR is now cleaned up with only the `sqrt` builtin implementation. Could you help remove the extra reviewers

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 reopened https://github.com/llvm/llvm-project/pull/169310 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 627bcb3bde64a780ed2b99267d97c9679f9c Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 26 Nov 2025 17:45:00 +0530 Subject: [PATCH] Add CIR sqrt builtin support for

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 01/13] LowerToLLVM: clean up cir.s

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 01/12] LowerToLLVM: clean up cir.s

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -18,6 +18,7 @@ #include "mlir/Conversion/LLVMCommon/TypeConverter.h" #include "mlir/Dialect/DLTI/DLTI.h" #include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/LLVMIR/IR/LLVMOps.h" Priyanshu3820 wrote: Yes, you're right. I removed it now. https

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 01/11] LowerToLLVM: clean up cir.s

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -914,6 +914,28 @@ static mlir::LogicalResult checkReturnAndFunction(cir::ReturnOp op, return mlir::success(); } +mlir::LogicalResult cir::SqrtOp::verify() { Priyanshu3820 wrote: added https://github.com/llvm/llvm-project/pull/169310 __

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 01/10] LowerToLLVM: clean up cir.s

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
Priyanshu3820 wrote: Understood! https://github.com/llvm/llvm-project/pull/169310 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
Priyanshu3820 wrote: May I just move the `sqrt` implementation to the top? That way, the builtins that are currently above them will just fall through to the NYI error at the end. https://github.com/llvm/llvm-project/pull/169310 _

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 edited https://github.com/llvm/llvm-project/pull/169310 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -44,6 +46,96 @@ using namespace cir; using namespace llvm; +using namespace mlir; + +static std::string getLLVMIntrinsicNameForType(Type llvmTy) { Priyanshu3820 wrote: I had initially planned to use this helper function but then used `getIntrinsicSuffix()

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -44,6 +46,96 @@ using namespace cir; using namespace llvm; +using namespace mlir; Priyanshu3820 wrote: I had used explicit `mlir::` prefixes throughout but added `using namespace mlir;` just to prevent any discrepancies. I have removed it now. https://gi

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -18,6 +18,7 @@ #include "mlir/Conversion/LLVMCommon/TypeConverter.h" #include "mlir/Dialect/DLTI/DLTI.h" #include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/LLVMIR/IR/LLVMOps.h" Priyanshu3820 wrote: This include is needed for `LLVM::LLVMFuncOp

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -30,6 +31,7 @@ #include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h" #include "mlir/Target/LLVMIR/Export.h" #include "mlir/Transforms/DialectConversion.h" +#include "clang/Basic/LLVM.h" Priyanshu3820 wrote: This is not needed. Thanks for po

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 deleted https://github.com/llvm/llvm-project/pull/169310 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -1,4 +1,4 @@ -//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR -===// +//- LowerToLLVM.cpp - Lowering from CIR to LLVMIR -===// Priyanshu3820 wrote: seems like a phantom diff caused due to line ending differe

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -30,6 +31,7 @@ #include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h" #include "mlir/Target/LLVMIR/Export.h" #include "mlir/Transforms/DialectConversion.h" +#include "clang/Basic/LLVM.h" Priyanshu3820 wrote: You're right. The file only uses

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 1/9] LowerToLLVM: clean up cir.sqr

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -914,6 +914,28 @@ static mlir::LogicalResult checkReturnAndFunction(cir::ReturnOp op, return mlir::success(); } +mlir::LogicalResult cir::SqrtOp::verify() { Priyanshu3820 wrote: Removed! https://github.com/llvm/llvm-project/pull/169310

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -716,7 +716,19 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID, case X86::BI__builtin_ia32_sqrtpd256: case X86::BI__builtin_ia32_sqrtpd: case X86::BI__builtin_ia32_sqrtps256: - case X86::BI__builtin_ia32_sqrtps: + case X86::BI__builtin_ia32_sqrt

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
@@ -0,0 +1,27 @@ +//===- CIROps.h - CIR dialect operations *- C++ -*-===// Priyanshu3820 wrote: Actually I had added `CIROps.h` because I was getting a compilation error so I thought a wrapper header would come in handy to access the Tab

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 1/8] LowerToLLVM: clean up cir.sqr

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 1/7] LowerToLLVM: clean up cir.sqr

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 1/6] LowerToLLVM: clean up cir.sqr

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 1/6] LowerToLLVM: clean up cir.sqr

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 edited https://github.com/llvm/llvm-project/pull/169310 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 1/6] LowerToLLVM: clean up cir.sqr

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 1/6] LowerToLLVM: clean up cir.sqr

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/169310 >From 31d3e0baa4079d83c9913a6790739d4e0e05859f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Wed, 19 Nov 2025 11:10:41 +0530 Subject: [PATCH 1/6] LowerToLLVM: clean up cir.sqr

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 edited https://github.com/llvm/llvm-project/pull/169310 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR][X86] Implement lowering for sqrt builtins (PR #169310)

2025-11-28 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 created https://github.com/llvm/llvm-project/pull/169310 ## Summary Implements CIR IR generation for X86 sqrt builtin functions, addressing issue #167765. ## Details This PR adds support for lowering the following X86 `sqrt` builtins to CIR operations: - `__bu

[clang] [CIR][X86] Add NYI diagnostic for __builtin_ia32_sqrtps (PR #168320)

2025-11-19 Thread Priyanshu Kumar via cfe-commits
Priyanshu3820 wrote: Hi @andykaylor @lanza @bcardosolopes @xlauko, This is my first LLVM/CIR contribution. Could you please enable CI and review the patch when convenient? Thank you! https://github.com/llvm/llvm-project/pull/168320 ___ cfe-commits ma

[clang] [CIR][X86] Add NYI diagnostic for __builtin_ia32_sqrtps (PR #168320)

2025-11-19 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 created https://github.com/llvm/llvm-project/pull/168320 [CIR][X86] Add NYI diagnostic for `__builtin_ia32_sqrtps` CIR currently doesn't handle lowering of the x86 builtin `__builtin_ia32_sqrtps`. This patch adds a "not yet implemented" error instead of letting

[clang] [CIR][X86] Add NYI diagnostic for __builtin_ia32_sqrtps (PR #168320)

2025-11-19 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/168320 >From 31f4bce66a33e8f73f843dae33aa756e6ba0f99f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Mon, 17 Nov 2025 10:11:52 +0530 Subject: [PATCH 1/4] CIR: Fix X86 builtin sqrt han

[clang] [CIR][X86] Add NYI diagnostic for __builtin_ia32_sqrtps (PR #168320)

2025-11-19 Thread Priyanshu Kumar via cfe-commits
https://github.com/Priyanshu3820 updated https://github.com/llvm/llvm-project/pull/168320 >From 31f4bce66a33e8f73f843dae33aa756e6ba0f99f Mon Sep 17 00:00:00 2001 From: Priyanshu3820 <[email protected]> Date: Mon, 17 Nov 2025 10:11:52 +0530 Subject: [PATCH 1/2] CIR: Fix X86 builtin sqrt han