Bug 493970

Summary: s390x: Store/restore FPC upon helper call causes slowdown
Product: [Developer tools] valgrind Reporter: Andreas Arnez <arnez>
Component: vexAssignee: Andreas Arnez <arnez>
Status: RESOLVED FIXED    
Severity: normal CC: flo2030
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Patch for dropping the FPC save/restore upon helper call

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.