[llvm] [PowerPC] Replace vspltisw+vadduwm instructions with xxleqv+vsubuwm for adding the vector {1, 1, 1, 1} (PR #160882)

Tony Varghese via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 5 22:28:13 PDT 2025


================
@@ -3613,6 +3613,10 @@ def : Pat<(v4i32 (build_vector immSExt5NonZero:$A, immSExt5NonZero:$A,
                                immSExt5NonZero:$A, immSExt5NonZero:$A)),
           (v4i32 (VSPLTISW imm:$A))>;
 
+// Optimize for vector of 1s addition operation
+def : Pat<(add v4i32:$A, (build_vector (i32 1), (i32 1), (i32 1), (i32 1))),
----------------
tonykuttai wrote:

Does this work only for `v4i32` vector types? Why not `v2i64, v8i16 and v16i8` types? 

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


More information about the llvm-commits mailing list