Skip to content

Commit be686e6

Browse files
committed
Address review and fix test
1 parent b8420ff commit be686e6

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

site/source/docs/porting/simd.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,9 @@ The following table highlights the availability and expected performance of diff
12271227
* - _mm_i64gather_epi64
12281228
- ❌ scalarized
12291229

1230-
All the 128-bit wide instructions from AVX2 instruction set are listed. Only a small part of the 256-bit AVX2 instruction set are listed, most of the 256-bit wide AVX2 instructions are emulated by two 128-bit wide instructions.
1230+
All the 128-bit wide instructions from AVX2 instruction set are listed.
1231+
Only a small part of the 256-bit AVX2 instruction set are listed, most of the
1232+
256-bit wide AVX2 instructions are emulated by two 128-bit wide instructions.
12311233

12321234
======================================================
12331235
Compiling SIMD code targeting ARM NEON instruction set

test/sse/test_avx2.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ void test_statisticsa(void) {
262262
Ret_M256i_M256i(__m256i, _mm256_avg_epu8);
263263
}
264264

265-
void test_shift(void) {
265+
// Split test_shift into two functions to reduce memory consumption
266+
void test_shift1(void) {
266267
Ret_M256i_Tint(__m256i, _mm256_slli_si256);
267268
Ret_M256i_Tint(__m256i, _mm256_bslli_epi128);
268269

@@ -277,7 +278,9 @@ void test_shift(void) {
277278
Ret_M256i_Tint(__m256i, _mm256_srai_epi32);
278279
Ret_M256i_M128i(__m256i, _mm256_sra_epi16);
279280
Ret_M256i_M128i(__m256i, _mm256_sra_epi32);
281+
}
280282

283+
void test_shift2(void) {
281284
Ret_M256i_Tint(__m256i, _mm256_srli_si256);
282285
Ret_M256i_Tint(__m256i, _mm256_bsrli_epi128);
283286

@@ -302,6 +305,11 @@ void test_shift(void) {
302305
Ret_M256i_M256i(__m256i, _mm256_srlv_epi64);
303306
}
304307

308+
void test_shift(void) {
309+
test_shift1();
310+
test_shift2();
311+
}
312+
305313
int main() {
306314
assert(numInterestingFloats % 8 == 0);
307315
assert(numInterestingInts % 8 == 0);

test/test_other.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9527,7 +9527,8 @@ def test_standalone_system_headers(self):
95279527
print('header: ' + header)
95289528
# These headers cannot be included in isolation.
95299529
# e.g: error: unknown type name 'EGLDisplay'
9530-
if header in ['eglext.h', 'SDL_config_macosx.h', 'glext.h', 'gl2ext.h']:
9530+
# Don't include avxintrin.h and avx2inrin.h directly, include immintrin.h instead
9531+
if header in ['eglext.h', 'SDL_config_macosx.h', 'glext.h', 'gl2ext.h', 'avxintrin.h', 'avx2intrin.h']:
95319532
continue
95329533
# These headers are C++ only and cannot be included from C code.
95339534
# But we still want to check they can be included on there own without
@@ -9541,7 +9542,9 @@ def test_standalone_system_headers(self):
95419542
if directory and directory != 'compat':
95429543
header = f'{directory}/{header}'
95439544
inc = f'#include <{header}>\n__attribute__((weak)) int foo;\n'
9544-
cflags = ['-Werror', '-Wall', '-pedantic', '-mavx', '-msimd128', '-msse3']
9545+
cflags = ['-Werror', '-Wall', '-pedantic', '-msimd128', '-msse4']
9546+
if header == 'immintrin.h':
9547+
cflags.append('-mavx2')
95459548
if cxx_only:
95469549
create_file('a.cxx', inc)
95479550
create_file('b.cxx', inc)

0 commit comments

Comments
 (0)