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

            Bug ID: 92889
           Summary: GCC-8 considers  the _mm_gf2p8affine_epi64_epi8
                    intrinsic to be symmetric
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drucker.nir at gmail dot com
  Target Milestone: ---

Created attachment 47461
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47461&action=edit
Source file for reproducing the bug

GCC version: gcc-8 (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
Platform: Dell XPS 13 7390 2-in-1 with the 10th Intel(C) Core^TM Generation
(Micro architecture Codename ``Ice Lake''[ICL]) Intel(c) Core^TM i7-1065G7 CPU
1.30GHz.

The source file gfni_bug.c is a stand-alone file for reproducing the bug.
The file prints two vectors that are not supposed to be equal.

To compile use:
Correct compilation: gcc-8 -O3 -march=native gfni_bug.c -DGOOD_TEST=1
Bad compilation:     gcc-8 -O3 -march=native gfni_bug.c

The problem is with the new _mm_gf2p8affine_epi64_epi8 (x86_64 GF-NI)
intrinsic.
When calling 
  OUT = _mm_gf2p8affine_epi64_epi8(A,B,0) 
gcc-8 translates it to assembler in two different ways:
1) vgf2p8affineqb $0x0, A, B, OUT //Good
2) vgf2p8affineqb $0x0, B, A, OUT //Bad

Where only one of these can be correct because the operation is not symmetric.

Thanks,
Nir Drucker

Reply via email to