Fix a logic bug in x86 vector codegen: sext (zext (x) ) != sext (x) (PR20472).
authorSanjay Patel <spatel@rotateright.com>
Thu, 28 Aug 2014 18:59:22 +0000 (18:59 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 28 Aug 2014 18:59:22 +0000 (18:59 +0000)
commitcf9661c6f9875d702ea65f0ffe0eb05e0d15726b
tree396e3311ac9d78e37469b938c7cc4a0e22522160
parent538b1cbdf50487c2537f589e62437fe7c685def1
Fix a logic bug in x86 vector codegen: sext (zext (x) ) != sext (x) (PR20472).

Remove a block of code from LowerSIGN_EXTEND_INREG() that was added with:
http://llvm.org/viewvc/llvm-project?view=revision&revision=177421

And caused:
http://llvm.org/bugs/show_bug.cgi?id=20472 (more analysis here)
http://llvm.org/bugs/show_bug.cgi?id=18054

The testcases confirm that we (1) don't remove a zext op that is necessary and (2) generate
a pmovz instead of punpck if SSE4.1 is available. Although pmovz is 1 byte longer, it allows
folding of the load, and so saves 3 bytes overall.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216679 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/vec_trunc_sext.ll [new file with mode: 0644]