[x86] convert logic-of-FP-compares to FP logic-of-vector-compares
authorSanjay Patel <spatel@rotateright.com>
Fri, 24 Sep 2021 15:31:11 +0000 (11:31 -0400)
committerSanjay Patel <spatel@rotateright.com>
Fri, 24 Sep 2021 15:38:19 +0000 (11:38 -0400)
commit09e71c367af36a07cce04a812dcd9c62bebfbcdf
tree39695eab5a33e5244e11e2a0b9b283c344d08b0e
parent638a4147fc6400b928080c6d5656fbcee707a793
[x86] convert logic-of-FP-compares to FP logic-of-vector-compares

This is motivated by the examples and discussion in:
https://llvm.org/PR51245
...and related bugs.

By using vector compares and vector logic, we can convert 2 'set'
instructions into 1 'movd' or 'movmsk' and generally improve
throughput/reduce instructions.

Unfortunately, we don't have a complete vector compare ISA before
AVX, so I left SSE-only out of this patch. Ie, we'd need extra logic
ops to simulate the missing predicates for SSE 'cmpp*', so it's not
as clearly a win.

Differential Revision: https://reviews.llvm.org/D110342
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/fcmp-logic.ll
llvm/test/CodeGen/X86/lzcnt-zext-cmp.ll