Skip to content

Conversation

@lenary
Copy link
Member

@lenary lenary commented Jun 3, 2025

ISD::SELECT is legal by default, so this change to the conditional makes it clearer that XTHeadCondMov and XMipsCMove both leave this operation legal rather than custom expanding it.

ISD::SELECT is legal by default, so this change to the conditional makes
it clearer that XTHeadCondMov and XMipsCMove both leave this operation
legal rather than custom expanding it.
@lenary lenary requested a review from djtodoro June 3, 2025 17:56
@llvmbot
Copy link
Member

llvmbot commented Jun 3, 2025

@llvm/pr-subscribers-backend-risc-v

Author: Sam Elliott (lenary)

Changes

ISD::SELECT is legal by default, so this change to the conditional makes it clearer that XTHeadCondMov and XMipsCMove both leave this operation legal rather than custom expanding it.


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

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVISelLowering.cpp (+1-3)
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 6e8e4ac1c6a95..6158e51346d77 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -434,9 +434,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
     setOperationAction(ISD::ABS, MVT::i32, Custom);
   }
 
-  if (Subtarget.useCCMovInsn())
-    setOperationAction(ISD::SELECT, XLenVT, Legal);
-  else if (!Subtarget.hasVendorXTHeadCondMov())
+  if (!Subtarget.useCCMovInsn() && !Subtarget.hasVendorXTHeadCondMov())
     setOperationAction(ISD::SELECT, XLenVT, Custom);
 
   if (Subtarget.hasVendorXqcia() && !Subtarget.is64Bit()) {

Copy link
Collaborator

@topperc topperc left a comment

Choose a reason for hiding this comment

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

LGTM

@lenary lenary merged commit 2863c64 into llvm:main Jun 3, 2025
10 of 12 checks passed
@lenary lenary deleted the pr/riscv-simplify-select-legal branch June 3, 2025 19:49
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