Skip to content

Commit

Permalink
[PowerPC] use correct selection for v16i8/v8i16 splat load
Browse files Browse the repository at this point in the history
Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D113236
  • Loading branch information
chenzheng1030 committed Nov 5, 2021
1 parent 0321bd6 commit fed2889
Show file tree
Hide file tree
Showing 3 changed files with 464 additions and 7 deletions.
6 changes: 2 additions & 4 deletions llvm/lib/Target/PowerPC/PPCInstrVSX.td
Expand Up @@ -3556,12 +3556,10 @@ def : Pat<(v4i32 (build_vector immSExt5NonZero:$A, immSExt5NonZero:$A,
(v4i32 (VSPLTISW imm:$A))>;

// Splat loads.
// Note that, we use MTVSRD without checking PPC64 because we only care the
// lowest 16/8 bits.
def : Pat<(v8i16 (PPCldsplat ForceXForm:$A)),
(v8i16 (VSPLTHs 3, (MTVSRD (INSERT_SUBREG (i64 (IMPLICIT_DEF)), (LHZX ForceXForm:$A), sub_32))))>;
(v8i16 (VSPLTHs 3, (MTVSRWZ (LHZX ForceXForm:$A))))>;
def : Pat<(v16i8 (PPCldsplat ForceXForm:$A)),
(v16i8 (VSPLTBs 7, (MTVSRD (INSERT_SUBREG (i64 (IMPLICIT_DEF)), (LBZX ForceXForm:$A), sub_32))))>;
(v16i8 (VSPLTBs 7, (MTVSRWZ (LBZX ForceXForm:$A))))>;
} // HasVSX, HasDirectMove

// Big endian VSX subtarget with direct moves.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/PowerPC/canonical-merge-shuffles.ll
Expand Up @@ -825,7 +825,7 @@ define dso_local void @testByteSplat() #0 {
; CHECK-P8-LABEL: testByteSplat:
; CHECK-P8: # %bb.0: # %entry
; CHECK-P8-NEXT: lbzx r3, 0, r3
; CHECK-P8-NEXT: mtvsrd v2, r3
; CHECK-P8-NEXT: mtvsrwz v2, r3
; CHECK-P8-NEXT: vspltb v2, v2, 7
; CHECK-P8-NEXT: stvx v2, 0, r3
; CHECK-P8-NEXT: blr
Expand Down

0 comments on commit fed2889

Please sign in to comment.