[Mesa-dev] [PATCH] util: try to use SSE instructions with MSVC and 32-bit gcc
Matt Turner
mattst88 at gmail.com
Wed Aug 17 18:08:17 UTC 2016
On Wed, Aug 17, 2016 at 10:59 AM, Brian Paul <brianp at vmware.com> wrote:
> The lrint() and lrintf() functions are pretty slow and make some
> texture transfers very inefficient. This patch makes a better effort
> at using those intrisics for 32-bit gcc and MSVC.
>
> Note, this patch doesn't address the use of SSE4.1 with MSVC.
>
> Reviewed-by: José Fonseca <jfonseca at vmware.com>
> ---
> src/util/rounding.h | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/util/rounding.h b/src/util/rounding.h
> index afb38fb..ab55ebb 100644
> --- a/src/util/rounding.h
> +++ b/src/util/rounding.h
> @@ -29,9 +29,11 @@
> #include <limits.h>
> #include <stdint.h>
>
> -#ifdef __x86_64__
> +#if defined(__SSE__) || defined(_MSC_VER)
> +/* MSVC always has SSE nowadays */
> #include <xmmintrin.h>
> #include <emmintrin.h>
> +#define ROUND_WITH_SSE 1
I wonder why not replace the ifdef __x86_64__ with SSE || _MSC_VER
like you did above.
Either way,
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Also, -fno-math-errno and -fno-trapping-math make various rounding
functions compile to single or very few instructions with gcc. If MSVC
has similar flags, it might be worth enabling them.
More information about the mesa-dev
mailing list