[llvm-dev] Dealing with illegal operand mappings in RegBankSelect

Matt Arsenault via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 26 16:58:40 PST 2019

> On Feb 26, 2019, at 7:46 PM, Quentin Colombet <qcolombet at apple.com> wrote:
>> The only  use I would have for the copy is as as a means of passing which registers were already created for the new mapping, after which point I would need to delete it.
> Could you describe in pseudo code what the expansion of vgpr into sgpr looks like?
> e.g., = use vgpr
> And you only support = use sgpr 

It’s serializing the vector operation. There’s an additional optimization to reduce the number of loop iterations when multiple work items/lanes/threads have the same value in them which happens in practice, but essentially it does:

Save Execution Mask
For (Lane : Wavefront/Warp) {
  Enable Lane, Disable all other lanes
  SGPR = read SGPR value for current lane from VGPR
  VGPRResult[Lane] = use_op SGPR
Restore Execution Mask

Eventually it might be nice to have optimizations to only emit one of these loops when multiple consecutive instructions need the same register handled (which I suspect will happen frequently with image samplers), but I haven’t really thought about what that should look like yet.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190226/589014a5/attachment.html>

More information about the llvm-dev mailing list