[LLVMbugs] [Bug 11659] New: [CBE] bugs in CWriter::visitShuffleVectorInst (with patch)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 27 12:19:18 PST 2011


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

             Bug #: 11659
           Summary: [CBE] bugs in CWriter::visitShuffleVectorInst (with
                    patch)
           Product: new-bugs
           Version: trunk
          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 7808
  --> http://llvm.org/bugs/attachment.cgi?id=7808
path to fix bug

The implementation of that method implicitly assumes that the vector widths of
the shufflevector operands are half the result vector width, though this isn't
necessarily the case.

For example, if one runs "llc -march=c" on this code:

define void @foo(<4 x float> * %a, <4 x float> * %b, <2 x float> * %r) {
  %va = load <4 x float> * %a
  %vb = load <4 x float> * %b
  %s = shufflevector <4 x float> %va, <4 x float> %vb,
         <2 x i32> <i32 0, i32 4>
  store <2 x float> %s, <2 x float> * %r
  ret void
}

Then the current c backend generates the following for the shuffle (it
incorrectly thinks that the 4 index is out of bounds):

  *llvm_cbe_r = ((float  __attribute__((vector_size(8 ))) ){ ((float
*)(&llvm_cbe_va))[0],  0/*undef*/ });

With the attached patch, it generates the following, which is correct:

  *llvm_cbe_r = ((float  __attribute__((vector_size(8 ))) ){ ((float
*)(&llvm_cbe_va))[0], ((float *)(&llvm_cbe_vb))[0]});

-- 
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