util: add a common ALIGN16 macro for m_matrix and u_threaded_context

to prevent conflicts in the next commit

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
This commit is contained in:
Marek Olšák 2020-10-12 05:24:57 -04:00 committed by Marge Bot
parent 14a2117fc8
commit 9c84ca574d
7 changed files with 15 additions and 26 deletions

View file

@ -316,12 +316,6 @@ union tc_payload {
bool boolean; bool boolean;
}; };
#ifdef _MSC_VER
#define ALIGN16 __declspec(align(16))
#else
#define ALIGN16 __attribute__((aligned(16)))
#endif
/* Each call slot should be aligned to its own size for optimal cache usage. */ /* Each call slot should be aligned to its own size for optimal cache usage. */
struct ALIGN16 tc_call { struct ALIGN16 tc_call {
unsigned sentinel; unsigned sentinel;

View file

@ -28,6 +28,8 @@
#include <strings.h> #include <strings.h>
#include "i965_asm.h" #include "i965_asm.h"
#undef ALIGN16
#define YYLTYPE YYLTYPE #define YYLTYPE YYLTYPE
typedef struct YYLTYPE typedef struct YYLTYPE
{ {

View file

@ -3,6 +3,7 @@
%{ %{
#include <string.h> #include <string.h>
#include "i965_asm.h" #include "i965_asm.h"
#undef ALIGN16
#include "i965_gram.tab.h" #include "i965_gram.tab.h"
/* Locations */ /* Locations */

View file

@ -203,9 +203,9 @@ static clip_func ref_cliptest[5] = {
* Cliptest tests * Cliptest tests
*/ */
ALIGN16(static GLfloat, s[TEST_COUNT][4]); ALIGN16 static GLfloat s[TEST_COUNT][4];
ALIGN16(static GLfloat, d[TEST_COUNT][4]); ALIGN16 static GLfloat d[TEST_COUNT][4];
ALIGN16(static GLfloat, r[TEST_COUNT][4]); ALIGN16 static GLfloat r[TEST_COUNT][4];
/** /**

View file

@ -302,20 +302,6 @@ static int significand_match( GLfloat a, GLfloat b )
enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 }; enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 };
/* Ensure our arrays are correctly aligned.
*/
#if defined(__GNUC__)
# define ALIGN16(type, array) type array __attribute__ ((aligned (16)))
#elif defined(_MSC_VER)
# define ALIGN16(type, array) type array __declspec(align(16)) /* GH: Does this work? */
#elif defined(__xlC__)
# define ALIGN16(type, array) type __align (16) array
#else
# warning "ALIGN16 will not 16-byte align!\n"
# define ALIGN16
#endif
#endif /* DEBUG_MATH */ #endif /* DEBUG_MATH */
#endif /* __M_DEBUG_UTIL_H__ */ #endif /* __M_DEBUG_UTIL_H__ */

View file

@ -160,9 +160,9 @@ static void init_matrix( GLfloat *m )
m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0;
} }
ALIGN16(static GLfloat, s[TEST_COUNT][4]); ALIGN16 static GLfloat s[TEST_COUNT][4];
ALIGN16(static GLfloat, d[TEST_COUNT][4]); ALIGN16 static GLfloat d[TEST_COUNT][4];
ALIGN16(static GLfloat, r[TEST_COUNT][4]); ALIGN16 static GLfloat r[TEST_COUNT][4];
static int test_transform_function( transform_func func, int psize, static int test_transform_function( transform_func func, int psize,
int mtype, unsigned long *cycles ) int mtype, unsigned long *cycles )

View file

@ -183,6 +183,12 @@ do { \
# endif # endif
#endif #endif
#ifdef _MSC_VER
#define ALIGN16 __declspec(align(16))
#else
#define ALIGN16 __attribute__((aligned(16)))
#endif
#ifdef __cplusplus #ifdef __cplusplus
/** /**
* Macro function that evaluates to true if T is a trivially * Macro function that evaluates to true if T is a trivially