GNOME Bugzilla – Bug 783931
ORC does not preserve XMM6:XMM15 registers
Last modified: 2017-06-20 06:18:55 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.
Created attachment 354012 [details] [review] Patch
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.
Created attachment 354013 [details] [review] Patch Updated patch that doesn't generate any code when no registers are preserved
How did anything ever work with that? Why is it only required for MSVC? :)
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.
Also all this weirdness only happens for optimized builds, which could partially explain this flying under radar for so long.
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