[Mesa-dev] [PATCH 5/5] osx: fix asm support on darwin

Emil Velikov emil.l.velikov at gmail.com
Thu Jun 18 11:46:41 PDT 2015


On 18 June 2015 at 06:53, Julien Isorce <julien.isorce at gmail.com> wrote:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90908
> Signed-off-by: Julien Isorce <j.isorce at samsung.com>
> ---
>  configure.ac             |  2 +-
>  src/mesa/x86-64/xform4.S | 53 +++++++++++++++++++++++++-----------------------
>  src/mesa/x86/assyntax.h  |  2 +-
>  3 files changed, 30 insertions(+), 27 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index ae6d83d..6d699d5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -615,7 +615,7 @@ if test "x$enable_asm" = xyes; then
>          ;;
>      x86_64|amd64)
>          case "$host_os" in
> -        linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
> +        linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | darwin*)
>              asm_arch=x86_64
>              ;;
>          esac
> diff --git a/src/mesa/x86-64/xform4.S b/src/mesa/x86-64/xform4.S
> index c185f62..17eb7fa 100644
> --- a/src/mesa/x86-64/xform4.S
> +++ b/src/mesa/x86-64/xform4.S
> @@ -24,14 +24,15 @@
>
>  #ifdef USE_X86_64_ASM
>
> +#include "x86/assyntax.h"
>  #include "matypes.h"
>
>  .text
>
>  .align 16
> -.globl _mesa_x86_64_cpuid
> -.hidden _mesa_x86_64_cpuid
> -_mesa_x86_64_cpuid:
> +GLOBL GLNAME(_mesa_x86_64_cpuid)
> +HIDDEN(_mesa_x86_64_cpuid)
> +GLNAME(_mesa_x86_64_cpuid):
>         pushq   %rbx
>         movl    (%rdi), %eax
>         movl    8(%rdi), %ecx
> @@ -46,9 +47,9 @@ _mesa_x86_64_cpuid:
>         ret
>
>  .align 16
> -.globl _mesa_x86_64_transform_points4_general
> -.hidden _mesa_x86_64_transform_points4_general
> -_mesa_x86_64_transform_points4_general:
> +GLOBL GLNAME(_mesa_x86_64_transform_points4_general)
> +HIDDEN(_mesa_x86_64_transform_points4_general)
> +GLNAME(_mesa_x86_64_transform_points4_general):
>  /*
>   *     rdi = dest
>   *     rsi = matrix
> @@ -105,8 +106,10 @@ p4_general_loop:
>  p4_general_done:
>         .byte 0xf3
>         ret
> -
> +
> +#if defined (__ELF__) && defined (__linux__)
>  .section .rodata
> +#endif
>
>  .align 16
>  p4_constants:
> @@ -122,13 +125,13 @@ p4_constants:
>
>  .text
>  .align 16
> -.globl _mesa_x86_64_transform_points4_3d
> -.hidden _mesa_x86_64_transform_points4_3d
> +GLOBL GLNAME(_mesa_x86_64_transform_points4_3d)
> +HIDDEN(_mesa_x86_64_transform_points4_3d)
>  /*
>   * this is slower than _mesa_x86_64_transform_points4_general
>   * because it ensures that the last matrix row (or is it column?) is 0,0,0,1
>   */
> -_mesa_x86_64_transform_points4_3d:
> +GLNAME(_mesa_x86_64_transform_points4_3d):
>
>         leaq p4_constants(%rip), %rax
>
> @@ -194,9 +197,9 @@ p4_3d_done:
>
>
>  .align 16
> -.globl _mesa_x86_64_transform_points4_identity
> -.hidden _mesa_x86_64_transform_points4_identity
> -_mesa_x86_64_transform_points4_identity:
> +GLOBL GLNAME(_mesa_x86_64_transform_points4_identity)
> +HIDDEN(_mesa_x86_64_transform_points4_identitiy)
> +GLNAME(_mesa_x86_64_transform_points4_identity):
>
>         movl V4F_COUNT(%rdx), %ecx      /* count */
>         movzbl V4F_STRIDE(%rdx), %eax   /* stride */
> @@ -223,9 +226,9 @@ p4_identity_done:
>
>
>  .align 16
> -.globl _mesa_3dnow_transform_points4_3d_no_rot
> -.hidden _mesa_3dnow_transform_points4_3d_no_rot
> -_mesa_3dnow_transform_points4_3d_no_rot:
> +GLOBL GLNAME(_mesa_3dnow_transform_points4_3d_no_rot)
> +HIDDEN(_mesa_3dnow_transform_points4_3d_no_rot)
> +GLNAME(_mesa_3dnow_transform_points4_3d_no_rot):
>
>         movl V4F_COUNT(%rdx), %ecx      /* count */
>         movzbl V4F_STRIDE(%rdx), %eax   /* stride */
> @@ -288,9 +291,9 @@ p4_3d_no_rot_done:
>
>
>  .align 16
> -.globl _mesa_3dnow_transform_points4_perspective
> -.hidden _mesa_3dnow_transform_points4_perspective
> -_mesa_3dnow_transform_points4_perspective:
> +GLOBL GLNAME(_mesa_3dnow_transform_points4_perspective)
> +HIDDEN(_mesa_3dnow_transform_points4_perspective)
> +GLNAME(_mesa_3dnow_transform_points4_perspective):
>
>         movl V4F_COUNT(%rdx), %ecx      /* count */
>         movzbl V4F_STRIDE(%rdx), %eax   /* stride */
> @@ -355,9 +358,9 @@ p4_perspective_done:
>         ret
>
>  .align 16
> -.globl _mesa_3dnow_transform_points4_2d_no_rot
> -.hidden _mesa_3dnow_transform_points4_2d_no_rot
> -_mesa_3dnow_transform_points4_2d_no_rot:
> +GLOBL GLNAME(_mesa_3dnow_transform_points4_2d_no_rot)
> +HIDDEN(_mesa_3dnow_transform_points4_2d_no_rot)
> +GLNAME(_mesa_3dnow_transform_points4_2d_no_rot):
>
>         movl V4F_COUNT(%rdx), %ecx      /* count */
>         movzbl V4F_STRIDE(%rdx), %eax   /* stride */
> @@ -411,9 +414,9 @@ p4_2d_no_rot_done:
>
>
>  .align 16
> -.globl _mesa_3dnow_transform_points4_2d
> -.hidden _mesa_3dnow_transform_points4_2d
> -_mesa_3dnow_transform_points4_2d:
> +GLOBL GLNAME(_mesa_3dnow_transform_points4_2d)
> +HIDDEN(_mesa_3dnow_transform_points4_2d)
> +GLNAME(_mesa_3dnow_transform_points4_2d):
>
>         movl V4F_COUNT(%rdx), %ecx      /* count */
>         movzbl V4F_STRIDE(%rdx), %eax   /* stride */
> diff --git a/src/mesa/x86/assyntax.h b/src/mesa/x86/assyntax.h
> index 67867bd..8ba7e50 100644
> --- a/src/mesa/x86/assyntax.h
> +++ b/src/mesa/x86/assyntax.h
> @@ -255,7 +255,7 @@
>  #endif /* ACK_ASSEMBLER */
>
>
> -#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__MINGW32__)
> +#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__MINGW32__) && !defined(__APPLE__)
>  #define GLNAME(a)      a
>  #else
>  #define GLNAME(a)      CONCAT(_,a)

Considering that this is a fragile area in mesa, can you confirm what
kind of testing you've done ? Would be nice to avoid breaking things
in various subtle ways.

Note to self: Upon a closer look, I'm not sure of many of the
assemblers mentioned in assyntax.h are available/used nowadays. Maybe
we can have a crazy^W brave soul that does some cleanup in here :-)

-Emil


More information about the mesa-dev mailing list