[LLVMbugs] [Bug 12618] New: [x86] Code generation is wrong: insertElement( v3i1, i1 )

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Apr 22 01:08:58 PDT 2012


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

             Bug #: 12618
           Summary: [x86] Code generation is wrong: insertElement( v3i1,
                    i1 )
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: wuye9036 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Hello guys,

following LLVM ir

define inlinehint <3 x i1> @"Mbool3@@QBB@@QBB@@QBB@@"(i1 %.v0, i1 %.v1, i1
%.v2) {
.body:
  %0 = insertelement <3 x i1> undef, i1 %.v0, i32 0
  %1 = insertelement <3 x i1> %0, i1 %.v1, i32 1
  %2 = insertelement <3 x i1> %1, i1 %.v2, i32 2
  ret <3 x i1> %2
}

generates ASMs:

005400C0  mov         cl,byte ptr [esp+10h]  
005400C4  and         cl,1  
005400C7  mov         eax,dword ptr [esp+4]  
005400CB  mov         byte ptr [eax],cl  
005400CD  mov         cl,byte ptr [esp+0Ch]  
005400D1  and         cl,1  
005400D4  mov         byte ptr [eax],cl  
005400D6  mov         cl,byte ptr [esp+8]  
005400DA  and         cl,1  
005400DD  mov         byte ptr [eax],cl  
005400DF  ret  

And this is not correct. In my opinion, following code would be generated:

005400C0  mov         cl,byte ptr [esp+10h]  
005400C4  and         cl,1  
005400C7  mov         eax,dword ptr [esp+4]  
005400CB  mov         byte ptr [eax+1],cl   ; offset
005400CD  mov         cl,byte ptr [esp+0Ch]  
005400D1  and         cl,1  
005400D4  mov         byte ptr [eax+2],cl  
005400D6  mov         cl,byte ptr [esp+8]  ; offset
005400DA  and         cl,1  
005400DD  mov         byte ptr [eax],cl    ; offset
005400DF  ret  

Am I right?
And another question, why the argument order is +10h +0Ch and +8h rather than
ascending or descending ?

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