llvm / llvm/llvm-project

[CodeGen] Specified minnum/maxnum signed zero semantics not respected

Open
#174,730 1 comment 0 reactions 0 assignees View on GitHub
llvm:codegen miscompilation
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

LangRef specifies that minnum/maxnum have ordered signed zero unless nsz is specified. However, the backend does not fully respect these semantics right now. Known issues are:

* The X86 expansion does not respect signed zero ordering.
* Libcall legalization does not respect signed zero ordering, as the fmin/fmax libcalls are not guaranteed to have it (and indeed do not have it on many important targets like x86_64-gnu).

Contributor guide

Open the contributing guide

Research direction

Start by reading the LangRef semantics for minnum/maxnum and then inspect the X86 expansion and libcall legalization paths mentioned in the issue. Verify how signed zero is handled when nsz is absent, including on x86_64-gnu, and add regression coverage showing that the specified ordering is preserved.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.