[AMDGPU] lowerEXTRACT_VECTOR_ELT - fold from a SCALAR_TO_VECTOR source
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 7 May 2022 19:23:24 +0000 (20:23 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 7 May 2022 19:23:31 +0000 (20:23 +0100)
commit7e3ef7dcd2b8201dce671237857f04a1d527d580
tree889a3b9a22af7ef008c5254b261a14436e907f4f
parentb81bf7bb2ff301ba204e542c282e7d4ed2414dae
[AMDGPU] lowerEXTRACT_VECTOR_ELT - fold from a SCALAR_TO_VECTOR source

As suggested by @foad on D124839

If we're extracting a vector element that originally came from a scalar_to_vector, then avoid the bitcasting of a vector type and perform the shift masking on the (any-extended) scalar source directly, making use of the fact that the upper elements of a scalar_to_vector are all undef.

Differential Revision: https://reviews.llvm.org/D125173
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.ll
llvm/test/CodeGen/AMDGPU/load-lo16.ll