[llvm] [LLVM][SVE][CodeGen] Fix incorrect isel for signed saturating instructions. (PR #88136)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 23:56:46 PDT 2024
================
@@ -1059,6 +1059,20 @@ define <vscale x 16 x i8> @sqadd_b_lowimm(<vscale x 16 x i8> %a) {
ret <vscale x 16 x i8> %out
}
+; Immediate instruction form only supports positive values.
+define <vscale x 16 x i8> @sqadd_b_negimm(<vscale x 16 x i8> %a) {
+; CHECK-LABEL: sqadd_b_negimm:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov z1.b, #-1 // =0xffffffffffffffff
+; CHECK-NEXT: sqadd z0.b, z0.b, z1.b
+; CHECK-NEXT: ret
+ %elt = insertelement <vscale x 16 x i8> undef, i8 -1, i32 0
----------------
david-arm wrote:
Perhaps I'm missing something, but the encoding of SQADD permits a 8-bit immediate that is treated as unsigned, i.e. all values in the range [0,255]. The documentation says:
`The immediate is an unsigned value in the range 0 to 255`
So I don't see why we can't lower a splat of immediates <i8 0xFF, i8 0xFF, ...> (i.e. a splat of the value 255) to the immediate form of sqadd?
https://github.com/llvm/llvm-project/pull/88136
More information about the llvm-commits
mailing list