https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110960

            Bug ID: 110960
           Summary: TestSatWidenMulPairwiseAdd in the Google Highway Test
                    suite fails when compiled with GCC 12 or later with
                    the -mcpu=power9 option
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: john_platts at hotmail dot com
  Target Milestone: ---

Here are the steps to reproduce the problem:
1. Clone the Google Highway git repository from
https://github.com/google/highway.git.
2. Create a build directory called hwy_ppc9_gcc12_build in the highway
directory.
3. In the hwy_ppc9_gcc12_build directory, execute the following command:
CC=powerpc64le-linux-gnu-gcc-12 CXX=powerpc64le-linux-g++-12 cmake ..
-DCMAKE_C_COMPILER_TARGET="powerpc64le-linux-gnu"
-DCMAKE_CXX_COMPILER_TARGET="powerpc64le-linux-gnu"
-DCMAKE_C_FLAGS='-mcpu=power9' -DCMAKE_CXX_FLAGS='-mcpu=power9
-DHWY_DISABLED_TARGETS=6918232715082858496 -DHWY_BROKEN_TARGETS=0'
-DHWY_ENABLE_CONTRIB=OFF
4. After the cmake command is executed, execute the "make mul_test" command in
the hwy_ppc9_gcc12_build directory.
5. Execute the ./tests/mul_test program in the hwy_ppc9_gcc12_build directory.

Here is the expected output of the mul_test program:
[==========] Running 9 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 9 tests from HwyMulTestGroup/HwyMulTest
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllMul/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllMul/PPC9 (21 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllMulHigh/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllMulHigh/PPC9 (2 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllMulFixedPoint15/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllMulFixedPoint15/PPC9 (45 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllMulEven/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllMulEven/PPC9 (3 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllMulAdd/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllMulAdd/PPC9 (22 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllWidenMulPairwiseAdd/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllWidenMulPairwiseAdd/PPC9 (3 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllSatWidenMulPairwiseAdd/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllSatWidenMulPairwiseAdd/PPC9 (5
ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllReorderWidenMulAccumulate/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllReorderWidenMulAccumulate/PPC9
(5 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllRearrangeToOddPlusEven/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllRearrangeToOddPlusEven/PPC9 (0
ms)
[----------] 9 tests from HwyMulTestGroup/HwyMulTest (112 ms total)

[----------] Global test environment tear-down
[==========] 9 tests from 1 test suite ran. (117 ms total)
[  PASSED  ] 9 tests.

Here is the actual output of the mul_test program when compiled with GCC 12 and
the -mcpu=power9 options:
[==========] Running 9 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 9 tests from HwyMulTestGroup/HwyMulTest
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllMul/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllMul/PPC9 (11 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllMulHigh/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllMulHigh/PPC9 (3 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllMulFixedPoint15/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllMulFixedPoint15/PPC9 (46 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllMulEven/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllMulEven/PPC9 (1 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllMulAdd/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllMulAdd/PPC9 (15 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllWidenMulPairwiseAdd/PPC9
[       OK ] HwyMulTestGroup/HwyMulTest.TestAllWidenMulPairwiseAdd/PPC9 (4 ms)
[ RUN      ] HwyMulTestGroup/HwyMulTest.TestAllSatWidenMulPairwiseAdd/PPC9


i16x8 expect [0+ ->]:
  0xEB00,0xEA00,0xE900,0xE800,0xE700,0xE600,0xE500,
i16x8 actual [0+ ->]:
  0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,
Abort at
/home/some_user/hwy_ppc9_build_080923/highway/hwy/tests/mul_test.cc:585: PPC9,
i16x8 lane 0 mismatch: expected '0xEB00', got '0x8000'.

Aborted (core dumped)

The TestAllSatWidenMulPairwiseAdd test failure does not occur when
hwy/tests/mul_test.cc is compiled with GCC 11 or Clang 16 with the
"-mcpu=power9 -DHWY_DISABLED_TARGETS=6918232715082858496
-DHWY_BROKEN_TARGETS=0" options.

I have written some test programs to try to reproduce the problem (one test
program that only uses the Altivec intrinsics and another test program that
uses the Google Highway library), and I was not encountering the same failures
with those test programs.

Attached is another test program to try to reproduce the problem, and the
attached test program runs successfully when compiled with GCC 12 with the
-mcpu=power9 option.

Reply via email to