From e5f0d222b1d4ca18eaaebed8819c2af11bbd7c94 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sun, 13 Nov 2022 10:47:55 +0800 Subject: [PATCH] util: Rename PIPE_ALIGN_STACK to UTIL_ALIGN_STACK and moved into util/compiler.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Yonggang Luo Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/llvmpipe/lp_test_blend.c | 2 +- src/gallium/drivers/llvmpipe/lp_test_conv.c | 2 +- src/gallium/drivers/llvmpipe/lp_test_format.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_test_printf.c | 2 +- src/gallium/frontends/nine/nine_flags.h | 2 +- src/gallium/include/pipe/p_compiler.h | 10 +--------- src/util/compiler.h | 7 +++++++ src/util/u_cpu_detect.c | 2 +- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index 37c3f731eaf..6025c970f86 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -430,7 +430,7 @@ compute_blend_ref(const struct pipe_blend_state *blend, } -PIPE_ALIGN_STACK +UTIL_ALIGN_STACK static boolean test_one(unsigned verbose, FILE *fp, diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c index c7ea9efc12d..fe25175f0c1 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c @@ -150,7 +150,7 @@ add_conv_test(struct gallivm_state *gallivm, } -PIPE_ALIGN_STACK +UTIL_ALIGN_STACK static boolean test_one(unsigned verbose, FILE *fp, diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index 0a2a1e449e8..8c663864006 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -133,7 +133,7 @@ add_fetch_rgba_test(struct gallivm_state *gallivm, unsigned verbose, } -PIPE_ALIGN_STACK +UTIL_ALIGN_STACK static boolean test_format_float(unsigned verbose, FILE *fp, const struct util_format_description *desc, @@ -237,7 +237,7 @@ test_format_float(unsigned verbose, FILE *fp, } -PIPE_ALIGN_STACK +UTIL_ALIGN_STACK static boolean test_format_unorm8(unsigned verbose, FILE *fp, const struct util_format_description *desc, diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c index b3de9cb9e8b..390af68c5ff 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_printf.c +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -84,7 +84,7 @@ add_printf_test(struct gallivm_state *gallivm) } -PIPE_ALIGN_STACK +UTIL_ALIGN_STACK static boolean test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase) diff --git a/src/gallium/frontends/nine/nine_flags.h b/src/gallium/frontends/nine/nine_flags.h index 61686a7f60f..3b81a09cee4 100644 --- a/src/gallium/frontends/nine/nine_flags.h +++ b/src/gallium/frontends/nine/nine_flags.h @@ -9,6 +9,6 @@ * We need to realign them to be able to use * SSE and to work with other libraries (llvm, etc) */ -#define NINE_WINAPI WINAPI PIPE_ALIGN_STACK +#define NINE_WINAPI WINAPI UTIL_ALIGN_STACK #endif /* _NINE_FLAGS_H_ */ \ No newline at end of file diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index fed5bf28c49..9b6d248dd2b 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -29,6 +29,7 @@ #define P_COMPILER_H +#include "util/compiler.h" #include "util/detect.h" #include "util/macros.h" @@ -91,15 +92,6 @@ typedef unsigned char boolean; #define PIPE_CDECL #endif - - -/* Macro for stack alignment. */ -#if defined(__GNUC__) && DETECT_ARCH_X86 -#define PIPE_ALIGN_STACK __attribute__((force_align_arg_pointer)) -#else -#define PIPE_ALIGN_STACK -#endif - /** * Declare a variable on its own cache line. * diff --git a/src/util/compiler.h b/src/util/compiler.h index e3e599a0efc..f6a358e2f04 100644 --- a/src/util/compiler.h +++ b/src/util/compiler.h @@ -38,6 +38,7 @@ #include "util/macros.h" #include "util/u_endian.h" +#include "util/detect_arch.h" /** * Define CPU_TO_LE32 @@ -65,6 +66,12 @@ #define LE32_TO_CPU( x ) CPU_TO_LE32( x ) +/* Macro for stack alignment. */ +#if defined(__GNUC__) && DETECT_ARCH_X86 +#define UTIL_ALIGN_STACK __attribute__((force_align_arg_pointer)) +#else +#define UTIL_ALIGN_STACK +#endif #define IEEE_ONE 0x3f800000 diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c index 496509d7c70..5a9baddfb87 100644 --- a/src/util/u_cpu_detect.c +++ b/src/util/u_cpu_detect.c @@ -368,7 +368,7 @@ static inline uint64_t xgetbv(void) #if DETECT_ARCH_X86 -PIPE_ALIGN_STACK +UTIL_ALIGN_STACK static inline bool sse2_has_daz(void) {