diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 23:16:37 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 23:16:37 -0500 |
| commit | 70b1f7ccbeb95bc32d8e8cf6e99a12b47160cc84 (patch) | |
| tree | b100357ecabd7bf9a698b1b1dca08301579a319f /tools/fmisc_diff.py | |
| parent | d36edbe2676147c5a0f4d125bc5bdc5a57841536 (diff) | |
| parent | ead3511834e6f58e07563653610cc87c1a223433 (diff) | |
Merge pull request #4629 from TreXito
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/fmisc_diff.py')
| -rw-r--r-- | tools/fmisc_diff.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/fmisc_diff.py b/tools/fmisc_diff.py index 8cc32c2b1..4194d30b5 100644 --- a/tools/fmisc_diff.py +++ b/tools/fmisc_diff.py | |||
| @@ -13,8 +13,8 @@ float arithmetic (add, mul, fma, floor, the transcendentals, v_cmp_class_f32 wit | |||
| 13 | covers the ops it does not generate. | 13 | covers the ops it does not generate. |
| 14 | 14 | ||
| 15 | What is modelled, per instruction (OPS, --list-ops): | 15 | What is modelled, per instruction (OPS, --list-ops): |
| 16 | * v_fract_f32: S0 - floor(S0), at most 0x3f7fffff (a tiny negative S0 would round to 1.0); +-inf and NaN give a | 16 | * v_fract_f32: S0 - floor(S0), at most 0x3f7fffff (a tiny negative S0 would round to 1.0); +-inf gives |
| 17 | NaN; an integer gives +0. | 17 | 0xffc00000, a NaN comes back unchanged (a signalling one too); an integer gives +0. |
| 18 | * v_frexp_mant_f32 / v_frexp_exp_i32_f32: S0 = mant * 2^exp, mant in [0.5, 1) with S0's sign. +-0 gives +-0 and | 18 | * v_frexp_mant_f32 / v_frexp_exp_i32_f32: S0 = mant * 2^exp, mant in [0.5, 1) with S0's sign. +-0 gives +-0 and |
| 19 | 0; +-inf and NaN give S0 (mant) and 0 (exp). | 19 | 0; +-inf and NaN give S0 (mant) and 0 (exp). |
| 20 | * v_ldexp_f32 (VOP3 only): S0 * 2^S1, S1 a signed integer; overflow is +-inf, +-inf / +-0 / NaN pass through. | 20 | * v_ldexp_f32 (VOP3 only): S0 * 2^S1, S1 a signed integer; overflow is +-inf, +-inf / +-0 / NaN pass through. |
| @@ -177,8 +177,12 @@ def round_f32(fr, neg_zero=False): | |||
| 177 | 177 | ||
| 178 | 178 | ||
| 179 | def fract(w): | 179 | def fract(w): |
| 180 | if is_nan(w) or is_inf(w): | 180 | # Measured on gfx1036 (docs/design.md, "Float min/max/med3 with NaN, v_fract"): a NaN comes back unchanged, a |
| 181 | return QNAN | 181 | # signalling one too (v_cmp_class_f32 still reports class bit 0), and +-inf gives exactly 0xffc00000. |
| 182 | if is_nan(w): | ||
| 183 | return w | ||
| 184 | if is_inf(w): | ||
| 185 | return 0xFFC00000 | ||
| 182 | fr = to_frac(w) | 186 | fr = to_frac(w) |
| 183 | r = fr - math.floor(fr) | 187 | r = fr - math.floor(fr) |
| 184 | if r == 0: | 188 | if r == 0: |