Support SSE-enabled Range functions under Clang
authorYedidya Feldblum <yfeldblum@fb.com>
Fri, 2 Oct 2015 08:52:56 +0000 (01:52 -0700)
committerfacebook-github-bot-5 <folly-bot@fb.com>
Fri, 2 Oct 2015 15:57:02 +0000 (08:57 -0700)
commit9600063281668a48a8205319b2b8b41346726492
treeb490bd4c00fc9f82dd40bcc494dfaa27b68397cb
parentb05969e4b4474cadf1cb1f8ebc37567cc63c9b88
Support SSE-enabled Range functions under Clang

Summary: [Folly] Support SSE-enabled `Range` functions under Clang.

Basically, we remove GCC-only -isms. In particular, we use only names from the `<emmintrins.h>` and `<smmintrins.h>` headers, instead of the GCC-specific SSE builtins that the original code uses.

But in order to get this to work, we must split out the SSE-enabled functions into their own sources and compile them with the `-msse4.2` flag. There is a way to get around this in GCC by marking individual functions as SEE-enabled, but that technique is not supported in Clang. This is the new `RangeSse42` module.

And in order to do that, we must split out the code that is called by both the original `Range` and the new SSE-enabled functions into yet a third module, `RangeCommon`.

Ahhhhhh, dependencies.

Note that we always compile the SSE-enabled functions, but we only run them on architectures supporting SSE. The original code tests the CPU's capabilities before running any SSE-enabled functions; this change retains that check.

Reviewed By: @nbronson

Differential Revision: D2428983
folly/Makefile.am
folly/Range.cpp [deleted file]
folly/Range.h
folly/configure.ac
folly/detail/RangeCommon.cpp [new file with mode: 0644]
folly/detail/RangeCommon.h [new file with mode: 0644]
folly/detail/RangeSse42.cpp [new file with mode: 0644]
folly/detail/RangeSse42.h [new file with mode: 0644]
folly/test/RangeFindBenchmark.cpp
folly/test/RangeTest.cpp