Skip to content

target/s390x: Implement DIVIDE TO INTEGER

Ilya Leoshkevich qemu-devel 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest5 patches 1 replyIn review
  2. v45 patches 3 repliesSuperseded
  3. v35 patches 5 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v24 patches6 repliesSuperseded
v13 patches6 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5target/s390x: Dump Floating-Point-Control Registertarget/s390x/cpu-dump.c+1 -00 replies
2/5target/s390x: Extract s390_get_bfp_rounding_mode()target/s390x/tcg/fpu_helper.c+31 -310 replies
3/5fpu: Restrict parts_round_to_int_normal to target precisionfpu/softfloat-parts.c.inc+6 -61 reply
4/5target/s390x: Implement DIVIDE TO INTEGERfpu/softfloat.c include/fpu/softfloat.h target/s390x/helper.h +3 more+240 -10 replies
5/5tests/tcg/s390x: Test DIVIDE TO INTEGERtests/tcg/s390x/Makefile.target tests/tcg/s390x/divide-to-integer.c+270 -00 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchAlex BennéeThomas HuthRichard Henderson
1/5R-b R-b
2/5R-b R-b
3/5R-b
4/5R-b
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v5 thread

Cover letter [PATCH v5 0/5] target/s390x: Implement DIVIDE TO INTEGER

v4: https://lore.kernel.org/qemu-devel/[email protected]/
v4 -> v5: Restore "& 63" in 3/5, add a comment, drop R-b (Thomas).

v3: https://lore.kernel.org/qemu-devel/[email protected]/
v3 -> v4: Use parts_round_to_int_normal() (Richard).
Drop saved_flags.
Collect R-bs (Thomas, Richard).

v2: https://lore.kernel.org/qemu-devel/[email protected]/
v2 -> v3: Use FloatParts64 (Richard).
Improve "smallish" comment (Richard).
Use parts_muladd_scalbn (Richard).
Get rid of manual precision rounding (Richard).
New patch: parts_round_to_int_normal() improvement.
New 64-bit testcase for a fuzzer finding on one of the intermediate versions. I have to admit I did not put down and then forgot what exactly it was about, but it must be interesting, so I decided to keep it.

v1: https://lore.kernel.org/qemu-devel/[email protected]/
v1 -> v2: Move the implementatation to fpu/ and rewrite using
FloatParts (Richard). I can't say I particularly like the way it looks, but at least most macros are gone and it survives fuzzing.
Explain why we need -O0 for the test (Alex).
New patch: s390_get_bfp_rounding_mode().
Add a few comments with calculation examples to the test.

Hi,

This series implements DIVIDE TO INTEGER instruction, which is required to run LuaJIT.

Patch 1 is a debugging helper, patch 2 is a small refactoring, patch 3 is an improvement for an FPU rounding helper, patch 4 is the implementation.

Since the instruction is quite complex, I've extensively tested it using a libFuzzer-based harness [1] that compares emulation with native execution at ~15k exec/s. The tests (patch 5) use data generated this way.

Best regards,
Ilya

[1] https://gitlab.com/iii-i/qemu/-/tags/iii/wip/fuzz-tcg/v2

Ilya Leoshkevich (5):
target/s390x: Dump Floating-Point-Control Register target/s390x: Extract s390_get_bfp_rounding_mode()
fpu: Restrict parts_round_to_int_normal to target precision target/s390x: Implement DIVIDE TO INTEGER tests/tcg/s390x: Test DIVIDE TO INTEGER

 fpu/softfloat-parts.c.inc           |  12 +-
 fpu/softfloat.c                     | 142 +++++++++++++++
 include/fpu/softfloat.h             |  11 ++
 target/s390x/cpu-dump.c             |   1 +
 target/s390x/helper.h               |   1 +
 target/s390x/tcg/fpu_helper.c       | 118 +++++++++----
 target/s390x/tcg/insn-data.h.inc    |   5 +-
 target/s390x/tcg/translate.c        |  26 +++
 tests/tcg/s390x/Makefile.target     |   5 +
 tests/tcg/s390x/divide-to-integer.c | 265 ++++++++++++++++++++++++++++
 10 files changed, 548 insertions(+), 38 deletions(-)
 create mode 100644 tests/tcg/s390x/divide-to-integer.c
Signature · 1 line
2.52.0