[x86] increment/decrement constant vector with min/max in vsetcc lowering (PR39859)
authorSanjay Patel <spatel@rotateright.com>
Sun, 16 Dec 2018 15:05:48 +0000 (15:05 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sun, 16 Dec 2018 15:05:48 +0000 (15:05 +0000)
commit13ac2f15b0416bf85f53753657dafda6da4c353f
treeac51cff70412f13b0f68350405a23c8e2a3e4207
parentf24900b9348343f6c415bc164b0745e912e671a5
[x86] increment/decrement constant vector with min/max in vsetcc lowering (PR39859)

This is part of fixing PR39859:
https://bugs.llvm.org/show_bug.cgi?id=39859

We have a crippled vector ISA, so we have to invert a typical fold and create min/max here.

As discussed in the bug report, we can probably do better by using saturating subtract when
it's available, but we should have this improvement for the min/max patterns regardless.

Alive proofs:
https://rise4fun.com/Alive/zsf
https://rise4fun.com/Alive/Qrl

Differential Revision: https://reviews.llvm.org/D55515

llvm-svn: 349304
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/sat-add.ll
llvm/test/CodeGen/X86/vec_minmax_match.ll
llvm/test/CodeGen/X86/vec_setcc-2.ll