github: gcc: Test i386 Interlocked functions Add a step in the testcases-gcc job that compiles and links the t_intrinc test with -march=i386 using the i686 GCC cross-compiler, and then runs the test. Without kernel32 fallback in intrin-impl.h, GCC correctly refuses to inline __sync_* builtins on i386 (no CMPXCHG or XADD) and instead emits calls to library helpers that do not exist and fail to link. Even with kernel32 fallback, the final linked binary contains i486+ instructions from the CRT startup code, which is built for i686. Building t_intrinc with -march doesn't change this. However, this does not prevent the test from running on the CI runner, which has a modern x86 CPU that supports these instructions. Signed-off-by: Jaeden Amero <jaeden@patater.com> Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f5158a..2e0d7b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml
@@ -712,6 +712,12 @@ make -j$(nproc) install make -j$(nproc) check -k -O --no-print-directory TESTS= make -j$(nproc) check -k -O --no-print-directory || { cat testcases/test-suite.log; exit 1; } + - name: Test i386 Interlocked functions + if: matrix.arch == 'i686' + run: | + export PATH=/gcc-mingw/bin:$PATH + ${{matrix.arch}}-w64-mingw32-gcc -std=c99 -march=i386 -o t_intrinc.exe mingw-w64-crt/testcases/t_intrinc.c + ./t_intrinc.exe - name: Build and test winpthreads run: | export PATH=/gcc-mingw/bin:$PATH