aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@sifive.com>2022-02-01 21:30:58 -0800
committerCraig Topper <craig.topper@sifive.com>2022-02-01 21:43:11 -0800
commit5a5037c602dcd90d983553e4f7d5429a06a8e6f9 (patch)
tree36a3431b1b0c5de91019f4c1ee18551abe666995 /llvm/lib
parent7f6441f96e12798ed63290fff436f347f6aca3aa (diff)
downloadllvm-5a5037c602dcd90d983553e4f7d5429a06a8e6f9.zip
llvm-5a5037c602dcd90d983553e4f7d5429a06a8e6f9.tar.gz
llvm-5a5037c602dcd90d983553e4f7d5429a06a8e6f9.tar.bz2
[RISCV] Fix some 80 column violations in ComputeNumSignBitsForTargetNode. NFC
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/RISCV/RISCVISelLowering.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 72bae06..97d24c8 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;