[llvm] [LLVM][SVE][CodeGen] Fix incorrect isel for signed saturating instructions. (PR #88136)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 06:50:00 PDT 2024
================
@@ -4014,6 +4020,50 @@ bool AArch64DAGToDAGISel::SelectSVEAddSubImm(SDValue N, MVT VT, SDValue &Imm,
return false;
}
+bool AArch64DAGToDAGISel::SelectSVEAddSubSSatImm(SDValue N, MVT VT,
+ SDValue &Imm, SDValue &Shift) {
+ if (!isa<ConstantSDNode>(N))
+ return false;
+
+ SDLoc DL(N);
+ int64_t Val = cast<ConstantSDNode>(N)
+ ->getAPIntValue()
+ .trunc(VT.getFixedSizeInBits())
+ .getSExtValue();
+
+ // Signed saturating instructions treat their immediate operand as unsigned.
----------------
david-arm wrote:
Is it worth expanding this comment a little to say something like
// Signed saturating instructions treat their immediate operand as unsigned,
// whereas the intrinsics are defined to work on signed operands.
https://github.com/llvm/llvm-project/pull/88136
More information about the llvm-commits
mailing list