[PowerPC] Remove extra swap for extract+vperm on LE

This is a simple fix on LE. On BE, vector shuffles are categorized into
different ops. We may need more work to eliminate these in
tablegen/pre-isel.

Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D101605
This commit is contained in:
Qiu Chaofan 2021-05-07 11:04:47 +08:00
parent 605c811d2b
commit f7294ac809
2 changed files with 6 additions and 4 deletions

View File

@ -2938,6 +2938,9 @@ defm : ScalToVecWPermute<v2f64, (f64 f64:$A),
(SUBREG_TO_REG (i64 1), $A, sub_64), 0),
(SUBREG_TO_REG (i64 1), $A, sub_64)>;
def : Pat<(f64 (extractelt (v2f64 (bitconvert (v16i8
(PPCvperm v16i8:$A, v16i8:$B, v16i8:$C)))), 0)),
(f64 (EXTRACT_SUBREG (VPERM $B, $A, $C), sub_64))>;
def : Pat<(f64 (extractelt v2f64:$S, 0)),
(f64 (EXTRACT_SUBREG (XXPERMDI $S, $S, 2), sub_64))>;
def : Pat<(f64 (extractelt v2f64:$S, 1)),

View File

@ -182,10 +182,9 @@ define double @test10(<4 x i32> %a, <4 x i32> %b) {
; CHECK-LE-NEXT: addi 3, 3, .LCPI9_0@toc@l
; CHECK-LE-NEXT: lxvx 36, 0, 3
; CHECK-LE-NEXT: addis 3, 2, .LCPI9_1@toc@ha
; CHECK-LE-NEXT: lfs 1, .LCPI9_1@toc@l(3)
; CHECK-LE-NEXT: vperm 2, 2, 3, 4
; CHECK-LE-NEXT: xxswapd 0, 34
; CHECK-LE-NEXT: xsadddp 1, 0, 1
; CHECK-LE-NEXT: lfs 0, .LCPI9_1@toc@l(3)
; CHECK-LE-NEXT: vperm 2, 3, 2, 4
; CHECK-LE-NEXT: xsadddp 1, 34, 0
; CHECK-LE-NEXT: blr
;
; CHECK-BE-LABEL: test10: