[llvm] [ARM] CMN is commutative (PR #157890)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 09:09:17 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-arm

Author: AZero13 (AZero13)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/157890.diff


1 Files Affected:

- (modified) llvm/lib/Target/ARM/ARMInstrInfo.td (+1-1) 


``````````diff
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]>;
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/157890


More information about the llvm-commits mailing list