[llvm] [RISCV] Improve vmsge and vmsgeu selection (PR #115435)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 09:17:37 PST 2024
================
@@ -1616,28 +1616,37 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
SDValue Src1 = Node->getOperand(1);
SDValue Src2 = Node->getOperand(2);
bool IsUnsigned = IntNo == Intrinsic::riscv_vmsgeu;
- bool IsCmpUnsignedZero = false;
+ bool IsCmpConstant = false;
+ bool IsCmpMinimum = false;
// Only custom select scalar second operand.
if (Src2.getValueType() != XLenVT)
break;
// Small constants are handled with patterns.
+ int64_t CVal = 0;
+ MVT Src1VT = Src1.getSimpleValueType();
if (auto *C = dyn_cast<ConstantSDNode>(Src2)) {
- int64_t CVal = C->getSExtValue();
+ IsCmpConstant = true;
+ CVal = C->getSExtValue();
if (CVal >= -15 && CVal <= 16) {
if (!IsUnsigned || CVal != 0)
break;
- IsCmpUnsignedZero = true;
+ IsCmpMinimum = true;
+ } else if (!IsUnsigned &&
+ CVal == APSInt::getMinValue(Src1VT.getScalarSizeInBits(),
----------------
topperc wrote:
You can use INT64_MIN here
https://github.com/llvm/llvm-project/pull/115435
More information about the llvm-commits
mailing list