This is needed to avoid performance degradation in wine_syscall_dispatcher before broader xstate (most notably, avx512) support is enabled.
We currently do not preserve avx state across syscalls because restore is not performed on each syscall exit (only when context was set for a thread) and xstate is clobbered in lots of syscalls (basically any glibc.memcpy is using avx / avx512 now if available). That is already an optimization as syscalls are not supposed to clobber xstate (and so far it wasn't problematic). It is less harmful with avx state because it is normally reset to init state after use with vzeroupper and thus clobbered to init state, so next syscall will omit actual save of the state with xsavec. The latter is not the case with avx512 however where the state is left in dirty state after use, so even if the app itself is not using avx512 we would be saving huge state on each wine_syscall_dispatcher call.
So saving the state only when needed shouldn't change anything in the present functionality. If we will need preserve the xstate in some syscalls for some reason in the future it will be easy to do on per-call basis.
Besides wine_syscall_dispatcher, we are clobbering xstate in native calls called through wine_unix_call_dispatcher which is not an issue by itself but makes useless restting xstate in wine_syscall_dispatcher.