[PATCH] D83073: [x86] improve codegen for bit-masked vector compare and select (PR46531)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 12:25:30 PDT 2020
spatel created this revision.
spatel added reviewers: RKSimon, craig.topper, lebedev.ri.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.
We canonicalize patterns like:
%s = lshr i32 %a0, 1
%t = trunc i32 %s to i1
to:
%a = and i32 %a0, 2
%c = icmp ne i32 %a, 0
...in IR, but the bit-shifting original sequence may be better for x86 vector codegen.
I tried several variants of the transform, and it's tricky to not induce regressions. In particular, I did not find a way to cleanly handle non-splat constants, so I've left that as a TODO item here (negative tests for those are included here). AVX512 resulted in some diffs, but didn't look meaningful, so I left that out too. Some of the 256-bit AVX1 diffs are questionable, but close enough that it's probably not meaningful.
https://reviews.llvm.org/D83073
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/vselect-pcmp.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83073.275190.patch
Type: text/x-patch
Size: 17305 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200702/53517df0/attachment.bin>
More information about the llvm-commits
mailing list