[PATCH] D39729: [X86][SSE] Use (V)PHMINPOSUW for vXi16 SMAX/SMIN/UMAX/UMIN horizontal reductions (PR32841)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 7 04:27:42 PST 2017


RKSimon created this revision.

(V)PHMINPOSUW determines the UMIN element in an v8i16 input, with suitable bit flipping it can also be used for SMAX/SMIN/UMAX cases as well.

This patch matches vXi16 SMAX/SMIN/UMAX/UMIN horizontal reductions and reduces the input down to a v8i16 vector before calling (V)PHMINPOSUW.

I can split the commits into X86ISD::PHMINPOS, UMIN reduction and SMAX/SMIN/UMAX reduction stages if it would make things clearer.

A later patch will use this for v16i8 reductions as well (PR32841).

Depending on when https://reviews.llvm.org/D39726 lands I might need to update this to use that as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D39729

Files:
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  lib/Target/X86/X86InstrFragmentsSIMD.td
  lib/Target/X86/X86InstrSSE.td
  lib/Target/X86/X86IntrinsicsInfo.h
  test/CodeGen/X86/horizontal-reduce-smax.ll
  test/CodeGen/X86/horizontal-reduce-smin.ll
  test/CodeGen/X86/horizontal-reduce-umax.ll
  test/CodeGen/X86/horizontal-reduce-umin.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39729.121873.patch
Type: text/x-patch
Size: 78872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171107/c6174649/attachment.bin>


More information about the llvm-commits mailing list