llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[X86] CompressEVEX - extend tryCompressVPMOVPattern to handle VBLENDV patterns as well

Open RKSimon opened this issue 5 months ago • 2 comments

tryCompressVPMOVPattern handles:

// Try to compress VPMOV*2M + KMOV chain patterns:
//   vpmov*2m %xmm0, %k0     ->  (erase this)
//   kmov* %k0, %eax         ->  vmovmskp* %xmm0, %eax

but we should be able to do something VERY similar for BLENDV masked moves:

//   vpmov*2m %xmmZ, %k0     ->  (erase this)
//   vpmovaps %xmmX, %xmmY {%k0} ->  vblendvps %xmmZ, %xmmY, %xmmX, %xmmY

Should work for VBLENDVB/PS/PD 128 and 256-bit cases.

There might be some issues with register liveness to address - not sure.

RKSimon avatar Jun 18 '26 10:06 RKSimon

@llvm/issue-subscribers-backend-x86

Author: Simon Pilgrim (RKSimon)

tryCompressVPMOVPattern handles: ``` // Try to compress VPMOV*2M + KMOV chain patterns: // vpmov*2m %xmm0, %k0 -> (erase this) // kmov* %k0, %eax -> vmovmskp* %xmm0, %eax ``` but we should be able to do something VERY similar for BLENDV masked moves: ``` // vpmov*2m %xmmZ, %k0 -> (erase this) // vpmovaps %xmmX, %xmmY {%k0} -> vblendvps %xmmZ, %xmmX, %xmmY, %xmmY ``` Should work for VBLENDVB/PS/PD 128 and 256-bit cases.

There might be some issues with register liveness to address - not sure.

I'll take a look and work on a PR for this.

realqhc avatar Jun 19 '26 01:06 realqhc