[all-commits] [llvm/llvm-project] beffe4: [AMDGPU][GISel] Do not scalarize uniform v2f16/v2b...

LU-JOHN via All-commits all-commits at lists.llvm.org
Mon Sep 14 07:22:30 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: beffe43b9edbf24b2066b9e556263eec19d51ba9
      https://github.com/llvm/llvm-project/commit/beffe43b9edbf24b2066b9e556263eec19d51ba9
  Author: LU-JOHN <John.Lu at amd.com>
  Date:   2026-09-14 (Mon, 14 Sep 2026)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeRules.cpp
    M llvm/test/CodeGen/AMDGPU/GlobalISel/add.v2i16.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/fabs.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/fadd.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/fma.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/fmul.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/fneg.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/fsub.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/strict_fma.f16.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/sub.v2i16.ll
    M llvm/test/CodeGen/AMDGPU/llvm.fptrunc.round.ll
    M llvm/test/CodeGen/AMDGPU/strict_fadd.f16.ll
    M llvm/test/CodeGen/AMDGPU/strict_fmul.f16.ll
    M llvm/test/CodeGen/AMDGPU/strict_fsub.f16.ll

  Log Message:
  -----------
  [AMDGPU][GISel] Do not scalarize uniform v2f16/v2bf16 operations (#222359)

Previously, register bank legalization would scalarize uniform v2f16 and
v2bf16
  floating-point operations on targets with hasSALUFloat (GFX12+) using
  the ScalarizeToS16 action. This approach had two problems:

  1. It fails for v2bf16 types because there are no scalar bf16
     instructions - the scalarization produces illegal bf16 operations
     that cannot be selected.

2. Scalar f16 instructions exist, but scalarization is suboptimal.
Packed instructions
     like v_pk_add_f16, v_pk_mul_f16, etc. are more efficient than
     unpacking to two separate s16 operations.

  This patch removes the ScalarizeToS16 rules and instead adds
  unconditional .Uni(V2S16) rules that always use
  packed VGPR operations for uniform cases.

  Operations modified:
  - G_FADD, G_FMUL, G_STRICT_FADD, G_STRICT_FMUL
  - G_FSUB, G_STRICT_FSUB
  - G_FMA, G_STRICT_FMA
  - G_FNEG, G_FABS

---------

Signed-off-by: John Lu <John.Lu at amd.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