Skip to content

Commit cf81591

Browse files
author
himadhith
committed
[PowerPC] Replace vspltisw instruction with xxleqv as generation of vector of -1s is cheaper than vector of 1s
1 parent 1d5bd28 commit cf81591

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/Target/PowerPC/PPCInstrVSX.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3613,6 +3613,10 @@ def : Pat<(v4i32 (build_vector immSExt5NonZero:$A, immSExt5NonZero:$A,
36133613
immSExt5NonZero:$A, immSExt5NonZero:$A)),
36143614
(v4i32 (VSPLTISW imm:$A))>;
36153615

3616+
// Optimize for vector of 1s addition operation
3617+
def : Pat<(add v4i32:$A, (build_vector (i32 1), (i32 1), (i32 1), (i32 1))),
3618+
(VSUBUWM $A, (v4i32 (COPY_TO_REGCLASS (XXLEQVOnes), VSRC)))>;
3619+
36163620
// Splat loads.
36173621
def : Pat<(v8i16 (PPCldsplat ForceXForm:$A)),
36183622
(v8i16 (VSPLTHs 3, (MTVSRWZ (LHZX ForceXForm:$A))))>;

0 commit comments

Comments
 (0)