After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 783931 - ORC does not preserve XMM6:XMM15 registers
ORC does not preserve XMM6:XMM15 registers
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: orc
git master
Other Windows
: Normal major
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-06-18 18:32 UTC by Matej Knopp
Modified: 2017-06-20 06:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (2.43 KB, patch)
2017-06-19 01:27 UTC, Matej Knopp
none Details | Review
Patch (2.51 KB, patch)
2017-06-19 02:02 UTC, Matej Knopp
committed Details | Review

Description Matej Knopp 2017-06-18 18:32:08 UTC
MSVC stores floating point numbers in XMM6. XMM6:XMM15 are supposed to be non volatile in MSVC: https://msdn.microsoft.com/en-us/library/9z1stfyw.aspx

There is code in orc that marks them as saved, but I don't see any code that actually emits code to save them.
Comment 1 Matej Knopp 2017-06-19 01:27:37 UTC
Created attachment 354012 [details] [review]
Patch
Comment 2 Matej Knopp 2017-06-19 01:28:37 UTC
Comment on attachment 354012 [details] [review]
Patch

My attempt to save and restore the registers. Seems to work but I haven't tested it in 32 bit mode yet.
Comment 3 Matej Knopp 2017-06-19 02:02:17 UTC
Created attachment 354013 [details] [review]
Patch

Updated patch that doesn't generate any code when no registers are preserved
Comment 4 Sebastian Dröge (slomo) 2017-06-19 07:07:19 UTC
How did anything ever work with that? Why is it only required for MSVC? :)
Comment 5 Matej Knopp 2017-06-19 07:49:09 UTC
Well, I guess either other compilers don't assume XMM6:15 to be preserved, or they don't use it for anything. But for MSVC I have seen some messed up floats before, just somehow managed to ignore it :) Also some scaling methods (bilinear2) crash without this patch.
Comment 6 Matej Knopp 2017-06-19 07:50:47 UTC
Also all this weirdness only happens for optimized builds, which could partially explain this flying under radar for so long.
Comment 7 Sebastian Dröge (slomo) 2017-06-20 06:18:51 UTC
commit ec77a91702696ed619cccccb015518ee8887a62d (HEAD -> master, origin/master, origin/HEAD)
Author: Matej Knopp <matej.knopp@gmail.com>
Date:   Mon Jun 19 04:00:31 2017 +0200

    orc: preserve non volatile sse registers
    
    required for MSVC
    https://msdn.microsoft.com/en-us/library/9z1stfyw.aspx
    
    orc already marks these register in compiler->save_regs,
    but the actual saving and restoring was not done
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783931