[llvm] [AMDGPU] Handle negated f16 and fp conversion DAG combines (PR #213202)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 31 01:14:11 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
index e26836f19..09b99f264 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -790,9 +790,9 @@ bool AMDGPUTargetLowering::allUsesHaveSourceMods(const SDNode *N,
// XXX - Should this limit number of uses to check?
for (const SDNode *U : N->users()) {
- if(U->getOpcode() == ISD::BITCAST && N->getOpcode() == ISD::FP_TO_FP16) {
- for(const SDNode *BU : U->users()) {
- if(!hasSourceMods(BU)) {
+ if (U->getOpcode() == ISD::BITCAST && N->getOpcode() == ISD::FP_TO_FP16) {
+ for (const SDNode *BU : U->users()) {
+ if (!hasSourceMods(BU)) {
return false;
}
@@ -981,7 +981,7 @@ SDValue AMDGPUTargetLowering::getNegatedExpression(
EVT SrcVT = Src.getValueType();
SDLoc SL(Op);
- if(Src->getOpcode() == ISD::FNEG) {
+ if (Src->getOpcode() == ISD::FNEG) {
Cost = NegatibleCost::Cheaper;
// Negative of Negative is the Source Operand itself
// -(FP_TO_FP16(FNEG(X)) = FP_TO_FP16(X)
``````````
</details>
https://github.com/llvm/llvm-project/pull/213202
More information about the llvm-commits
mailing list