Commit 061b5de8 authored by Gustavo Serra Scalet's avatar Gustavo Serra Scalet Committed by facebook-github-bot-1

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
parent a0430d4a
......@@ -23,7 +23,7 @@
#include <folly/Portability.h>
#if FOLLY_X64 || defined(__i386__)
#if FOLLY_X64 || defined(__i386__) || FOLLY_PPC64
#define HAVE_GROUP_VARINT 1
#include <cstdint>
......@@ -617,5 +617,5 @@ typedef GroupVarintDecoder<uint64_t> GroupVarint64Decoder;
} // namespace folly
#endif /* FOLLY_X64 || defined(__i386__) */
#endif /* FOLLY_X64 || defined(__i386__) || FOLLY_PPC64 */
#endif /* FOLLY_GROUPVARINT_H_ */
......@@ -54,13 +54,16 @@ def generate(f):
f.write("""
#include <folly/Portability.h>
#if (FOLLY_X64 || defined(__i386__)) && (FOLLY_SSE >= 2)
#include <stdint.h>
#if (FOLLY_X64 || defined(__i386__)) && (FOLLY_SSE >= 2)
#include <x86intrin.h>
#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<int64_t>(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():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment