[LLVMbugs] [Bug 8365] New: Output of "llc -filetype=obj" != llvm-mc

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 12 12:44:31 PDT 2010


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

           Summary: Output of "llc -filetype=obj" != llvm-mc
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu


This is a fun case. When doing the codegen of

define i64 @bra(i32 %zed) nounwind {
 %t1 = zext i32 %zed to i64
 %t2 = and i64  %t1, 4294967232
 ret i64 %t2
}

The isel dag will contain the i64 constant 4294967232. During the selection we
decide to use a 32 "and" and produce a i32 target constant of -64.
Unfortunately, we fail to noticed that it will fit in 8 bits and select an
AND32ri.

The produced assembly is

        andl    $-64, %edi              # encoding:
[0x81,0xe7,0xc0,0xff,0xff,0xff]
        movl    %edi, %eax              # encoding: [0x89,0xf8]
        ret                             # encoding: [0xc3]

When this gets passed to MC it finds that -64 fits in 8 bits and uses
a AND32ri8.

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