X86 vector element shift-by-immediate instructions take i8 immediates. Make
authorLang Hames <lhames@gmail.com>
Mon, 21 Oct 2013 17:51:24 +0000 (17:51 +0000)
committerLang Hames <lhames@gmail.com>
Mon, 21 Oct 2013 17:51:24 +0000 (17:51 +0000)
commit1d82537762a0f4019bde301d498d190140585f57
tree85024ec02b3891da0b68ca933c8b5a251534c394
parentef2d919f7f767b9d70bc44c4ac918b0a6b540cac
X86 vector element shift-by-immediate instructions take i8 immediates. Make
the instruction defenitions and ISEL reflect this.

Prior to this patch these instructions took an i32i8imm, and the high bits were
dropped during encoding. This led to incorrect behavior for shifts by
immediates higher than 255. This patch fixes that issue by detecting large
immediate shifts and returning constant zero (for logical shifts) or capping
the shift amount at an encodable value (for arithmetic shifts).

Fixes <rdar://problem/14968098>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193096 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86InstrAVX512.td
lib/Target/X86/X86InstrSSE.td
test/CodeGen/X86/avx2-vector-shifts.ll
test/CodeGen/X86/sse2-vector-shifts.ll