[llvm] 5a5037c - [RISCV] Fix some 80 column violations in ComputeNumSignBitsForTargetNode. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 1 21:45:54 PST 2022
Author: Craig Topper
Date: 2022-02-01T21:43:11-08:00
New Revision: 5a5037c602dcd90d983553e4f7d5429a06a8e6f9
URL: https://github.com/llvm/llvm-project/commit/5a5037c602dcd90d983553e4f7d5429a06a8e6f9
DIFF: https://github.com/llvm/llvm-project/commit/5a5037c602dcd90d983553e4f7d5429a06a8e6f9.diff
LOG: [RISCV] Fix some 80 column violations in ComputeNumSignBitsForTargetNode. NFC
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 72bae0679d501..97d24c8e9c0bb 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -8317,9 +8317,11 @@ unsigned RISCVTargetLowering::ComputeNumSignBitsForTargetNode(
default:
break;
case RISCVISD::SELECT_CC: {
- unsigned Tmp = DAG.ComputeNumSignBits(Op.getOperand(3), DemandedElts, Depth + 1);
+ unsigned Tmp =
+ DAG.ComputeNumSignBits(Op.getOperand(3), DemandedElts, Depth + 1);
if (Tmp == 1) return 1; // Early out.
- unsigned Tmp2 = DAG.ComputeNumSignBits(Op.getOperand(4), DemandedElts, Depth + 1);
+ unsigned Tmp2 =
+ DAG.ComputeNumSignBits(Op.getOperand(4), DemandedElts, Depth + 1);
return std::min(Tmp, Tmp2);
}
case RISCVISD::SLLW:
@@ -8362,15 +8364,18 @@ unsigned RISCVTargetLowering::ComputeNumSignBitsForTargetNode(
}
break;
}
- case RISCVISD::VMV_X_S:
+ case RISCVISD::VMV_X_S: {
// The number of sign bits of the scalar result is computed by obtaining the
// element type of the input vector operand, subtracting its width from the
// XLEN, and then adding one (sign bit within the element type). If the
// element type is wider than XLen, the least-significant XLEN bits are
// taken.
- if (Op.getOperand(0).getScalarValueSizeInBits() > Subtarget.getXLen())
- return 1;
- return Subtarget.getXLen() - Op.getOperand(0).getScalarValueSizeInBits() + 1;
+ unsigned XLen = Subtarget.getXLen();
+ unsigned EltBits = Op.getOperand(0).getScalarValueSizeInBits();
+ if (EltBits <= XLen)
+ return XLen - EltBits + 1;
+ break;
+ }
}
return 1;
More information about the llvm-commits
mailing list