Skip to content

Commit 4f6601b

Browse files
authored
Merge pull request #1325 from Andreas-Krebbel/s390x-fixes
IBM Z (s390x) fixes
2 parents 5680ea9 + ac9a498 commit 4f6601b

7 files changed

Lines changed: 26 additions & 7 deletions

File tree

.github/workflows/cross-s390x.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
target:
14-
- { platform: 's390x', dir: 's390x-linux-gnu', flags: '-mzvector -march=z14', full: 'OFF' }
14+
- { platform: 's390x', dir: 's390x-linux-gnu', full: 'OFF' }
1515
sys:
1616
- { compiler: 'gcc', version: '14' }
1717
steps:
@@ -34,15 +34,22 @@ jobs:
3434
uses: actions/checkout@v6
3535
- name: Setup
3636
run: |
37-
cmake -B _build \
37+
cmake -B build/ \
3838
-DBUILD_TESTS=ON -DDOWNLOAD_DOCTEST=ON \
3939
-DBUILD_BENCHMARK=${{ matrix.target.full }} -DBUILD_EXAMPLES=${{ matrix.target.full }} \
4040
-DCMAKE_BUILD_TYPE=Release \
4141
-DCMAKE_C_FLAGS="${{ matrix.target.flags }}" \
4242
-DCMAKE_CXX_FLAGS="${{ matrix.target.flags }}" \
4343
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.github/toolchains/${{ matrix.sys.compiler }}-${{ matrix.target.dir }}.cmake
4444
- name: Build
45-
run: cmake --build _build --verbose -j1
45+
run: cmake --build build/ --verbose -j1
4646
- name: Testing xsimd
47-
run: qemu-${{ matrix.target.platform }} -L /usr/${{ matrix.target.dir}}/ ./test/test_xsimd
48-
working-directory: ${{ github.workspace }}/_build
47+
run: |
48+
# Set CPU feature test expectations, 0 is explicit absence of the feature
49+
export XSIMD_TEST_CPU_ASSUME_SSE4_2="0"
50+
export XSIMD_TEST_CPU_ASSUME_NEON64="0"
51+
export XSIMD_TEST_CPU_ASSUME_RVV="0"
52+
export XSIMD_TEST_CPU_ASSUME_VSX="0"
53+
export XSIMD_TEST_CPU_ASSUME_VXE="1"
54+
55+
qemu-${{ matrix.target.platform }} -L /usr/${{ matrix.target.dir}}/ ./build/test/test_xsimd

.github/workflows/linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ jobs:
124124
export XSIMD_TEST_CPU_ASSUME_NEON64="0"
125125
export XSIMD_TEST_CPU_ASSUME_RVV="0"
126126
export XSIMD_TEST_CPU_ASSUME_VSX="0"
127+
export XSIMD_TEST_CPU_ASSUME_VXE="0"
127128
cd _build/test
128129
if echo '${{ matrix.sys.flags }}' | grep -q 'avx512' ; then
129130
# Running with emulation, must have AVX512, lower tier are checked by implications in tests

include/xsimd/config/xsimd_arch.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ namespace xsimd
181181
using arm_arch = typename detail::supported<all_arm_architectures>::type::best;
182182
using power_arch = typename detail::supported<all_power_architectures>::type::best;
183183
using riscv_arch = typename detail::supported<all_riscv_architectures>::type::best;
184+
using s390x_arch = typename detail::supported<all_s390x_architectures>::type::best;
184185
using best_arch = typename supported_architectures::best;
185186

186187
#ifdef XSIMD_DEFAULT_ARCH

include/xsimd/config/xsimd_config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@
538538
+ * Set to 1 if s390x VXE is available at compile-time, to 0 otherwise.
539539
+ * Float vectors have been introduced with VXE included with IBM z14.
540540
+ */
541-
#if defined(__VEC__) && __VEC__ == 10305 && __ARCH__ >= 12
541+
#if defined(__VEC__) && __VEC__ >= 10304 && __ARCH__ >= 12
542542
#define XSIMD_WITH_VXE 1
543543
#else
544544
#define XSIMD_WITH_VXE 0

include/xsimd/config/xsimd_cpu_features.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ namespace xsimd
3737
* @see xsimd::dispatch
3838
* @see xsimd::available_architectures
3939
*/
40-
class cpu_features : public ppc_cpu_features,
40+
class cpu_features : public s390x_cpu_features,
41+
public ppc_cpu_features,
4142
public riscv_cpu_features,
4243
public arm_cpu_features,
4344
public x86_cpu_features

include/xsimd/config/xsimd_cpuid.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ namespace xsimd
8181

8282
const auto cpu = xsimd::cpu_features();
8383

84+
vxe = cpu.vxe();
85+
8486
vsx = cpu.vsx();
8587

8688
rvv128 = cpu.rvv() && (cpu.rvv_size_bytes() >= (128 / 8));

test/test_cpu_features.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,10 @@ TEST_CASE("[cpu_features] ppc features from environment")
176176

177177
CHECK_ENV_FEATURE("XSIMD_TEST_CPU_ASSUME_VSX", cpu.vsx());
178178
}
179+
180+
TEST_CASE("[cpu_features] IBM Z (s390x) features from environment")
181+
{
182+
xsimd::cpu_features cpu;
183+
184+
CHECK_ENV_FEATURE("XSIMD_TEST_CPU_ASSUME_VXE", cpu.vxe());
185+
}

0 commit comments

Comments
 (0)