[all-commits] [llvm/llvm-project] a4652a: [AMDGPU] Fold fpround of fadd and fsub into v_mad/...
Dmitry Sidorov via All-commits
all-commits at lists.llvm.org
Tue Sep 29 10:06:07 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a4652a67a9d3ceba71bfa38d707a3b9de62c354c
https://github.com/llvm/llvm-project/commit/a4652a67a9d3ceba71bfa38d707a3b9de62c354c
Author: Dmitry Sidorov <Dmitry.Sidorov at amd.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M llvm/lib/Target/AMDGPU/VOP3PInstructions.td
M llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f16.ll
M llvm/test/CodeGen/AMDGPU/bf16.ll
M llvm/test/CodeGen/AMDGPU/fdiv.f16.ll
M llvm/test/CodeGen/AMDGPU/fold-int-pow2-with-fmul-or-fdiv.ll
M llvm/test/CodeGen/AMDGPU/frem.ll
M llvm/test/CodeGen/AMDGPU/mad-mix-hi-bf16.ll
M llvm/test/CodeGen/AMDGPU/mad-mix-hi.ll
M llvm/test/CodeGen/AMDGPU/mad-mix-lo-bf16.ll
M llvm/test/CodeGen/AMDGPU/mad-mix-lo.ll
Log Message:
-----------
[AMDGPU] Fold fpround of fadd and fsub into v_mad/fma_mixlo and mixhi (#224913)
MadFmaMixFP32Pats turns (fadd x, y) into (fma x, 1.0, y) and (fsub x, y)
into (fma (-y), 1.0, x) so the mix instructions absorb the operation
along with the f16 or bf16 source modifiers. MadFmaMixFP16Pats and
MadFmaMixFP16Pats_t16 only did this for fmul, so a rounded result still
needed a separate convert for a rounding the mix instructions perform
themselves.
Unlike the f32 patterns these do not require an operand to be an
fpextend of an f16, since an fpround on the result always removes the
convert. The rewrite is exact because the mix instructions round the f32
result again when they write the 16-bit destination, so it stays
f32_to_f16(fma(x, 1.0, y)).
Assisted-by: Claude Code Opus 5
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