Improve ISel using across lane min/max reduction
authorJun Bum Lim <junbuml@codeaurora.org>
Mon, 14 Sep 2015 16:19:52 +0000 (16:19 +0000)
committerJun Bum Lim <junbuml@codeaurora.org>
Mon, 14 Sep 2015 16:19:52 +0000 (16:19 +0000)
commit5ffe2bacea665e69eebcd3389ebbc5d4521d680d
tree0156a7423d0629cb63428dbeb8a0d838d08ea2c2
parent294cc5229a8d942e1ccd10788db270f5b0b6e8e1
Improve ISel using across lane min/max reduction

In vectorized integer min/max reduction code, the final "reduce" step
is sub-optimal. In AArch64, this change wll combine :
  %svn0 = vector_shuffle %0, undef<2,3,u,u>
  %smax0 = smax %0, svn0
  %svn3 = vector_shuffle %smax0, undef<1,u,u,u>
  %sc = setcc %smax0, %svn3, gt
  %n0 = extract_vector_elt %sc, #0
  %n1 = extract_vector_elt %smax0, #0
  %n2 = extract_vector_elt $smax0, #1
  %result = select %n0, %n1, n2
becomes :
  %1 = smaxv %0
  %result = extract_vector_elt %1, 0

This change extends r246790.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247575 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64ISelLowering.cpp
test/CodeGen/AArch64/aarch64-addv.ll
test/CodeGen/AArch64/aarch64-minmaxv.ll [new file with mode: 0644]