Skip to content

Conversation

AZero13
Copy link
Contributor

@AZero13 AZero13 commented Aug 30, 2025

Pass the opcode directly.

Pass the opcode directly.
@llvmbot
Copy link
Member

llvmbot commented Aug 30, 2025

@llvm/pr-subscribers-backend-arm

Author: AZero13 (AZero13)

Changes

Pass the opcode directly.


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

1 Files Affected:

  • (modified) llvm/lib/Target/ARM/ARMISelLowering.cpp (+2-10)
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index ea74d6a2071d9..147b710d6df43 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -10539,16 +10539,8 @@ SDValue ARMTargetLowering::LowerCMP(SDValue Op, SelectionDAG &DAG) const {
   }
 
   // Generate the operation with flags
-  SDValue OpWithFlags;
-  if (Opcode == ARMISD::ADDC) {
-    // Use ADDC: LHS + RHS (where RHS was 0 - X, now X)
-    OpWithFlags = DAG.getNode(ARMISD::ADDC, dl,
-                              DAG.getVTList(MVT::i32, FlagsVT), LHS, RHS);
-  } else {
-    // Use ARMISD::SUBC to generate SUBS instruction (subtract with flags)
-    OpWithFlags = DAG.getNode(ARMISD::SUBC, dl,
-                              DAG.getVTList(MVT::i32, FlagsVT), LHS, RHS);
-  }
+  SDValue OpWithFlags = DAG.getNode(Opcode, dl,
+                                    DAG.getVTList(MVT::i32, FlagsVT), LHS, RHS);
 
   SDValue OpResult = OpWithFlags.getValue(0); // The operation result
   SDValue Flags = OpWithFlags.getValue(1);    // The flags

Copy link
Collaborator

@davemgreen davemgreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice and cleaner

@AZero13
Copy link
Contributor Author

AZero13 commented Aug 31, 2025

Thank you @davemgreen Can we please merge?

@davemgreen davemgreen merged commit 2259a80 into llvm:main Aug 31, 2025
9 checks passed
@AZero13 AZero13 deleted the patch-8 branch August 31, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants