From 061b5de8f45d92b85fdc975b4172e25216f98e11 Mon Sep 17 00:00:00 2001 From: Gustavo Serra Scalet Date: Tue, 5 Jan 2016 12:18:23 -0800 Subject: [PATCH] Enable GroupVarint on PPC64 Summary: This PR is necessary for both Folly and HHVM to compile on PPC64 (https://github.com/PPC64/hhvm) and other platforms that are not compatible with SSE instructions. It also removes GroupVarint32 tables generator dependency on x86 platform. Closes https://github.com/facebook/folly/pull/339 Reviewed By: mxw Differential Revision: D2760156 fb-gh-sync-id: b4e93b54b62d6f68ccf684d34840678f677bf276 --- folly/GroupVarint.h | 4 ++-- folly/build/generate_varint_tables.py | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/folly/GroupVarint.h b/folly/GroupVarint.h index 4e8657a6..fb99ac87 100644 --- a/folly/GroupVarint.h +++ b/folly/GroupVarint.h @@ -23,7 +23,7 @@ #include -#if FOLLY_X64 || defined(__i386__) +#if FOLLY_X64 || defined(__i386__) || FOLLY_PPC64 #define HAVE_GROUP_VARINT 1 #include @@ -617,5 +617,5 @@ typedef GroupVarintDecoder GroupVarint64Decoder; } // namespace folly -#endif /* FOLLY_X64 || defined(__i386__) */ +#endif /* FOLLY_X64 || defined(__i386__) || FOLLY_PPC64 */ #endif /* FOLLY_GROUPVARINT_H_ */ diff --git a/folly/build/generate_varint_tables.py b/folly/build/generate_varint_tables.py index c2c9dbf7..96bfd1d1 100755 --- a/folly/build/generate_varint_tables.py +++ b/folly/build/generate_varint_tables.py @@ -54,13 +54,16 @@ def generate(f): f.write(""" #include -#if (FOLLY_X64 || defined(__i386__)) && (FOLLY_SSE >= 2) #include + +#if (FOLLY_X64 || defined(__i386__)) && (FOLLY_SSE >= 2) #include +#endif namespace folly { namespace detail { +#if (FOLLY_X64 || defined(__i386__)) && (FOLLY_SSE >= 2) extern const __m128i groupVarintSSEMasks[] = { """) @@ -82,8 +85,9 @@ extern const __m128i groupVarintSSEMasks[] = { "static_cast(0x{3:08x}{2:08x})}},\n".format(*vals)) f.write("};\n" - "\n" - "extern const uint8_t groupVarintLengths[] = {\n") + "#endif /*#if (FOLLY_X64 || defined(__i386__)) && (FOLLY_SSE >= 2)*/\n" + "\n" + "extern const uint8_t groupVarintLengths[] = {\n") # Also compute total encoded lengths, including key byte for i in range(0, 256): @@ -98,7 +102,6 @@ extern const __m128i groupVarintSSEMasks[] = { } // namespace detail } // namespace folly -#endif /* (FOLLY_X64 || defined(__i386__)) && (FOLLY_SSE >= 2) */ """) def main(): -- 2.34.1