[llvm] [ARM] CMN is commutative (PR #157890)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 10 09:08:44 PDT 2025
https://github.com/AZero13 created https://github.com/llvm/llvm-project/pull/157890
ARMISD::CMN is not used at the moment, hence why no tests, but I plan on making it soon.
However, it is Commutative, because it is just an adds but throwing away the result.
>From 2310cf11b99413d74cafacbc5a04b0125a19c10a Mon Sep 17 00:00:00 2001
From: AZero13 <gfunni234 at gmail.com>
Date: Wed, 10 Sep 2025 12:08:04 -0400
Subject: [PATCH] [ARM] CMN is commutative
ARMISD::CMN is not used at the moment, but I plan on making it soon.
However, it is Commutative, because it is just an adds but throwing away the result.
---
llvm/lib/Target/ARM/ARMInstrInfo.td | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Target/ARM/ARMInstrInfo.td b/llvm/lib/Target/ARM/ARMInstrInfo.td
index bdb16d7d39266..205a889b48011 100644
--- a/llvm/lib/Target/ARM/ARMInstrInfo.td
+++ b/llvm/lib/Target/ARM/ARMInstrInfo.td
@@ -206,7 +206,7 @@ def ARMBcci64 : SDNode<"ARMISD::BCC_i64", SDT_ARMBCC_i64,
def ARMcmp : SDNode<"ARMISD::CMP", SDT_ARMCmp>;
-def ARMcmn : SDNode<"ARMISD::CMN", SDT_ARMCmp>;
+def ARMcmn : SDNode<"ARMISD::CMN", SDT_ARMCmp, [SDNPCommutative]>;
def ARMcmpZ : SDNode<"ARMISD::CMPZ", SDT_ARMCmp, [SDNPCommutative]>;
More information about the llvm-commits
mailing list