Skip to content

RFC fpu: experimental conversion of float128_addsub

Alex Bennée qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest8 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8softfloat: Use mulu64 for mul64To128include/fpu/softfloat-macros.h+4 -200 replies
2/8softfloat: Use int128.h for some operationsinclude/fpu/softfloat-macros.h+20 -190 replies
3/8softfloat: Tidy a * b + inf returnfpu/softfloat.c+2 -30 replies
4/8softfloat: Add float_cmask and constantsfpu/softfloat.c+24 -70 replies
5/8softfloat: Inline pick_nan_muladd into its callerfpu/softfloat.c+35 -400 replies
6/8int128.h: add bunch of uint128 utility functions (INCOMPLETE)include/qemu/int128.h+122 -00 replies
7/8tests/fp: add quad support to the benchmark utilitytests/fp/fp-bench.c+83 -50 replies
8/8softfloat: implement addsub_floats128 using Uint128 and new style codefpu/softfloat-specialize.c.inc fpu/softfloat.c include/fpu/softfloat-macros.h+421 -2211 reply

Reviews trailers per patch

5 of 8 patches have a Reviewed-by or Acked-by.

PatchDavid Hildenbrand
1/8R-b
2/8R-b
3/8R-b
4/8R-b
5/8R-b
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 0/8] fpu: experimental conversion of float128_addsub

Hi Richard,

This is the current state of my experiment to convert a 128 bit float function (in this case addsub). The actual conversion was fairly simple (basically a copy & paste with some tweaks for using the unint128 inline functions). However I ran into a number of stumbles with the int128.h support including casting of values like ~(Uint128)0 and messing around to handle things like missing __builtin support for clz. I suspect having some of the #defines expand into uint128_* functions plays some part in the 4x growth in code compared to the old version. However the drop in performance is a lot less than that.

In terms of total code churn we replace each deleted line in softfloat.c with 2 lines of new code although I suspect if we pressed on we could reduce the diffstat deficit. Debugging the actual failures was relatively painless with rr and the new code - perhaps because I just find it easier to follow.

I've included your early patches as that happened to be the state of my tree when I branched off. If we want to go forward with a more complete conversion I guess we would need:

- a more complete int128.h conversion (including fallback for non CONFIG_INT128)
- seeing if some of the resulting code bloat can be reduced
- seeing what scope there is for commonality of special case handling

I'm not a fan of having so much duplication but at least I personally find the code is more readable.

Alex Bennée (3):
int128.h: add bunch of uint128 utility functions (INCOMPLETE) tests/fp: add quad support to the benchmark utility
softfloat: implement addsub_floats128 using Uint128 and new style code

Richard Henderson (5):
softfloat: Use mulu64 for mul64To128
softfloat: Use int128.h for some operations
softfloat: Tidy a * b + inf return
softfloat: Add float_cmask and constants
softfloat: Inline pick_nan_muladd into its caller

 include/fpu/softfloat-macros.h |  80 ++--
 include/qemu/int128.h          | 122 ++++++
 fpu/softfloat.c                | 697 ++++++++++++++++++++-------------
 tests/fp/fp-bench.c            |  88 ++++-
 fpu/softfloat-specialize.c.inc |  39 ++
 5 files changed, 711 insertions(+), 315 deletions(-)
Signature · 1 line
2.20.1