[PATCH v3] ucrtbase: added function implementation for get_FMA3_enable and set_FMA3_enable

Piotr Caban piotr.caban at gmail.com
Mon Feb 3 09:28:48 CST 2020


Hi Rosa,

On 2/2/20 4:51 PM, Rosa Hase wrote:
> +    #if defined(_WIN64) && _MSVCR_VER>=120
> +        #if !defined(__FMA__) && defined(__AVX2__)
> +            #define __FMA__ 1
The __FMA__ and __AVX2__ is only defined when compilation with this 
instructions is enabled (e.g. -mfma option). It's also said that you 
should never define them yourself.

>   /*********************************************************************
>    *      _set_FMA3_enable (MSVCR120.@)
>    */
>   int CDECL MSVCRT__set_FMA3_enable(int flag)
>   {
> -    FIXME("(%x) stub\n", flag);
> -    return 0;
> +    fma3_enabled = flag && fma3_supported;
> +    return fma3_enabled;
This is only checking if wine was compiled using -mfma or -mavx option. 
This function should check processor capabilities instead and switch to 
different math functions implementation. Taking in account that we don't 
provide math function implementation using fma3 instructions it's 
probably best to leave _set_FMA3_enable function as is.

A fake implementation of _get_FMA3_enable may look like this:
+/*********************************************************************
+ *      _get_FMA3_enable (MSVCR120.@)
+ */
+int CDECL MSVCRT__get_FMA3_enable(void)
+{
+    FIXME("() stub\n");
+    return 0;
+}
I guess it will be good enough to fix the proton bug.

Thanks,
Piotr



More information about the wine-devel mailing list