[llvm] [RISCV] Truncate constants to eltwidth before checking simm5 when con… (PR #67062)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 13:52:36 PDT 2023


================
@@ -781,3 +781,16 @@ define <8 x i8> @unmergable(<8 x i8> %v, <8 x i8> %w) {
   %res = shufflevector <8 x i8> %v, <8 x i8> %w, <8 x i32> <i32 2, i32 9, i32 4, i32 11, i32 6, i32 13, i32 8, i32 15>
   ret <8 x i8> %res
 }
+
+; Make sure we use a vmv.v.i to load the mask constant.
+define <8 x i32> @shuffle_v8i32_2(<8 x i32> %x, <8 x i32> %y) {
+; CHECK-LABEL: shuffle_v8i32_2:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    vsetivli zero, 1, e8, mf8, ta, ma
+; CHECK-NEXT:    vmv.v.i v0, -13
----------------
topperc wrote:

Without this patch we get `li a0, 243` and `vmv.s.x v0, a0`

https://github.com/llvm/llvm-project/pull/67062


More information about the llvm-commits mailing list