Skip to content

Commit dc14c6e

Browse files
committed
Code improvements
1 parent 9d46c28 commit dc14c6e

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

.github/workflows/linux.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,17 @@ jobs:
120120
run: cmake --build _build
121121
- name: Test
122122
run: |
123-
# Set CPU feature test expectations
124-
# Assuming the runner always has AVX (independent of compilation option)
123+
# Set CPU feature test expectations, 0 is explicit absence of the feature
125124
export XSIMD_TEST_CPU_ASSUME_NEON64="0"
126-
export XSIMD_TEST_CPU_ASSUME_SSE4_2="1"
127-
export XSIMD_TEST_CPU_ASSUME_AVX="1"
128-
export XSIMD_TEST_CPU_ASSUME_MANUFACTURER="intel,amd"
129125
cd _build/test
130126
if echo '${{ matrix.sys.flags }}' | grep -q 'avx512' ; then
131-
export XSIMD_TEST_CPU_ASSUME_AVX512F="1"
127+
# Running with emulation, must have AVX512, lower tier are checked by implications in tests
128+
export XSIMD_TEST_CPU_ASSUME_AVX512F="1"
132129
../../sde-external-9.48.0-2024-11-25-lin/sde64 -tgl -- ./test_xsimd
133130
else
134-
export XSIMD_TEST_CPU_ASSUME_AVX512F=$(grep -q 'avx512f' /proc/cpuinfo && echo "1" || echo "0")
131+
export XSIMD_TEST_CPU_ASSUME_SSE4_2=$(grep -q 'sse4_2' /proc/cpuinfo && echo "1" || echo "0")
132+
export XSIMD_TEST_CPU_ASSUME_AVX=$(grep -q 'avx' /proc/cpuinfo && echo "1" || echo "0")
133+
export XSIMD_TEST_CPU_ASSUME_AVX512F=$(grep -q 'avx512f' /proc/cpuinfo && echo "1" || echo "0")
134+
export XSIMD_TEST_CPU_ASSUME_MANUFACTURER="intel,amd"
135135
./test_xsimd
136136
fi

test/test_cpu_features.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ namespace detail
2424
{
2525
void check_env_flag(const char* env_var, const char* feature_name, bool actual)
2626
{
27-
const char* val = std::getenv(env_var);
28-
if (val)
27+
if (const char* val = std::getenv(env_var))
2928
{
30-
// Doctest struggles with string litteras and const char *
29+
// Doctest struggles with string literals and const char *
30+
// TODO(c++20): use std::format
3131
auto msg = std::string(env_var) + " = " + val + ", " + feature_name + " = " + (actual ? "true" : "false");
3232
INFO(msg);
3333
CHECK_EQ(actual, val[0] == '1');

0 commit comments

Comments
 (0)