added arm __builtin_clz support and tests running in arm mode (#854)
added arm __builtin_clz support and tests running in arm mode inside travis
This commit is contained in:
parent
eda956f13a
commit
57ad035955
29
.travis.yml
29
.travis.yml
|
@ -15,6 +15,9 @@ matrix:
|
|||
- os: osx
|
||||
osx_image: xcode6.4
|
||||
env: variant=test_barebones
|
||||
- sudo: required
|
||||
dist: trusty
|
||||
env: arch=arm
|
||||
|
||||
git:
|
||||
submodules: false
|
||||
|
@ -86,8 +89,26 @@ install:
|
|||
- 'if [[ "$variant" != "" ]]; then ccache -V && ccache --show-stats && ccache --zero-stats; fi'
|
||||
- if [ "$docs" == "1" ]; then rst2html.py --version; fi
|
||||
|
||||
script:
|
||||
- 'if [ $arch == "arm" ];
|
||||
then
|
||||
cd test;
|
||||
echo "using gcc : arm64 : aarch64-linux-gnu-gcc : <cflags>-std=c11 <cxxflags>-std=c++11 <cxxflags>-fsigned-char <linkflags>-lstdc++ <linkflags>-lm ;" >> ~/user-config.jam;
|
||||
wget http://releases.linaro.org/components/toolchain/binaries/latest-5/aarch64-linux-gnu/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu.tar.xz;
|
||||
tar xf gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu.tar.xz;
|
||||
export PATH=${PWD}/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin:${PATH};
|
||||
aarch64-linux-gnu-gcc --version;
|
||||
wget -O boost.zip http://pilotfiber.dl.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.zip;
|
||||
unzip -qq boost.zip;
|
||||
export BOOST_ROOT=$PWD/boost_1_55_0;
|
||||
sudo apt-get install -y qemu-user-static debootstrap;
|
||||
sudo debootstrap --variant=minbase --arch arm64 --foreign --include=build-essential testing rootfs;
|
||||
sudo cp /usr/bin/qemu-aarch64-static rootfs/usr/bin/;
|
||||
sudo chroot rootfs /debootstrap/debootstrap --second-stage;
|
||||
sudo chroot rootfs mount -t proc none /proc;
|
||||
cd ..;
|
||||
fi'
|
||||
|
||||
script:
|
||||
|
||||
- cd docs
|
||||
- 'if [ "$docs" == "1" ]; then
|
||||
|
@ -165,3 +186,9 @@ script:
|
|||
|
||||
- 'if [[ "$variant" != "" ]]; then ccache --show-stats; fi'
|
||||
|
||||
- cd test
|
||||
- 'if [ $arch == "arm" ];
|
||||
then
|
||||
bjam arm-tests warnings-as-errors=on variant=test_arm toolset=gcc-arm64 target-os=linux link=static testing.launcher="sudo cp -R bin rootfs/; sudo chroot rootfs";
|
||||
fi'
|
||||
- cd ..
|
||||
|
|
5
Jamfile
5
Jamfile
|
@ -536,6 +536,11 @@ variant test_barebones : debug
|
|||
<deprecated-functions>off <invariant-checks>off
|
||||
<export-extra>on <debug-iterators>on <threading>multi <asserts>on
|
||||
;
|
||||
variant test_arm : debug
|
||||
: <ipv6>off <dht>off <extensions>off <logging>off
|
||||
<deprecated-functions>off <invariant-checks>off
|
||||
<export-extra>on <asserts>on
|
||||
;
|
||||
|
||||
# required for openssl on windows
|
||||
lib ssleay32 : : <name>ssleay32 ;
|
||||
|
|
|
@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
|
||||
#if __GNUC__ >= 6
|
||||
#pragma GCC diagnostic ignored "-Wshift-overflow"
|
||||
#pragma GCC diagnostic ignored "-Wshift-count-overflow"
|
||||
|
|
|
@ -518,6 +518,25 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#endif // TORRENT_HAS_SSE
|
||||
|
||||
#if (defined __arm__ || defined __aarch64__)
|
||||
#define TORRENT_HAS_ARM 1
|
||||
#else
|
||||
#define TORRENT_HAS_ARM 0
|
||||
#endif // TORRENT_HAS_ARM
|
||||
|
||||
#ifndef __has_builtin
|
||||
#define __has_builtin(x) 0 // for non-clang compilers
|
||||
#endif
|
||||
|
||||
#if (TORRENT_HAS_SSE && __GNUC__)
|
||||
# define TORRENT_HAS_BUILTIN_CLZ 1
|
||||
#elif (TORRENT_HAS_ARM && defined __GNUC__ && !defined __clang__)
|
||||
# define TORRENT_HAS_BUILTIN_CLZ 1
|
||||
#elif (defined __clang__ && __has_builtin(__builtin_clz))
|
||||
# define TORRENT_HAS_BUILTIN_CLZ 1
|
||||
#else
|
||||
# define TORRENT_HAS_BUILTIN_CLZ 0
|
||||
#endif // TORRENT_HAS_BUILTIN_CLZ
|
||||
|
||||
#endif // TORRENT_CONFIG_HPP_INCLUDED
|
||||
|
||||
|
|
|
@ -48,19 +48,22 @@ namespace libtorrent { namespace aux
|
|||
{
|
||||
namespace {
|
||||
|
||||
#if TORRENT_HAS_SSE
|
||||
// internal
|
||||
void cpuid(unsigned int info[4], int type)
|
||||
{
|
||||
#if TORRENT_HAS_SSE && defined _MSC_VER
|
||||
#if defined _MSC_VER
|
||||
__cpuid((int*)info, type);
|
||||
|
||||
#elif TORRENT_HAS_SSE && defined __GNUC__
|
||||
#elif defined __GNUC__
|
||||
__get_cpuid(type, &info[0], &info[1], &info[2], &info[3]);
|
||||
#else
|
||||
TORRENT_UNUSED(type);
|
||||
// for non-x86 and non-amd64, just return zeroes
|
||||
std::memset(&info[0], 0, sizeof(unsigned int) * 4);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
bool supports_sse42()
|
||||
{
|
||||
|
|
|
@ -75,14 +75,12 @@ namespace libtorrent
|
|||
continue;
|
||||
}
|
||||
|
||||
#if TORRENT_HAS_SSE
|
||||
#ifdef __GNUC__
|
||||
#if TORRENT_HAS_BUILTIN_CLZ
|
||||
return ret + __builtin_clz(v);
|
||||
#else
|
||||
#elif TORRENT_HAS_SSE && defined _MSC_VER
|
||||
DWORD pos;
|
||||
_BitScanReverse(&pos, v);
|
||||
return ret + 31 - pos;
|
||||
#endif
|
||||
#else
|
||||
// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious
|
||||
static const int MultiplyDeBruijnBitPosition[32] =
|
||||
|
|
|
@ -57,8 +57,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <unordered_set>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
@ -67,10 +65,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#if TORRENT_USE_I2P
|
||||
#include "libtorrent/parse_url.hpp"
|
||||
#endif
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
|
|
@ -114,7 +114,6 @@ test-suite libtorrent :
|
|||
test_create_torrent.cpp
|
||||
test_packet_buffer.cpp
|
||||
test_timestamp_history.cpp
|
||||
test_sha1_hash.cpp
|
||||
test_bloom_filter.cpp
|
||||
test_identify_client.cpp
|
||||
test_merkle.cpp
|
||||
|
@ -160,6 +159,7 @@ test-suite libtorrent :
|
|||
test_utf8.cpp
|
||||
]
|
||||
|
||||
[ run test_sha1_hash.cpp ]
|
||||
[ run test_receive_buffer.cpp ]
|
||||
[ run test_alert_manager.cpp ]
|
||||
[ run test_direct_dht.cpp ]
|
||||
|
@ -265,7 +265,12 @@ alias osx-tests :
|
|||
test_time_critical
|
||||
test_pex
|
||||
test_priority
|
||||
;
|
||||
;
|
||||
|
||||
explicit win-tests ;
|
||||
|
||||
alias arm-tests :
|
||||
test_sha1_hash
|
||||
;
|
||||
|
||||
explicit arm-tests ;
|
||||
|
|
|
@ -143,5 +143,8 @@ TORRENT_TEST(count_leading_zeroes)
|
|||
std::fprintf(stderr, "%s\n", t.first);
|
||||
TEST_EQUAL(to_hash(t.first).count_leading_zeroes(), t.second);
|
||||
}
|
||||
}
|
||||
|
||||
#if TORRENT_HAS_ARM && !TORRENT_HAS_BUILTIN_CLZ
|
||||
#error "expected built-in clz for arm architecture"
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue