[AMDGPU] Fix for vector element insertion
authorTim Corringham <tcorring@amd.com>
Fri, 1 Feb 2019 16:51:09 +0000 (16:51 +0000)
committerTim Corringham <tcorring@amd.com>
Fri, 1 Feb 2019 16:51:09 +0000 (16:51 +0000)
commitfa3e4e5b53a8b0b62d94759d568a58f1c9d70e1d
tree358af67f0e5d8aaf6276248b6a5afbbe90f5f45e
parent6502b1444dfc24bbbd6812792d610c84f0e3f01e
[AMDGPU] Fix for vector element insertion

Summary:
Incorrect code was generated when lowering insertelement operations
for vectors with 8 or 16 bit elements.  The value being inserted was
not adjusted for the position of the element within the 32 bit word
and so only the low element within each 32 bit word could receive
the intended value.

Fixed by simply replicating the value to each element of a
congruent vector before the mask and or operation used to
update the intended element.

A number of affected LIT tests have been updated appropriately.

before the mask & or into the intended

Reviewers: arsenm, nhaehnle

Reviewed By: arsenm

Subscribers: llvm-commits, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D57588

llvm-svn: 352885
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/test/CodeGen/AMDGPU/fcanonicalize-elimination.ll
llvm/test/CodeGen/AMDGPU/insert_vector_dynelt.ll
llvm/test/CodeGen/AMDGPU/insert_vector_elt.ll
llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.ll
llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.subtest-nosaddr.ll
llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.subtest-saddr.ll