Skip to content

Fix __hexagon_fmadf5 overflow under directed rounding - #1281

Merged
tgross35 merged 1 commit into
rust-lang:mainfrom
SuperChamp234:hexagon-fmadf5-overflow-fix
Aug 17, 2026
Merged

Fix __hexagon_fmadf5 overflow under directed rounding#1281
tgross35 merged 1 commit into
rust-lang:mainfrom
SuperChamp234:hexagon-fmadf5-overflow-fix

Conversation

@SuperChamp234

Copy link
Copy Markdown
Contributor

The overflow path in __hexagon_fmadf5 computed the round-mode predicate (inf vs. largest-finite) into p0, but then overwrote p0 with dfcmp.eq(ATMP,ATMP) before consuming it. Since ATMP is +inf, dfcmp.eq(ATMP,ATMP) is always true, so CTMP was unconditionally set to infinity and the rounding-mode decision was discarded.

As a result, a finite-magnitude overflow returned +/-inf in every rounding mode.

The overflow path in __hexagon_fmadf5 computed the round-mode predicate
(inf vs. largest-finite) into p0, but then overwrote p0 with
`dfcmp.eq(ATMP,ATMP)` before consuming it. Since ATMP is +inf,
`dfcmp.eq(ATMP,ATMP)` is always true, so CTMP was unconditionally set to
infinity and the rounding-mode decision was discarded.

As a result, a finite-magnitude overflow returned +/-inf in every
rounding mode.

Signed-off-by: Zain Siddavatam <zsiddava@qti.qualcomm.com>
@tgross35

Copy link
Copy Markdown
Contributor

@androm3da could you review this?

@androm3da

Copy link
Copy Markdown
Contributor

LGTM: corresponds to llvm/llvm-project#207373

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgross35
tgross35 merged commit 8b4c124 into rust-lang:main Aug 17, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants