This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by RKSimon on Nov 7 2017, 4:27 AM.

Details

Summary

(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 D39726 lands I might need to update this to use that as well.

Diff Detail

Repository
rL LLVM