[llvm] [llvm][RISCV] Support P Extension CodeGen (PR #190303)

Kito Cheng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 21:05:46 PDT 2026


================
@@ -625,6 +625,29 @@ define <2 x i16> @test_non_const_splat_i16(i16 %elt) {
   ret <2 x i16> %splat
 }
 
+; Test add(vec, splat(scalar)) pattern
+define <4 x i8> @test_padd_bs_from_scalar_splat(<4 x i8> %a, i8 %b) {
+; CHECK-LABEL: test_padd_bs_from_scalar_splat:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    padd.bs a0, a0, a1
+; CHECK-NEXT:    ret
+  %insert = insertelement <4 x i8> poison, i8 %b, i32 0
+  %splat = shufflevector <4 x i8> %insert, <4 x i8> poison, <4 x i32> zeroinitializer
+  %res = add <4 x i8> %splat, %a
+  ret <4 x i8> %res
----------------
kito-cheng wrote:

Add one more set of testcase to test `add <4 x i8> %a, %splat`?

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


More information about the llvm-commits mailing list