Bug 493970 - s390x: Store/restore FPC upon helper call causes slowdown
Summary: s390x: Store/restore FPC upon helper call causes slowdown
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Andreas Arnez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-02 15:01 UTC by Andreas Arnez
Modified: 2024-10-09 15:14 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Patch for dropping the FPC save/restore upon helper call (3.77 KB, patch)
2024-10-08 15:56 UTC, Andreas Arnez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Arnez 2024-10-02 15:01:56 UTC
Currently the host's floating-point control register FPC is stored before calling a helper function and restored afterwards. This causes a measurable slowdown when using helper-heavy tools like memcheck.
The host FPC seems to be used only for setting the rounding mode before performing a floating-point operation. This is typically done once per SB.
I'm not aware of a helper function that changes the rounding mode. Such a behavior would only be acceptable if the helper was explicitly meant to do this, e.g., if it somehow participated in implementing the rounding-mode behavior. If so, keeping the updated FPC value would obviously be preferable. The same applies to the other FPC bits; if they were used and a helper changed them, keeping the updated values would probably be a more useful general approach.
Comment 1 Andreas Arnez 2024-10-08 15:56:52 UTC
Created attachment 174534 [details]
Patch for dropping the FPC save/restore upon helper call
Comment 2 Andreas Arnez 2024-10-09 15:14:10 UTC
Pushed this as commit 2b635fd318b6920250338cef6af15011b50a03f2.