[all-commits] [llvm/llvm-project] 4200a8: [X86] Compress masked VPBLENDM using VBLENDV (#221...

Oscar Priego via All-commits all-commits at lists.llvm.org
Wed Sep 9 03:34:31 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4200a8e34e488aaf9c1b5b1966aa4c1bbec8b4d5
      https://github.com/llvm/llvm-project/commit/4200a8e34e488aaf9c1b5b1966aa4c1bbec8b4d5
  Author: Oscar Priego <oscar.priegov at gmail.com>
  Date:   2026-09-09 (Wed, 09 Sep 2026)

  Changed paths:
    M llvm/lib/Target/X86/X86CompressEVEX.cpp
    M llvm/test/CodeGen/X86/avx512-regcall-NoMask.ll
    M llvm/test/CodeGen/X86/compress-evex-vpmov-blendv.mir
    M llvm/test/CodeGen/X86/compress-evex-vpmov-kill.mir

  Log Message:
  -----------
  [X86] Compress masked VPBLENDM using VBLENDV (#221838)

Fixes #221678.

This extends the X86 EVEX compression pass to recognize compatible
`VPMOVD2M/VPMOVQ2M + VPBLENDMD/VPBLENDMQ` patterns and replace them with
the corresponding VEX `VBLENDVPS/VBLENDVPD` instruction when the mask
width and element granularity match.

For example, the reported AVX-512 sequence:

```asm
vpslld    $31, %xmm0, %xmm0
vpmovd2m  %xmm0, %k1
vpblendmd %xmm1, %xmm2, %xmm0 {%k1}
```

is reduced to:

```asm
vpslld    $31, %xmm0, %xmm0
vblendvps %xmm0, %xmm1, %xmm2, %xmm0
```

The fold is restricted to compatible producer/consumer pairs.
Mixed-width or mixed-element-granularity cases such as
`VPMOVD2MZ128 + VPBLENDMQZ256` are intentionally left unchanged.

The MIR coverage includes:

- 128-bit and 256-bit dword/qword positive cases.
- An incompatible-width negative case.
- Kill/liveness preservation for the reused vector mask.

The existing `avx512-regcall-NoMask.ll` codegen checks are also updated
to reflect the optimized `VBLENDVPS` sequence produced by this fold.

Local validation includes:

- `compress-evex-vpmov-blendv.mir`
- `compress-evex-vpmov-kill.mir`
- `avx512-regcall-NoMask.ll`
- `compress-evex-sign-mask.mir`
- `evex-to-vex-compress.mir`
- `bitcast-sign-mask.ll`

AI-assisted tools were used during investigation and development.
The resulting changes were reviewed, modified, validated, and tested by
me.

Signed-off-by: Oscar Priego Verdugo <oscar.priegov at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list