[PATCH] D75895: [PowerPC] Select the select_cc for f64/f32 as set_cc + vselect if VSX enabled

qshanz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 01:36:40 PDT 2020


steven.zhang created this revision.
steven.zhang added reviewers: nemanjai, jsji, PowerPC.
Herald added subscribers: shchenz, wuzish, kbarton, hiraditya.
Herald added a project: LLVM.

This is the motivated case:

  define double @test(double %a, double %b, double %c, double %d) {
  entry:
    %cmp = fcmp fast oeq double %a, %b
    %cond = select fast i1 %cmp, double %c, double %d
    ret double %cond
  }

We are now using cmp + branch for this case. It could be improved with cmp + xxsel which is explicit suggested by Power ISA programming node.

  Programming Note
  xscmpeqdp can be used to implement the 
  C/C++/Java conditional operation, RESULT = (x==y) ? a : b.
  xscmpeqdp fEQ,fX,fY
  xxsel           fRESULT,fA,fB,fEQ


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75895

Files:
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCInstrVSX.td
  llvm/test/CodeGen/PowerPC/fmf-propagation.ll
  llvm/test/CodeGen/PowerPC/fsel.ll
  llvm/test/CodeGen/PowerPC/scalar-equal.ll
  llvm/test/CodeGen/PowerPC/scalar_cmp.ll
  llvm/test/CodeGen/PowerPC/vec_select.ll
  llvm/test/CodeGen/PowerPC/vselect-constants.ll
  llvm/test/CodeGen/PowerPC/vsx.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75895.249286.patch
Type: text/x-patch
Size: 50307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200310/de29f224/attachment.bin>


More information about the llvm-commits mailing list