[PATCH] D33862: [x86] avoid flipping sign bits for vector icmp by using known bits
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 3 07:03:02 PDT 2017
spatel created this revision.
Herald added a subscriber: mcrosier.
The change itself is hopefully straightforward: if we know that both operands of an unsigned integer vector comparison are non-negative, then it's safe to directly use a signed-compare-greater-than instruction (the only integer vector compare predicate provided by SSE/AVX).
This should solve PR33276:
https://bugs.llvm.org/show_bug.cgi?id=33276
Some questions and potential follow-ups are raised here:
1. Are we better off using pcmpgt + min/max/psubus instructions instead of inverting a pcmp?
2. Since we're computing known bits, should we try harder to eliminate other compares like (known negative < known positive)?
3. I can't tell what the intent of the AVX512 tests was supposed to be; (X u< 0) is always false. Those tests were added with https://reviews.llvm.org/rL276648.
https://reviews.llvm.org/D33862
Files:
include/llvm/CodeGen/ISDOpcodes.h
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/avx512-cvt.ll
test/CodeGen/X86/vector-unsigned-cmp.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33862.101315.patch
Type: text/x-patch
Size: 20884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170603/7d05d92e/attachment-0001.bin>
More information about the llvm-commits
mailing list