[LLVMbugs] [Bug 13298] New: [AVX2] gather intrinsic doesn't account for zeroing of mask register

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jul 8 17:22:18 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13298

             Bug #: 13298
           Summary: [AVX2] gather intrinsic doesn't account for zeroing of
                    mask register
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: matt at pharr.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8849
  --> http://llvm.org/bugs/attachment.cgi?id=8849
bitcode

It turns out that the AVX2 gather instructions zero-out the mask register
passed to them.  (See the pseudo-code in the Intel AVX ISA reference;
unfortunately this fact isn't called out more clearly in the documentation.) 
This doesn't seem to be accounted for in the gather intrinsics in LLVM, as the
attached test program shows.

The test (which can be run on current systems with the freely-available Intel
Software Development Emulator) as below, shows this behavior--after doing a
gather, it stores the value of the mask to memory and prints it, giving the
following:

% llc -mattr=+avx2 g.ll -o g.s && clang g.cpp g.s -o g && ~/sde/sde -- g
mask[0] = 0x0
mask[1] = 0x0
mask[2] = 0x0
mask[3] = 0x0
mask[4] = 0x0
mask[5] = 0x0
mask[6] = 0x0
mask[7] = 0x0

However, if the call to the gather intrinsic is removed, the printed mask is as
expected:

% llc -mattr=+avx2 g.ll -o g.s && clang g.cpp g.s -o g && ~/sde/sde -- g   
mask[0] = 0xffffffff
mask[1] = 0xffffffff
mask[2] = 0x0
mask[3] = 0xffffffff
mask[4] = 0xffffffff
mask[5] = 0xffffffff
mask[6] = 0xffffffff
mask[7] = 0x0

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list