From 1d61cd91bb09dce963c221bc6971cc987c9e2a8f Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Thu, 8 Dec 2011 19:57:48 +0000 Subject: [PATCH] mingw behaves like apple as far as labels go BUG=none TEST=none Review URL: http://webrtc-codereview.appspot.com/322002 git-svn-id: http://libyuv.googlecode.com/svn/trunk@99 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- source/rotate.cc | 25 ++++++++---- source/scale.cc | 104 +++++++++++------------------------------------ 3 files changed, 41 insertions(+), 90 deletions(-) diff --git a/README.chromium b/README.chromium index 9d9d87063..a9a228fc9 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 98 +Version: 99 License: BSD License File: LICENSE diff --git a/source/rotate.cc b/source/rotate.cc index eda8ecbd4..548e7ac4d 100644 --- a/source/rotate.cc +++ b/source/rotate.cc @@ -24,8 +24,24 @@ namespace libyuv { uvec8 kShuffleReverseUV = { 14u, 12u, 10u, 8u, 6u, 4u, 2u, 0u, 15u, 13u, 11u, 9u, 7u, 5u, 3u, 1u }; + +#if (defined(__APPLE__) || defined(__MINGW32__) || defined(__CYGWIN__)) && \ + defined(__i386__) +#define DECLARE_FUNCTION(name) \ + ".text \n" \ + ".globl _" name " \n" \ +"_" name ": \n" +#else +#define DECLARE_FUNCTION(name) \ + ".text \n" \ + ".global _" name " \n" \ +name ": \n" #endif +#endif + + + typedef void (*reverse_uv_func)(const uint8*, uint8*, uint8*, int); typedef void (*rotate_uv_wx8_func)(const uint8*, int, uint8*, int, @@ -366,14 +382,7 @@ extern "C" void TransposeUVWx8_SSE2(const uint8* src, int src_stride, uint8* dst_b, int dst_stride_b, int w); asm ( - ".text \n" -#if defined(__APPLE__) - ".globl _TransposeUVWx8_SSE2 \n" -"_TransposeUVWx8_SSE2: \n" -#else - ".global TransposeUVWx8_SSE2 \n" -"TransposeUVWx8_SSE2: \n" -#endif + DECLARE_FUNCTION(TransposeUVWx8_SSE2) "push %ebx \n" "push %esi \n" "push %edi \n" diff --git a/source/scale.cc b/source/scale.cc index 8006e0dc7..ac6f22993 100644 --- a/source/scale.cc +++ b/source/scale.cc @@ -511,11 +511,23 @@ static void ScaleRowDown38_2_Int_NEON(const uint8* src_ptr, int src_stride, !defined(YUV_DISABLE_ASM) #if defined(_MSC_VER) #define TALIGN16(t, var) __declspec(align(16)) t _ ## var -#elif defined(__APPLE__) && defined(__i386__) +#elif (defined(__APPLE__) || defined(__MINGW32__)) && defined(__i386__) #define TALIGN16(t, var) t var __attribute__((aligned(16))) #else #define TALIGN16(t, var) t _ ## var __attribute__((aligned(16))) #endif +#if (defined(__APPLE__) || defined(__MINGW32__) || defined(__CYGWIN__)) && \ + defined(__i386__) +#define DECLARE_FUNCTION(name) \ + ".text \n" \ + ".globl _" name " \n" \ +"_" name ": \n" +#else +#define DECLARE_FUNCTION(name) \ + ".text \n" \ + ".global _" name " \n" \ +name ": \n" +#endif // Offsets for source bytes 0 to 9 extern "C" TALIGN16(const uint8, shuf0[16]) = @@ -1620,14 +1632,7 @@ static void ScaleRowDown8_SSE2(const uint8* src_ptr, int src_stride, extern "C" void ScaleRowDown8Int_SSE2(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); asm( - ".text \n" -#if defined(__APPLE__) - ".globl _ScaleRowDown8Int_SSE2 \n" -"_ScaleRowDown8Int_SSE2: \n" -#else - ".global ScaleRowDown8Int_SSE2 \n" -"ScaleRowDown8Int_SSE2: \n" -#endif + DECLARE_FUNCTION(ScaleRowDown8Int_SSE2) "pusha \n" "mov 0x24(%esp),%esi \n" "mov 0x28(%esp),%ebx \n" @@ -1691,14 +1696,7 @@ extern "C" void ScaleRowDown8Int_SSE2(const uint8* src_ptr, int src_stride, extern "C" void ScaleRowDown34_SSSE3(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); asm( - ".text \n" -#if defined(__APPLE__) - ".globl _ScaleRowDown34_SSSE3 \n" -"_ScaleRowDown34_SSSE3: \n" -#else - ".global ScaleRowDown34_SSSE3 \n" -"ScaleRowDown34_SSSE3: \n" -#endif + DECLARE_FUNCTION(ScaleRowDown34_SSSE3) "pusha \n" "mov 0x24(%esp),%esi \n" "mov 0x2c(%esp),%edi \n" @@ -1729,14 +1727,7 @@ extern "C" void ScaleRowDown34_SSSE3(const uint8* src_ptr, int src_stride, extern "C" void ScaleRowDown34_1_Int_SSSE3(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); asm( - ".text \n" -#if defined(__APPLE__) - ".globl _ScaleRowDown34_1_Int_SSSE3 \n" -"_ScaleRowDown34_1_Int_SSSE3: \n" -#else - ".global ScaleRowDown34_1_Int_SSSE3 \n" -"ScaleRowDown34_1_Int_SSSE3: \n" -#endif + DECLARE_FUNCTION(ScaleRowDown34_1_Int_SSSE3) "pusha \n" "mov 0x24(%esp),%esi \n" "mov 0x28(%esp),%ebp \n" @@ -1790,14 +1781,7 @@ extern "C" void ScaleRowDown34_1_Int_SSSE3(const uint8* src_ptr, int src_stride, extern "C" void ScaleRowDown34_0_Int_SSSE3(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); asm( - ".text \n" -#if defined(__APPLE__) - ".globl _ScaleRowDown34_0_Int_SSSE3 \n" -"_ScaleRowDown34_0_Int_SSSE3: \n" -#else - ".global ScaleRowDown34_0_Int_SSSE3 \n" -"ScaleRowDown34_0_Int_SSSE3: \n" -#endif + DECLARE_FUNCTION(ScaleRowDown34_0_Int_SSSE3) "pusha \n" "mov 0x24(%esp),%esi \n" "mov 0x28(%esp),%ebp \n" @@ -1854,14 +1838,7 @@ extern "C" void ScaleRowDown34_0_Int_SSSE3(const uint8* src_ptr, int src_stride, extern "C" void ScaleRowDown38_SSSE3(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); asm( - ".text \n" -#if defined(__APPLE__) - ".globl _ScaleRowDown38_SSSE3 \n" -"_ScaleRowDown38_SSSE3: \n" -#else - ".global ScaleRowDown38_SSSE3 \n" -"ScaleRowDown38_SSSE3: \n" -#endif + DECLARE_FUNCTION(ScaleRowDown38_SSSE3) "pusha \n" "mov 0x24(%esp),%esi \n" "mov 0x28(%esp),%edx \n" @@ -1890,14 +1867,7 @@ extern "C" void ScaleRowDown38_SSSE3(const uint8* src_ptr, int src_stride, extern "C" void ScaleRowDown38_3_Int_SSSE3(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); asm( - ".text \n" -#if defined(__APPLE__) - ".globl _ScaleRowDown38_3_Int_SSSE3 \n" -"_ScaleRowDown38_3_Int_SSSE3: \n" -#else - ".global ScaleRowDown38_3_Int_SSSE3 \n" -"ScaleRowDown38_3_Int_SSSE3: \n" -#endif + DECLARE_FUNCTION(ScaleRowDown38_3_Int_SSSE3) "pusha \n" "mov 0x24(%esp),%esi \n" "mov 0x28(%esp),%edx \n" @@ -1954,14 +1924,7 @@ extern "C" void ScaleRowDown38_3_Int_SSSE3(const uint8* src_ptr, int src_stride, extern "C" void ScaleRowDown38_2_Int_SSSE3(const uint8* src_ptr, int src_stride, uint8* dst_ptr, int dst_width); asm( - ".text \n" -#if defined(__APPLE__) - ".globl _ScaleRowDown38_2_Int_SSSE3 \n" -"_ScaleRowDown38_2_Int_SSSE3: \n" -#else - ".global ScaleRowDown38_2_Int_SSSE3 \n" -"ScaleRowDown38_2_Int_SSSE3: \n" -#endif + DECLARE_FUNCTION(ScaleRowDown38_2_Int_SSSE3) "pusha \n" "mov 0x24(%esp),%esi \n" "mov 0x28(%esp),%edx \n" @@ -2001,14 +1964,7 @@ extern "C" void ScaleAddRows_SSE2(const uint8* src_ptr, int src_stride, uint16* dst_ptr, int src_width, int src_height); asm( - ".text \n" -#if defined(__APPLE__) - ".globl _ScaleAddRows_SSE2 \n" -"_ScaleAddRows_SSE2: \n" -#else - ".global ScaleAddRows_SSE2 \n" -"ScaleAddRows_SSE2: \n" -#endif + DECLARE_FUNCTION(ScaleAddRows_SSE2) "pusha \n" "mov 0x24(%esp),%esi \n" "mov 0x28(%esp),%edx \n" @@ -2052,14 +2008,7 @@ extern "C" void ScaleFilterRows_SSE2(uint8* dst_ptr, const uint8* src_ptr, int src_stride, int dst_width, int source_y_fraction); asm( - ".text \n" -#if defined(__APPLE__) - ".globl _ScaleFilterRows_SSE2 \n" -"_ScaleFilterRows_SSE2: \n" -#else - ".global ScaleFilterRows_SSE2 \n" -"ScaleFilterRows_SSE2: \n" -#endif + DECLARE_FUNCTION(ScaleFilterRows_SSE2) "push %esi \n" "push %edi \n" "mov 0xc(%esp),%edi \n" @@ -2147,14 +2096,7 @@ extern "C" void ScaleFilterRows_SSSE3(uint8* dst_ptr, const uint8* src_ptr, int src_stride, int dst_width, int source_y_fraction); asm( - ".text \n" -#if defined(__APPLE__) - ".globl _ScaleFilterRows_SSSE3 \n" -"_ScaleFilterRows_SSSE3: \n" -#else - ".global ScaleFilterRows_SSSE3 \n" -"ScaleFilterRows_SSSE3: \n" -#endif + DECLARE_FUNCTION(ScaleFilterRows_SSSE3) "push %esi \n" "push %edi \n" "mov 0xc(%esp),%edi \n"