Skip to content

Commit

Permalink
Add qemu test for LoongArch (#3833)
Browse files Browse the repository at this point in the history
* LoongArch: fix build error with gcc14

With CFLAGS=-Werror, gcc14 outputs errors like below:

In file included from ./codec/common/inc/loongson_intrinsics.h:63,
                 from codec/common/loongarch/mc_horver_lsx.c:46:
In function ‘__lsx_vilvl_h’,
    inlined from ‘McHorVer22WidthEq4_lsx’ at codec/common/loongarch/mc_horver_lsx.c:521:5,
    inlined from ‘McHorVer22WidthEq9_lsx’ at codec/common/loongarch/mc_horver_lsx.c:646:3:
/usr/lib/gcc-cross/loongarch64-linux-gnu/14/include/lsxintrin.h:1916:19: warning: ‘dst6’ may be used uninitialized [-Wmaybe-uninitialized]
 1916 |   return (__m128i)__builtin_lsx_vilvl_h ((v8i16)_1, (v8i16)_2);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
codec/common/loongarch/mc_horver_lsx.c: In function ‘McHorVer22WidthEq9_lsx’:
codec/common/loongarch/mc_horver_lsx.c:486:47: note: ‘dst6’ was declared here
  486 |   __m128i dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
      |                                               ^~~~

Note: errors are truncated because too long.

* Run the unit tests on loongarch using qemu-loongarch64-static
  • Loading branch information
jinboson authored Jan 13, 2025
1 parent 33f7f48 commit e49c095
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ jobs:
- run: CFLAGS=-Werror make -j$(nproc) ARCH=aarch64 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++
- run: qemu-aarch64 -L /usr/aarch64-linux-gnu/ ./codec_unittest

linux-cross-loongarch64:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq gcc-14-loongarch64-linux-gnu g++-14-loongarch64-linux-gnu qemu-user-static
- run: loongarch64-linux-gnu-g++-14 --version
- run: make gmp-bootstrap
- run: make gtest-bootstrap
- run: CFLAGS=-Werror make -j$(nproc) ARCH=loongarch64 CC=loongarch64-linux-gnu-gcc-14 CXX=loongarch64-linux-gnu-g++-14
- run: qemu-loongarch64-static -L /usr/loongarch64-linux-gnu/ ./codec_unittest

macos-cross-arm64:
runs-on: macos-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions codec/common/loongarch/mc_horver_lsx.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void McHorVer22WidthEq4_lsx(const uint8_t *pSrc, int32_t iSrcStride, uint8_t *pD
uint8_t *psrc = (uint8_t*)pSrc - 2;
__m128i src0, src1, src2, src3, src4, src5;
__m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, out0_l, out0_h;
__m128i dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
__m128i dst0, dst1, dst2, dst3, dst4={0}, dst5={0}, dst6={0}, dst7={0};
v8i16 mask1 = {3, 4, 5, 6, 7, 8, 9, 10};
for (int i = 0; i < iHeight; i++) {
DUP4_ARG2(__lsx_vldx,
Expand Down Expand Up @@ -565,7 +565,7 @@ void McHorVer22WidthEq5_lsx(const uint8_t *pSrc, int32_t iSrcStride, uint8_t *pD
uint8_t *psrc = (uint8_t*)pSrc - 2;
__m128i src0, src1, src2, src3, src4, src5;
__m128i tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, out0_l, out0_h;
__m128i dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
__m128i dst0, dst1, dst2, dst3, dst4={0}, dst5={0}, dst6={0}, dst7={0};
v8i16 mask1 = {3, 4, 5, 6, 7, 8, 9, 10};
for (int i = 0; i < iHeight; i++) {
DUP4_ARG2(__lsx_vldx,
Expand Down

0 comments on commit e49c095

Please sign in to comment.