Skip to content

Feature/tentative altivec support #1144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/toolchains/gcc-powerpc64-linux-gnu.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set(CMAKE_SYSTEM_PROCESSOR powerpc64)
set(triple powerpc64-linux-gnu)

include(${CMAKE_CURRENT_LIST_DIR}/gcc.cmake)

5 changes: 5 additions & 0 deletions .github/toolchains/gcc-powerpc64le-linux-gnu.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set(CMAKE_SYSTEM_PROCESSOR powerpc64le)
set(triple powerpc64le-linux-gnu)

include(${CMAKE_CURRENT_LIST_DIR}/gcc.cmake)

File renamed without changes.
44 changes: 44 additions & 0 deletions .github/workflows/cross-ppc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: PowerPC cross-compilation build
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
name: '${{ matrix.target.arch }}, ${{ matrix.sys.compiler }} ${{ matrix.sys.version }}'
strategy:
matrix:
target:
- { platform: 'ppc64le', dir: 'powerpc64le-linux-gnu', flags: '-maltivec -mvsx -mcpu=power10', full: 'OFF' }
- { platform: 'ppc64', dir: 'powerpc64-linux-gnu', flags: '-maltivec -mvsx -mcpu=power10', full: 'OFF' }
sys:
- { compiler: 'gcc', version: '12' }
steps:
- name: Setup compiler
if: ${{ matrix.sys.compiler == 'gcc' }}
run: |
sudo apt-get update || exit 1
sudo apt-get --no-install-suggests --no-install-recommends install g++-${{ matrix.sys.version }}-${{ matrix.target.dir }} g++-${{ matrix.sys.version }}-multilib || exit 1
sudo update-alternatives --remove-all ${{ matrix.target.dir }}-gcc || true
sudo update-alternatives --remove-all ${{ matrix.target.dir }}-g++ || true
sudo update-alternatives --install /usr/bin/${{ matrix.target.dir }}-gcc ${{ matrix.target.dir }}-gcc /usr/bin/${{ matrix.target.dir }}-gcc-${{ matrix.sys.version }} 20
sudo update-alternatives --install /usr/bin/${{ matrix.target.dir }}-g++ ${{ matrix.target.dir }}-g++ /usr/bin/${{ matrix.target.dir }}-g++-${{ matrix.sys.version }} 20
- name: Setup QEMU
run: |
sudo apt-get --no-install-suggests --no-install-recommends install qemu-user
- name: Setup Ninja
run: |
sudo apt-get install ninja-build
- name: Checkout xsimd
uses: actions/checkout@v3
- name: Setup
run: |
mkdir _build
cd _build && cmake .. -DBUILD_TESTS=ON -DDOWNLOAD_DOCTEST=ON -DBUILD_BENCHMARK=${{ matrix.target.full }} -DBUILD_EXAMPLES=${{ matrix.target.full }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="${{ matrix.target.flags }}" -DCMAKE_CXX_FLAGS="${{ matrix.target.flags }}" -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.github/toolchains/${{ matrix.sys.compiler }}-${{ matrix.target.dir }}.cmake
- name: Build
run: cmake --build _build --verbose -j1
- name: Testing xsimd
run: |
qemu-${{ matrix.target.platform }} -cpu power10 -L /usr/${{ matrix.target.dir}}/ ./test/test_xsimd
working-directory: ${{ github.workspace }}/_build
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ ${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_sse3.hpp
${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_sse4_1.hpp
${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_sse4_2.hpp
${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_ssse3.hpp
${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_vsx.hpp
${XSIMD_INCLUDE_DIR}/xsimd/arch/xsimd_sve.hpp
${XSIMD_INCLUDE_DIR}/xsimd/config/xsimd_arch.hpp
${XSIMD_INCLUDE_DIR}/xsimd/config/xsimd_config.hpp
Expand All @@ -70,6 +71,7 @@ ${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_fma3_sse_register.hpp
${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_fma4_register.hpp
${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_common_arch.hpp
${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_register.hpp
${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_vsx_register.hpp
${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_rvv_register.hpp
${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_sse2_register.hpp
${XSIMD_INCLUDE_DIR}/xsimd/types/xsimd_sse3_register.hpp
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ x86 | AVX512BW, AVX512CD, AVX512DQ, AVX512F (gcc7 and higher)
x86 AMD | FMA4
ARM | NEON, NEON64, SVE128/256/512 (fixed vector size)
WebAssembly | WASM
powerpc64 | VSX
RISC-V | RISC-V128/256/512 (fixed vector size)

## Installation
Expand Down
1 change: 1 addition & 0 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ INPUT = ../include/xsimd/types/xsimd_api.hpp \
../include/xsimd/memory/xsimd_aligned_allocator.hpp \
../include/xsimd/types/xsimd_common_arch.hpp \
../include/xsimd/types/xsimd_traits.hpp \
../include/xsimd/types/xsimd_vsx_register.hpp \
../include/xsimd/types/xsimd_avx2_register.hpp \
../include/xsimd/types/xsimd_avx512bw_register.hpp \
../include/xsimd/types/xsimd_avx512cd_register.hpp \
Expand Down
3 changes: 1 addition & 2 deletions include/xsimd/arch/common/xsimd_common_arithmetic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,9 @@ namespace xsimd
{
if (std::is_signed<T>::value)
{
auto mask = (other >> (8 * sizeof(T) - 1));
auto self_pos_branch = min(std::numeric_limits<T>::max() - other, self);
auto self_neg_branch = max(std::numeric_limits<T>::min() - other, self);
return other + select(batch_bool<T, A>(mask.data), self_neg_branch, self_pos_branch);
return other + select(other >= 0, self_pos_branch, self_neg_branch);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/arch/common/xsimd_common_math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ namespace xsimd
template <class A, class T>
XSIMD_INLINE batch<T, A> from_bool(batch_bool<T, A> const& self, requires_arch<common>) noexcept
{
return batch<T, A>(self.data) & batch<T, A>(1);
return batch<T, A>((typename batch<T, A>::register_type)self.data) & batch<T, A>(1);
}

// horner
Expand Down
4 changes: 4 additions & 0 deletions include/xsimd/arch/xsimd_isa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@
#include "./xsimd_wasm.hpp"
#endif

#if XSIMD_WITH_VSX
#include "./xsimd_vsx.hpp"
#endif

// Must come last to have access to all conversion specializations.
#include "./xsimd_common.hpp"

Expand Down
Loading