Re: [Mesa-dev] [PATCH] utils/u_math: break dependency on gallium/utils

2018-09-20 Thread Dylan Baker
Sigh. Let me see if I can reproduce the failure with mingw, if we can't I'll
revert patch.

Dylan

Quoting Roland Scheidegger (2018-09-20 07:13:11)
> Looks like this broke the windows build, however.
> 
> Roland
> 
> Am 09.09.2018 um 08:39 schrieb Dylan Baker:
> > Currently u_math needs gallium utils for cpu detection.  Most of what
> > u_math uses out of u_cpu_detection is duplicated in src/mesa/x86
> > (surprise!), so I've just reworked it as much as possible to use the
> > x86/common_x86_features macros instead of the gallium ones. There is
> > one small function that was copied over, as promoting u_cpu_detection is
> > itself a fairly hefty undertaking, as it depends on u_debug, and this
> > fixes the bug for now.
> > 
> > bugzilla: 
> > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.freedesktop.org%2Fshow_bug.cgi%3Fid%3D107870data=02%7C01%7Csroland%40vmware.com%7C0c9a5dd4cb8946788a2308d6161f376f%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636720720673702384sdata=Y0wBuxQgoSiTbf8SPFfGD2qP2jzlbDu26f8QC5ksflg%3Dreserved=0
> > cc: v...@freedesktop.org
> > ---
> > 
> > I have no idea if this fixes the build on mac, I had this in a branch where 
> > I
> > started replacing more of imports.{h,c} with utils stuff, and this fixes 
> > some
> > build problems on Linux. I don't have a mac to test on and I wont until 
> > Monday.
> > If this works let me know.
> > 
> >  src/util/u_math.c | 43 ++-
> >  1 file changed, 38 insertions(+), 5 deletions(-)
> > 
> > diff --git a/src/util/u_math.c b/src/util/u_math.c
> > index c58af911be7..bf0c398eeec 100644
> > --- a/src/util/u_math.c
> > +++ b/src/util/u_math.c
> > @@ -29,7 +29,7 @@
> >  
> >  #include "pipe/p_config.h"
> >  #include "util/u_math.h"
> > -#include "util/u_cpu_detect.h"
> > +#include "x86/common_x86_features.h"
> >  
> >  #if defined(PIPE_ARCH_SSE)
> >  #include 
> > @@ -90,7 +90,7 @@ util_fpstate_get(void)
> > unsigned mxcsr = 0;
> >  
> >  #if defined(PIPE_ARCH_SSE)
> > -   if (util_cpu_caps.has_sse) {
> > +   if (cpu_has_xmm) {
> >mxcsr = _mm_getcsr();
> > }
> >  #endif
> > @@ -98,6 +98,31 @@ util_fpstate_get(void)
> > return mxcsr;
> >  }
> >  
> > +/* TODO: this was copied from u_cpu_detection. It's another case of 
> > duplication
> > + * between gallium and core mesa, and it would be nice to get rid of that
> > + * duplication as well.
> > + */
> > +#if defined(PIPE_ARCH_X86)
> > +PIPE_ALIGN_STACK static inline bool sse2_has_daz(void)
> > +{
> > +   struct {
> > +  uint32_t pad1[7];
> > +  uint32_t mxcsr_mask;
> > +  uint32_t pad2[128-8];
> > +   } PIPE_ALIGN_VAR(16) fxarea;
> > +
> > +   fxarea.mxcsr_mask = 0;
> > +#if defined(PIPE_CC_GCC)
> > +   __asm __volatile ("fxsave %0" : "+m" (fxarea));
> > +#elif defined(PIPE_CC_MSVC) || defined(PIPE_CC_ICL)
> > +   _fxsave();
> > +#else
> > +   fxarea.mxcsr_mask = 0;
> > +#endif
> > +   return !!(fxarea.mxcsr_mask & (1 << 6));
> > +}
> > +#endif
> > +
> >  /**
> >   * Make sure that the fp treats the denormalized floating
> >   * point numbers as zero.
> > @@ -108,13 +133,21 @@ unsigned
> >  util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
> >  {
> >  #if defined(PIPE_ARCH_SSE)
> > -   if (util_cpu_caps.has_sse) {
> > +   if (cpu_has_xmm) {
> >/* Enable flush to zero mode */
> >current_mxcsr |= _MM_FLUSH_ZERO_MASK;
> > -  if (util_cpu_caps.has_daz) {
> > +  /* x86_64 cpus always have daz, as do cpus with sse3 in fact, there's
> > +   * basically only a handful of very early pentium 4's that have sse2 
> > but
> > +   * not daz.
> > +   */
> > +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
> > +  if (sse2_has_daz()) {
> > +# endif
> >   /* Enable denormals are zero mode */
> >   current_mxcsr |= _MM_DENORMALS_ZERO_MASK;
> > +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
> >}
> > +#endif
> >util_fpstate_set(current_mxcsr);
> > }
> >  #endif
> > @@ -130,7 +163,7 @@ void
> >  util_fpstate_set(unsigned mxcsr)
> >  {
> >  #if defined(PIPE_ARCH_SSE)
> > -   if (util_cpu_caps.has_sse) {
> > +   if (cpu_has_xmm) {
> >_mm_setcsr(mxcsr);
> > }
> >  #endif
> > 
> 


signature.asc
Description: signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] utils/u_math: break dependency on gallium/utils

2018-09-20 Thread Roland Scheidegger
Looks like this broke the windows build, however.

Roland

Am 09.09.2018 um 08:39 schrieb Dylan Baker:
> Currently u_math needs gallium utils for cpu detection.  Most of what
> u_math uses out of u_cpu_detection is duplicated in src/mesa/x86
> (surprise!), so I've just reworked it as much as possible to use the
> x86/common_x86_features macros instead of the gallium ones. There is
> one small function that was copied over, as promoting u_cpu_detection is
> itself a fairly hefty undertaking, as it depends on u_debug, and this
> fixes the bug for now.
> 
> bugzilla: 
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.freedesktop.org%2Fshow_bug.cgi%3Fid%3D107870data=02%7C01%7Csroland%40vmware.com%7C0c9a5dd4cb8946788a2308d6161f376f%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636720720673702384sdata=Y0wBuxQgoSiTbf8SPFfGD2qP2jzlbDu26f8QC5ksflg%3Dreserved=0
> cc: v...@freedesktop.org
> ---
> 
> I have no idea if this fixes the build on mac, I had this in a branch where I
> started replacing more of imports.{h,c} with utils stuff, and this fixes some
> build problems on Linux. I don't have a mac to test on and I wont until 
> Monday.
> If this works let me know.
> 
>  src/util/u_math.c | 43 ++-
>  1 file changed, 38 insertions(+), 5 deletions(-)
> 
> diff --git a/src/util/u_math.c b/src/util/u_math.c
> index c58af911be7..bf0c398eeec 100644
> --- a/src/util/u_math.c
> +++ b/src/util/u_math.c
> @@ -29,7 +29,7 @@
>  
>  #include "pipe/p_config.h"
>  #include "util/u_math.h"
> -#include "util/u_cpu_detect.h"
> +#include "x86/common_x86_features.h"
>  
>  #if defined(PIPE_ARCH_SSE)
>  #include 
> @@ -90,7 +90,7 @@ util_fpstate_get(void)
> unsigned mxcsr = 0;
>  
>  #if defined(PIPE_ARCH_SSE)
> -   if (util_cpu_caps.has_sse) {
> +   if (cpu_has_xmm) {
>mxcsr = _mm_getcsr();
> }
>  #endif
> @@ -98,6 +98,31 @@ util_fpstate_get(void)
> return mxcsr;
>  }
>  
> +/* TODO: this was copied from u_cpu_detection. It's another case of 
> duplication
> + * between gallium and core mesa, and it would be nice to get rid of that
> + * duplication as well.
> + */
> +#if defined(PIPE_ARCH_X86)
> +PIPE_ALIGN_STACK static inline bool sse2_has_daz(void)
> +{
> +   struct {
> +  uint32_t pad1[7];
> +  uint32_t mxcsr_mask;
> +  uint32_t pad2[128-8];
> +   } PIPE_ALIGN_VAR(16) fxarea;
> +
> +   fxarea.mxcsr_mask = 0;
> +#if defined(PIPE_CC_GCC)
> +   __asm __volatile ("fxsave %0" : "+m" (fxarea));
> +#elif defined(PIPE_CC_MSVC) || defined(PIPE_CC_ICL)
> +   _fxsave();
> +#else
> +   fxarea.mxcsr_mask = 0;
> +#endif
> +   return !!(fxarea.mxcsr_mask & (1 << 6));
> +}
> +#endif
> +
>  /**
>   * Make sure that the fp treats the denormalized floating
>   * point numbers as zero.
> @@ -108,13 +133,21 @@ unsigned
>  util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
>  {
>  #if defined(PIPE_ARCH_SSE)
> -   if (util_cpu_caps.has_sse) {
> +   if (cpu_has_xmm) {
>/* Enable flush to zero mode */
>current_mxcsr |= _MM_FLUSH_ZERO_MASK;
> -  if (util_cpu_caps.has_daz) {
> +  /* x86_64 cpus always have daz, as do cpus with sse3 in fact, there's
> +   * basically only a handful of very early pentium 4's that have sse2 
> but
> +   * not daz.
> +   */
> +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
> +  if (sse2_has_daz()) {
> +# endif
>   /* Enable denormals are zero mode */
>   current_mxcsr |= _MM_DENORMALS_ZERO_MASK;
> +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
>}
> +#endif
>util_fpstate_set(current_mxcsr);
> }
>  #endif
> @@ -130,7 +163,7 @@ void
>  util_fpstate_set(unsigned mxcsr)
>  {
>  #if defined(PIPE_ARCH_SSE)
> -   if (util_cpu_caps.has_sse) {
> +   if (cpu_has_xmm) {
>_mm_setcsr(mxcsr);
> }
>  #endif
> 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] utils/u_math: break dependency on gallium/utils

2018-09-11 Thread Vinson Lee
On Sat, Sep 8, 2018 at 11:39 PM, Dylan Baker  wrote:
> Currently u_math needs gallium utils for cpu detection.  Most of what
> u_math uses out of u_cpu_detection is duplicated in src/mesa/x86
> (surprise!), so I've just reworked it as much as possible to use the
> x86/common_x86_features macros instead of the gallium ones. There is
> one small function that was copied over, as promoting u_cpu_detection is
> itself a fairly hefty undertaking, as it depends on u_debug, and this
> fixes the bug for now.
>
> bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107870
> cc: v...@freedesktop.org
> ---
>
> I have no idea if this fixes the build on mac, I had this in a branch where I
> started replacing more of imports.{h,c} with utils stuff, and this fixes some
> build problems on Linux. I don't have a mac to test on and I wont until 
> Monday.
> If this works let me know.
>
>  src/util/u_math.c | 43 ++-
>  1 file changed, 38 insertions(+), 5 deletions(-)
>
> diff --git a/src/util/u_math.c b/src/util/u_math.c
> index c58af911be7..bf0c398eeec 100644
> --- a/src/util/u_math.c
> +++ b/src/util/u_math.c
> @@ -29,7 +29,7 @@
>
>  #include "pipe/p_config.h"
>  #include "util/u_math.h"
> -#include "util/u_cpu_detect.h"
> +#include "x86/common_x86_features.h"
>
>  #if defined(PIPE_ARCH_SSE)
>  #include 
> @@ -90,7 +90,7 @@ util_fpstate_get(void)
> unsigned mxcsr = 0;
>
>  #if defined(PIPE_ARCH_SSE)
> -   if (util_cpu_caps.has_sse) {
> +   if (cpu_has_xmm) {
>mxcsr = _mm_getcsr();
> }
>  #endif
> @@ -98,6 +98,31 @@ util_fpstate_get(void)
> return mxcsr;
>  }
>
> +/* TODO: this was copied from u_cpu_detection. It's another case of 
> duplication
> + * between gallium and core mesa, and it would be nice to get rid of that
> + * duplication as well.
> + */
> +#if defined(PIPE_ARCH_X86)
> +PIPE_ALIGN_STACK static inline bool sse2_has_daz(void)
> +{
> +   struct {
> +  uint32_t pad1[7];
> +  uint32_t mxcsr_mask;
> +  uint32_t pad2[128-8];
> +   } PIPE_ALIGN_VAR(16) fxarea;
> +
> +   fxarea.mxcsr_mask = 0;
> +#if defined(PIPE_CC_GCC)
> +   __asm __volatile ("fxsave %0" : "+m" (fxarea));
> +#elif defined(PIPE_CC_MSVC) || defined(PIPE_CC_ICL)
> +   _fxsave();
> +#else
> +   fxarea.mxcsr_mask = 0;
> +#endif
> +   return !!(fxarea.mxcsr_mask & (1 << 6));
> +}
> +#endif
> +
>  /**
>   * Make sure that the fp treats the denormalized floating
>   * point numbers as zero.
> @@ -108,13 +133,21 @@ unsigned
>  util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
>  {
>  #if defined(PIPE_ARCH_SSE)
> -   if (util_cpu_caps.has_sse) {
> +   if (cpu_has_xmm) {
>/* Enable flush to zero mode */
>current_mxcsr |= _MM_FLUSH_ZERO_MASK;
> -  if (util_cpu_caps.has_daz) {
> +  /* x86_64 cpus always have daz, as do cpus with sse3 in fact, there's
> +   * basically only a handful of very early pentium 4's that have sse2 
> but
> +   * not daz.
> +   */
> +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
> +  if (sse2_has_daz()) {
> +# endif
>   /* Enable denormals are zero mode */
>   current_mxcsr |= _MM_DENORMALS_ZERO_MASK;
> +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
>}
> +#endif
>util_fpstate_set(current_mxcsr);
> }
>  #endif
> @@ -130,7 +163,7 @@ void
>  util_fpstate_set(unsigned mxcsr)
>  {
>  #if defined(PIPE_ARCH_SSE)
> -   if (util_cpu_caps.has_sse) {
> +   if (cpu_has_xmm) {
>_mm_setcsr(mxcsr);
> }
>  #endif
> --
> 2.18.0
>

Tested-by: Vinson Lee 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] utils/u_math: break dependency on gallium/utils

2018-09-10 Thread Marek Olšák
On Mon, Sep 10, 2018 at 12:11 PM, Dylan Baker  wrote:
> I agree that using code from mesa in util is gross, I'm not planning to leave 
> it
> like this. I'm in the middle of cleaning up duplication between util and mesa,
> and I'll plan on pulling u_cpu_detection down into src/util in that series.
>
> In this case while gross there shouldn't be any compilation issues,
> common_x86_features.h is a pure header implementation with no #include's if 
> any
> kind, so while a bit ugly this should be safe.

Yeah. If there is no compilation issue, it's probably fine.

Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] utils/u_math: break dependency on gallium/utils

2018-09-10 Thread Dylan Baker
I agree that using code from mesa in util is gross, I'm not planning to leave it
like this. I'm in the middle of cleaning up duplication between util and mesa,
and I'll plan on pulling u_cpu_detection down into src/util in that series.

In this case while gross there shouldn't be any compilation issues,
common_x86_features.h is a pure header implementation with no #include's if any
kind, so while a bit ugly this should be safe.

Dylan

Quoting Marek Olšák (2018-09-09 00:28:25)
> I think this will break non-GL gallium state trackers. src/mesa is
> only for GL, which is why common gallium code and gallium drivers
> can't use code from src/mesa.
> 
> Marek
> 
> On Sun, Sep 9, 2018 at 2:39 AM, Dylan Baker  wrote:
> > Currently u_math needs gallium utils for cpu detection.  Most of what
> > u_math uses out of u_cpu_detection is duplicated in src/mesa/x86
> > (surprise!), so I've just reworked it as much as possible to use the
> > x86/common_x86_features macros instead of the gallium ones. There is
> > one small function that was copied over, as promoting u_cpu_detection is
> > itself a fairly hefty undertaking, as it depends on u_debug, and this
> > fixes the bug for now.
> >
> > bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107870
> > cc: v...@freedesktop.org
> > ---
> >
> > I have no idea if this fixes the build on mac, I had this in a branch where 
> > I
> > started replacing more of imports.{h,c} with utils stuff, and this fixes 
> > some
> > build problems on Linux. I don't have a mac to test on and I wont until 
> > Monday.
> > If this works let me know.
> >
> >  src/util/u_math.c | 43 ++-
> >  1 file changed, 38 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/util/u_math.c b/src/util/u_math.c
> > index c58af911be7..bf0c398eeec 100644
> > --- a/src/util/u_math.c
> > +++ b/src/util/u_math.c
> > @@ -29,7 +29,7 @@
> >
> >  #include "pipe/p_config.h"
> >  #include "util/u_math.h"
> > -#include "util/u_cpu_detect.h"
> > +#include "x86/common_x86_features.h"
> >
> >  #if defined(PIPE_ARCH_SSE)
> >  #include 
> > @@ -90,7 +90,7 @@ util_fpstate_get(void)
> > unsigned mxcsr = 0;
> >
> >  #if defined(PIPE_ARCH_SSE)
> > -   if (util_cpu_caps.has_sse) {
> > +   if (cpu_has_xmm) {
> >mxcsr = _mm_getcsr();
> > }
> >  #endif
> > @@ -98,6 +98,31 @@ util_fpstate_get(void)
> > return mxcsr;
> >  }
> >
> > +/* TODO: this was copied from u_cpu_detection. It's another case of 
> > duplication
> > + * between gallium and core mesa, and it would be nice to get rid of that
> > + * duplication as well.
> > + */
> > +#if defined(PIPE_ARCH_X86)
> > +PIPE_ALIGN_STACK static inline bool sse2_has_daz(void)
> > +{
> > +   struct {
> > +  uint32_t pad1[7];
> > +  uint32_t mxcsr_mask;
> > +  uint32_t pad2[128-8];
> > +   } PIPE_ALIGN_VAR(16) fxarea;
> > +
> > +   fxarea.mxcsr_mask = 0;
> > +#if defined(PIPE_CC_GCC)
> > +   __asm __volatile ("fxsave %0" : "+m" (fxarea));
> > +#elif defined(PIPE_CC_MSVC) || defined(PIPE_CC_ICL)
> > +   _fxsave();
> > +#else
> > +   fxarea.mxcsr_mask = 0;
> > +#endif
> > +   return !!(fxarea.mxcsr_mask & (1 << 6));
> > +}
> > +#endif
> > +
> >  /**
> >   * Make sure that the fp treats the denormalized floating
> >   * point numbers as zero.
> > @@ -108,13 +133,21 @@ unsigned
> >  util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
> >  {
> >  #if defined(PIPE_ARCH_SSE)
> > -   if (util_cpu_caps.has_sse) {
> > +   if (cpu_has_xmm) {
> >/* Enable flush to zero mode */
> >current_mxcsr |= _MM_FLUSH_ZERO_MASK;
> > -  if (util_cpu_caps.has_daz) {
> > +  /* x86_64 cpus always have daz, as do cpus with sse3 in fact, there's
> > +   * basically only a handful of very early pentium 4's that have sse2 
> > but
> > +   * not daz.
> > +   */
> > +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
> > +  if (sse2_has_daz()) {
> > +# endif
> >   /* Enable denormals are zero mode */
> >   current_mxcsr |= _MM_DENORMALS_ZERO_MASK;
> > +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
> >}
> > +#endif
> >util_fpstate_set(current_mxcsr);
> > }
> >  #endif
> > @@ -130,7 +163,7 @@ void
> >  util_fpstate_set(unsigned mxcsr)
> >  {
> >  #if defined(PIPE_ARCH_SSE)
> > -   if (util_cpu_caps.has_sse) {
> > +   if (cpu_has_xmm) {
> >_mm_setcsr(mxcsr);
> > }
> >  #endif
> > --
> > 2.18.0
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] utils/u_math: break dependency on gallium/utils

2018-09-09 Thread Marek Olšák
I think this will break non-GL gallium state trackers. src/mesa is
only for GL, which is why common gallium code and gallium drivers
can't use code from src/mesa.

Marek

On Sun, Sep 9, 2018 at 2:39 AM, Dylan Baker  wrote:
> Currently u_math needs gallium utils for cpu detection.  Most of what
> u_math uses out of u_cpu_detection is duplicated in src/mesa/x86
> (surprise!), so I've just reworked it as much as possible to use the
> x86/common_x86_features macros instead of the gallium ones. There is
> one small function that was copied over, as promoting u_cpu_detection is
> itself a fairly hefty undertaking, as it depends on u_debug, and this
> fixes the bug for now.
>
> bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107870
> cc: v...@freedesktop.org
> ---
>
> I have no idea if this fixes the build on mac, I had this in a branch where I
> started replacing more of imports.{h,c} with utils stuff, and this fixes some
> build problems on Linux. I don't have a mac to test on and I wont until 
> Monday.
> If this works let me know.
>
>  src/util/u_math.c | 43 ++-
>  1 file changed, 38 insertions(+), 5 deletions(-)
>
> diff --git a/src/util/u_math.c b/src/util/u_math.c
> index c58af911be7..bf0c398eeec 100644
> --- a/src/util/u_math.c
> +++ b/src/util/u_math.c
> @@ -29,7 +29,7 @@
>
>  #include "pipe/p_config.h"
>  #include "util/u_math.h"
> -#include "util/u_cpu_detect.h"
> +#include "x86/common_x86_features.h"
>
>  #if defined(PIPE_ARCH_SSE)
>  #include 
> @@ -90,7 +90,7 @@ util_fpstate_get(void)
> unsigned mxcsr = 0;
>
>  #if defined(PIPE_ARCH_SSE)
> -   if (util_cpu_caps.has_sse) {
> +   if (cpu_has_xmm) {
>mxcsr = _mm_getcsr();
> }
>  #endif
> @@ -98,6 +98,31 @@ util_fpstate_get(void)
> return mxcsr;
>  }
>
> +/* TODO: this was copied from u_cpu_detection. It's another case of 
> duplication
> + * between gallium and core mesa, and it would be nice to get rid of that
> + * duplication as well.
> + */
> +#if defined(PIPE_ARCH_X86)
> +PIPE_ALIGN_STACK static inline bool sse2_has_daz(void)
> +{
> +   struct {
> +  uint32_t pad1[7];
> +  uint32_t mxcsr_mask;
> +  uint32_t pad2[128-8];
> +   } PIPE_ALIGN_VAR(16) fxarea;
> +
> +   fxarea.mxcsr_mask = 0;
> +#if defined(PIPE_CC_GCC)
> +   __asm __volatile ("fxsave %0" : "+m" (fxarea));
> +#elif defined(PIPE_CC_MSVC) || defined(PIPE_CC_ICL)
> +   _fxsave();
> +#else
> +   fxarea.mxcsr_mask = 0;
> +#endif
> +   return !!(fxarea.mxcsr_mask & (1 << 6));
> +}
> +#endif
> +
>  /**
>   * Make sure that the fp treats the denormalized floating
>   * point numbers as zero.
> @@ -108,13 +133,21 @@ unsigned
>  util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
>  {
>  #if defined(PIPE_ARCH_SSE)
> -   if (util_cpu_caps.has_sse) {
> +   if (cpu_has_xmm) {
>/* Enable flush to zero mode */
>current_mxcsr |= _MM_FLUSH_ZERO_MASK;
> -  if (util_cpu_caps.has_daz) {
> +  /* x86_64 cpus always have daz, as do cpus with sse3 in fact, there's
> +   * basically only a handful of very early pentium 4's that have sse2 
> but
> +   * not daz.
> +   */
> +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
> +  if (sse2_has_daz()) {
> +# endif
>   /* Enable denormals are zero mode */
>   current_mxcsr |= _MM_DENORMALS_ZERO_MASK;
> +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3)
>}
> +#endif
>util_fpstate_set(current_mxcsr);
> }
>  #endif
> @@ -130,7 +163,7 @@ void
>  util_fpstate_set(unsigned mxcsr)
>  {
>  #if defined(PIPE_ARCH_SSE)
> -   if (util_cpu_caps.has_sse) {
> +   if (cpu_has_xmm) {
>_mm_setcsr(mxcsr);
> }
>  #endif
> --
> 2.18.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev