Skip to content

Commit 523896f

Browse files
Andreas-Krebbelserge-sans-paille
authored andcommitted
Add IBM Z (s390x) support
Add support for the IBM Z (s390x) architecture leveraging the GCC and Clang compiler intrinsics which are similar to what is available for IBM Power with the Altivec extension. SIMD hardware is available on IBM Z starting with IBM z13. However, the XSIMD support requires at least IBM z14 to also support float vectors.
1 parent d8c8b95 commit 523896f

13 files changed

Lines changed: 1018 additions & 2 deletions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
set(CMAKE_SYSTEM_PROCESSOR s390x)
2+
set(triple s390x-linux-gnu)
3+
4+
include(${CMAKE_CURRENT_LIST_DIR}/gcc.cmake)

.github/workflows/cross-s390x.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: IBM Z cross-compilation build
2+
on: [push, pull_request]
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
name: '${{ matrix.target.platform }}, ${{ matrix.sys.compiler }} ${{ matrix.sys.version }}'
11+
strategy:
12+
matrix:
13+
target:
14+
- { platform: 's390x', dir: 's390x-linux-gnu', flags: '-mzvector -march=z14', full: 'OFF' }
15+
sys:
16+
- { compiler: 'gcc', version: '14' }
17+
steps:
18+
- name: Setup compiler
19+
if: ${{ matrix.sys.compiler == 'gcc' }}
20+
run: |
21+
sudo apt-get update || exit 1
22+
sudo apt-get -y --no-install-suggests --no-install-recommends install g++-${{ matrix.sys.version }}-${{ matrix.target.dir }} g++-${{ matrix.sys.version }}-multilib cmake || exit 1
23+
sudo update-alternatives --remove-all ${{ matrix.target.dir }}-gcc || true
24+
sudo update-alternatives --remove-all ${{ matrix.target.dir }}-g++ || true
25+
sudo update-alternatives --install /usr/bin/${{ matrix.target.dir }}-gcc ${{ matrix.target.dir }}-gcc /usr/bin/${{ matrix.target.dir }}-gcc-${{ matrix.sys.version }} 20
26+
sudo update-alternatives --install /usr/bin/${{ matrix.target.dir }}-g++ ${{ matrix.target.dir }}-g++ /usr/bin/${{ matrix.target.dir }}-g++-${{ matrix.sys.version }} 20
27+
- name: Setup QEMU
28+
run: |
29+
sudo apt-get --no-install-suggests --no-install-recommends install qemu-user
30+
- name: Setup Ninja
31+
run: |
32+
sudo apt-get install ninja-build
33+
- name: Checkout xsimd
34+
uses: actions/checkout@v6
35+
- name: Setup
36+
run: |
37+
cmake -B _build \
38+
-DBUILD_TESTS=ON -DDOWNLOAD_DOCTEST=ON \
39+
-DBUILD_BENCHMARK=${{ matrix.target.full }} -DBUILD_EXAMPLES=${{ matrix.target.full }} \
40+
-DCMAKE_BUILD_TYPE=Release \
41+
-DCMAKE_C_FLAGS="${{ matrix.target.flags }}" \
42+
-DCMAKE_CXX_FLAGS="${{ matrix.target.flags }}" \
43+
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.github/toolchains/${{ matrix.sys.compiler }}-${{ matrix.target.dir }}.cmake
44+
- name: Build
45+
run: cmake --build _build --verbose -j1
46+
- name: Testing xsimd
47+
run: qemu-${{ matrix.target.platform }} -L /usr/${{ matrix.target.dir}}/ ./test/test_xsimd
48+
working-directory: ${{ github.workspace }}/_build

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ ARM | NEON, NEON64, SVE128/256/512 (fixed vector size)
5656
WebAssembly | WASM
5757
powerpc64 | VSX
5858
RISC-V | RISC-V128/256/512 (fixed vector size)
59+
IBM Z (s390x)| VXE (IBM z14)
5960

6061
## Installation
6162

include/xsimd/arch/xsimd_isa.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@
136136
#include "./xsimd_vsx.hpp"
137137
#endif
138138

139+
#if XSIMD_WITH_VXE
140+
#include "./xsimd_vxe.hpp"
141+
#endif
142+
139143
// Must come last to have access to all conversion specializations.
140144
#include "./xsimd_common.hpp"
141145

0 commit comments

Comments
 (0)