[llvm-branch-commits] [llvm] [LoongArch] Select V{ADD, SUB}I for operations with negative splat immediates (PR #191966)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Apr 15 23:13:21 PDT 2026
================
@@ -425,6 +425,28 @@ bool LoongArchDAGToDAGISel::selectVSplatImm(SDValue N, SDValue &SplatVal) {
return false;
}
+template <unsigned ImmBitSize>
+bool LoongArchDAGToDAGISel::selectVSplatImmNeg(SDValue N,
+ SDValue &SplatVal) const {
+ APInt ImmValue;
+ EVT EltTy = N->getValueType(0).getVectorElementType();
+
+ if (N->getOpcode() == ISD::BITCAST)
+ N = N->getOperand(0);
+
+ if (selectVSplat(N.getNode(), ImmValue, EltTy.getSizeInBits()) &&
+ ImmValue.getBitWidth() == EltTy.getSizeInBits()) {
+ int64_t NegImm = -ImmValue.getSExtValue();
+ if (isUInt<ImmBitSize>(NegImm)) {
+ SplatVal = CurDAG->getSignedTargetConstant(NegImm, SDLoc(N),
----------------
heiher wrote:
All done, Thanks!
https://github.com/llvm/llvm-project/pull/191966
More information about the llvm-branch-commits
mailing list