[InstCombine][X86] Improved folding of calls to Intrinsic::x86_sse4a_insertqi.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 11 Dec 2014 20:44:59 +0000 (20:44 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 11 Dec 2014 20:44:59 +0000 (20:44 +0000)
commit72b05aa59c0268f3404af9c3e61c706d1661fd03
tree77b1cc2b66cb8ddd39bf8c9dfcdd9a8690eda6de
parent06f960d5d35adec2d098d68e733b529c79c20876
[InstCombine][X86] Improved folding of calls to Intrinsic::x86_sse4a_insertqi.

This patch teaches the instruction combiner how to fold a call to 'insertqi' if
the 'length field' (3rd operand) is set to zero, and if the sum between
field 'length' and 'bit index' (4th operand) is bigger than 64.

From the AMD64 Architecture Programmer's Manual:
1. If the sum of the bit index + length field is greater than 64, then the
   results are undefined;
2. A value of zero in the field length is defined as a length of 64.

This patch improves the existing combining logic for intrinsic 'insertqi'
adding extra checks to address both point 1. and point 2.

Differential Revision: http://reviews.llvm.org/D6583

llvm-svn: 224054
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/vec_demanded_elts.ll