Skip to content

libm: Add frexpf16#1092

Merged
tgross35 merged 3 commits intorust-lang:mainfrom
tgross35:frexpf16
Feb 12, 2026
Merged

libm: Add frexpf16#1092
tgross35 merged 3 commits intorust-lang:mainfrom
tgross35:frexpf16

Conversation

@tgross35
Copy link
Copy Markdown
Contributor

No description provided.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Feb 12, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

This will support `frexpf16` and should allow `generic::frexp` to be
inlined into the non-generic `frexp*` functions.

Additionally remove an unneeded `as` cast.
The new algorithm now correctly supports the type.
@tgross35
Copy link
Copy Markdown
Contributor Author

As expected, the algorithm change gets back the perf lost in #862 with some tiny improvements on top of it. Aarch64:

icount::icount_bench_frexp_group::icount_bench_frexp logspace:setup_frexp()
  Baselines:                      softfloat|softfloat (old)
  Instructions:                        7719|8219                 (-6.08347%) [-1.06478x]
  L1 Hits:                             8334|8833                 (-5.64927%) [-1.05988x]
  LL Hits:                                2|2                    (No change)
  RAM Hits:                               5|6                    (-16.6667%) [-1.20000x]
  Total read+write:                    8341|8841                 (-5.65547%) [-1.05994x]
  Estimated Cycles:                    8519|9053                 (-5.89860%) [-1.06268x]
icount::icount_bench_frexpf128_group::icount_bench_frexpf128 logspace:setup_frexpf128()
  Baselines:                      softfloat|softfloat (old)
  Instructions:                       15219|15219                (No change)
  L1 Hits:                            23825|21829                (+9.14380%) [+1.09144x]
  LL Hits:                                5|1                    (+400.000%) [+5.00000x]
  RAM Hits:                               8|8                    (No change)
  Total read+write:                   23838|21838                (+9.15835%) [+1.09158x]
  Estimated Cycles:                   24130|22114                (+9.11640%) [+1.09116x]
icount::icount_bench_frexpf16_group::icount_bench_frexpf16 logspace:setup_frexpf16()
  Baselines:                      softfloat|softfloat (old)
  Instructions:                        7848|N/A                  (*********)
  L1 Hits:                             8415|N/A                  (*********)
  LL Hits:                                1|N/A                  (*********)
  RAM Hits:                               6|N/A                  (*********)
  Total read+write:                    8422|N/A                  (*********)
  Estimated Cycles:                    8630|N/A                  (*********)
icount::icount_bench_frexpf_group::icount_bench_frexpf logspace:setup_frexpf()
  Baselines:                      softfloat|softfloat (old)
  Instructions:                        7739|8251                 (-6.20531%) [-1.06616x]
  L1 Hits:                             8354|8873                 (-5.84921%) [-1.06213x]
  LL Hits:                                2|1                    (+100.000%) [+2.00000x]
  RAM Hits:                               5|7                    (-28.5714%) [-1.40000x]
  Total read+write:                    8361|8881                 (-5.85520%) [-1.06219x]
  Estimated Cycles:                    8539|9123                 (-6.40140%) [-1.06839x]

x86:

icount::icount_bench_frexp_group::icount_bench_frexp logspace:setup_frexp()
  Baselines:                      softfloat|softfloat (old)
  Instructions:                       11189|11689                (-4.27753%) [-1.04469x]
  L1 Hits:                            12776|13273                (-3.74444%) [-1.03890x]
  LL Hits:                                1|3                    (-66.6667%) [-3.00000x]
  RAM Hits:                               6|7                    (-14.2857%) [-1.16667x]
  Total read+write:                   12783|13283                (-3.76421%) [-1.03911x]
  Estimated Cycles:                   12991|13533                (-4.00502%) [-1.04172x]
icount::icount_bench_frexpf128_group::icount_bench_frexpf128 logspace:setup_frexpf128()
  Baselines:                      softfloat|softfloat (old)
  Instructions:                       17194|17694                (-2.82582%) [-1.02908x]
  L1 Hits:                            24780|25279                (-1.97397%) [-1.02014x]
  LL Hits:                                0|2                    (-100.000%) [---inf---]
  RAM Hits:                               7|6                    (+16.6667%) [+1.16667x]
  Total read+write:                   24787|25287                (-1.97730%) [-1.02017x]
  Estimated Cycles:                   25025|25499                (-1.85890%) [-1.01894x]
icount::icount_bench_frexpf16_group::icount_bench_frexpf16 logspace:setup_frexpf16()
  Baselines:                      softfloat|softfloat (old)
  Instructions:                       12996|N/A                  (*********)
  L1 Hits:                            15649|N/A                  (*********)
  LL Hits:                                1|N/A                  (*********)
  RAM Hits:                               6|N/A                  (*********)
  Total read+write:                   15656|N/A                  (*********)
  Estimated Cycles:                   15864|N/A                  (*********)
icount::icount_bench_frexpf_group::icount_bench_frexpf logspace:setup_frexpf()
  Baselines:                      softfloat|softfloat (old)
  Instructions:                       10218|10726                (-4.73616%) [-1.04972x]
  L1 Hits:                            11806|12320                (-4.17208%) [-1.04354x]
  LL Hits:                                1|2                    (-50.0000%) [-2.00000x]
  RAM Hits:                               5|6                    (-16.6667%) [-1.20000x]
  Total read+write:                   11812|12328                (-4.18559%) [-1.04368x]
  Estimated Cycles:                   11986|12540                (-4.41786%) [-1.04622x]

@tgross35 tgross35 merged commit c344b66 into rust-lang:main Feb 12, 2026
40 checks passed
@tgross35 tgross35 deleted the frexpf16 branch February 13, 2026 11:48
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.

2 participants