[all-commits] [llvm/llvm-project] 58cc16: [SDAG] Fix fmaximum legalization errors (#142170)

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Jun 2 01:14:54 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 58cc1675ec7b4aa5bc2dab56180cb7af1b23ade5
      https://github.com/llvm/llvm-project/commit/58cc1675ec7b4aa5bc2dab56180cb7af1b23ade5
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2025-06-02 (Mon, 02 Jun 2025)

  Changed paths:
    M llvm/include/llvm/CodeGen/SelectionDAG.h
    M llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/test/CodeGen/AArch64/fmaximum-legalization.ll
    A llvm/test/CodeGen/ARM/fp-maximum-legalization.ll
    M llvm/test/CodeGen/NVPTX/bf16-instructions.ll
    M llvm/test/CodeGen/NVPTX/math-intrins.ll
    M llvm/test/CodeGen/PowerPC/fminimum-fmaximum-f128.ll
    M llvm/test/CodeGen/PowerPC/fminimum-fmaximum.ll
    A llvm/test/CodeGen/X86/fminimum-fmaximum-i686.ll
    M llvm/test/CodeGen/X86/fminimum-fmaximum.ll

  Log Message:
  -----------
  [SDAG] Fix fmaximum legalization errors (#142170)

FMAXIMUM is currently legalized via IS_FPCLASS for the signed zero
handling. This is problematic, because it assumes the equivalent integer
type is legal. Many targets have legal fp128, but illegal i128, so this
results in legalization failures.

Fix this by replacing IS_FPCLASS with checking the bitcast to integer
instead. In that case it is sufficient to use any legal integer type, as
we're just interested in the sign bit. This can be obtained via a stack
temporary cast. There is existing FloatSignAsInt functionality used for
legalization of FABS and similar we can use for this purpose.

Fixes https://github.com/llvm/llvm-project/issues/139380.
Fixes https://github.com/llvm/llvm-project/issues/139381.
Fixes https://github.com/llvm/llvm-project/issues/140445.



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