[all-commits] [llvm/llvm-project] 854413: [compiler-rt][hexagon] Fix `__hexagon_fmadf5` over...

Zain via All-commits all-commits at lists.llvm.org
Fri Jul 10 07:21:08 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8544134f118dcbd1543e29c1ae6b5ac019d4a138
      https://github.com/llvm/llvm-project/commit/8544134f118dcbd1543e29c1ae6b5ac019d4a138
  Author: Zain <beingzainsv at gmail.com>
  Date:   2026-07-10 (Fri, 10 Jul 2026)

  Changed paths:
    M compiler-rt/lib/builtins/hexagon/dffma.S
    A compiler-rt/test/builtins/Unit/hexagon_fmadf5_test.c

  Log Message:
  -----------
  [compiler-rt][hexagon] Fix `__hexagon_fmadf5` overflow under directed rounding (#207373)

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.

Fix: Fuse the selection into a single packet so the round-mode predicate
selects inf-vs-DBL_MAX, and recompute p0 = dfcmp.eq afterwards only to
raise the exception flags which matching the correct sequence already
used
by dfdiv.S.

Also, I've added a regression test (`hexagon_fmadf5_test.c`) covering
FMA special
cases: NaN propagation, invalid operations (0*inf, inf+(-inf)), infinity
propagation, exact results, signed-zero of exact sums, the single-
rounding property, overflow under all rounding modes, and subnormal
results.

Please let me know if this test for the builtin is in the right place,
or if it should be in some place else.

Assisted by: GPT 5.5

Signed-off-by: Zain Siddavatam <zsiddava at qti.qualcomm.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