diff --git a/llvm/lib/Target/PowerPC/PPCInstrVSX.td b/llvm/lib/Target/PowerPC/PPCInstrVSX.td --- a/llvm/lib/Target/PowerPC/PPCInstrVSX.td +++ b/llvm/lib/Target/PowerPC/PPCInstrVSX.td @@ -2938,6 +2938,9 @@ (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)), @@ -2951,6 +2954,7 @@ def : Pat<(PPCst_vec_be v2i64:$rS, xoaddr:$dst), (STXVD2X $rS, xoaddr:$dst)>; def : Pat<(v4i32 (PPCld_vec_be xoaddr:$src)), (LXVW4X xoaddr:$src)>; def : Pat<(PPCst_vec_be v4i32:$rS, xoaddr:$dst), (STXVW4X $rS, xoaddr:$dst)>; + def : Pat<(f64 (PPCfcfid (PPCmtvsra (i64 (vector_extract v2i64:$S, 0))))), (f64 (XSCVSXDDP (COPY_TO_REGCLASS (XXPERMDI $S, $S, 2), VSFRC)))>; def : Pat<(f64 (PPCfcfid (PPCmtvsra (i64 (vector_extract v2i64:$S, 1))))), diff --git a/llvm/test/CodeGen/PowerPC/vec_extract_p9.ll b/llvm/test/CodeGen/PowerPC/vec_extract_p9.ll --- a/llvm/test/CodeGen/PowerPC/vec_extract_p9.ll +++ b/llvm/test/CodeGen/PowerPC/vec_extract_p9.ll @@ -182,10 +182,9 @@ ; 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: