[llvm] [PowerPC] Replace vspltisw+vadduwm instructions with xxleqv+vsubuwm for adding the vector {1, 1, 1, 1} (PR #160882)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 16 22:29:57 PDT 2025
================
@@ -16,17 +16,16 @@ define <2 x i64> @test_add(<2 x i64> %x, <2 x i64> %y) nounwind {
define <2 x i64> @increment_by_one(<2 x i64> %x) nounwind {
; VSX-LABEL: increment_by_one:
; VSX: # %bb.0:
-; VSX-NEXT: vspltisw 3, 1
-; VSX-NEXT: vupklsw 3, 3
-; VSX-NEXT: vaddudm 2, 2, 3
+; VSX-NEXT: xxleqv 35, 35, 35
+; VSX-NEXT: vsubudm 2, 2, 3
; VSX-NEXT: blr
;
; NOVSX-LABEL: increment_by_one:
; NOVSX: # %bb.0:
; NOVSX-NEXT: addis 3, 2, .LCPI1_0 at toc@ha
; NOVSX-NEXT: addi 3, 3, .LCPI1_0 at toc@l
; NOVSX-NEXT: lvx 3, 0, 3
-; NOVSX-NEXT: vaddudm 2, 2, 3
+; NOVSX-NEXT: vsubudm 2, 2, 3
----------------
Himadhith wrote:
This was because the code did not check for VSX attribute. The `hasVSX()` check fixed this.
https://github.com/llvm/llvm-project/pull/160882
More information about the llvm-commits
mailing list