Skip to content

LATX, fix: Manage mode 2 softfpu helper regions - #427

Open
ganjue66da wants to merge 2 commits into
lat-opensource:masterfrom
ganjue66da:codex/softfpu-helper-regions
Open

LATX, fix: Manage mode 2 softfpu helper regions#427
ganjue66da wants to merge 2 commits into
lat-opensource:masterfrom
ganjue66da:codex/softfpu-helper-regions

Conversation

@ganjue66da

Copy link
Copy Markdown
Contributor

Motivation

Softfpu mode 2 groups consecutive x87 instructions into a helper region. A region ending exactly at a translation-block boundary could miss its epilogue, while several store/conversion instructions also emitted redundant per-instruction state transfers inside an already-open region.

Changes

  • Close an open helper region explicitly at translation-block end.
  • In mode 2, rely on the region wrapper for FIST/FISTP/FISTTP/FST/FSTP instead of adding duplicate local wrappers.
  • Preserve the existing per-instruction wrappers for mode 1.

Validation

  • The boundary-fix commit independently passes the 32-bit build and x87 conversion regression.
  • The full branch passes 32-bit and 64-bit builds and the x87 conversion regression with LATX_SOFTFPU=2.
  • Combined with the separate signal-frame and LBT PRs, LATX_SOFTFPU=2 LATX_SOFTFPU_FAST=0xc00000 passes the signal-stack regression.

Scope

The first commit is a correctness boundary fix. The second commit is a dependent optimization of the same helper-region lifetime mechanism.

Softfpu mode 2 opens one helper region for consecutive x87
instructions. When such a sequence reaches the last instruction in a
translation block, the old look-ahead logic has no following instruction
to trigger the matching epilogue.

Close the region explicitly at the translation-block boundary so the
generated helper state is restored on every exit.

Tests:
- LATX_SOFTFPU=2 latx-x87-signal-stack-test-one

Signed-off-by: Wenqiang Wei <weiwenqiang@mail.ustc.edu.cn>
Softfpu mode 2 already wraps consecutive x87 instructions in one helper
prologue and epilogue. FIST, FISTP, FISTTP, FST, and FSTP generated
additional per-instruction wrappers, repeating register state transfers
inside hot x87 regions.

Keep the local wrappers for mode 1 and rely on the region wrapper in
mode 2.

Tests:
- LATX_SOFTFPU=2 x87-conversion-regression
- LATX_SOFTFPU=2 latx-x87-signal-stack-test-one

Signed-off-by: Wenqiang Wei <weiwenqiang@mail.ustc.edu.cn>
@ganjue66da
ganjue66da force-pushed the codex/softfpu-helper-regions branch from 6b48fc9 to af8b2fe Compare August 25, 2026 03:55
@ganjue66da ganjue66da changed the title LATX: Manage softfpu helper regions across x87 sequences LATX, fix: Manage mode 2 softfpu helper regions Aug 25, 2026
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.

1 participant