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

            Bug ID: 110741
           Summary: vec_ternarylogic intrinsic generates incorrect code on
                    POWER10 target when compiled with GCC
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: john_platts at hotmail dot com
  Target Milestone: ---

Created attachment 55582
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55582&action=edit
POWER10 ternary logic test program

The vec_ternarylogic intrinsic generates incorrect code when compiled with GCC.

The bug does not occur when vec_ternarylogic is compiled with Clang.

The attached ppc10_ternary_logic_tester_071923.cpp program needs to be compiled
with the -mcpu=power10 compiler option.

Here is the expected output when running the compiled version of the attached
ppc10_ternary_logic_tester_071923.cpp program:
$./ppc10_ternary_logic_tester_071923 0xD8 0x6C 0x56 0xB6
VSXTernaryLogic(0xd8, 0x6c, 0x56, 182) = 0xffffffffffffff3d

Here is the actual output when running the attached
ppc10_ternary_logic_tester_071923.cpp program that is compiled with a version
of GCC that has the compiler bug (if it is not compiled with the
-DUSE_INLINE_ASM_VSX_TERNLOG option):
$./ppc10_ternary_logic_tester_071923 0xD8 0x6C 0x56 0xB6
VSXTernaryLogic(0xd8, 0x6c, 0x56, 182) = 0xffffffffffffffff

If the ppc10_ternary_logic_tester_071923.cpp program is compiled with the
-DUSE_INLINE_ASM_VSX_TERNLOG option with GCC, then the expected output is
generated as inline assembly is used instead of the vec_ternarylogic intrinsic.

Another snippet that shows the incorrect code being generated for the
vec_ternarylogic intrinsic on POWER10 with GCC can be found at
https://godbolt.org/z/3666bacxs

Reply via email to