[LLVMbugs] [Bug 6479] New: zero extending i1 to i32 on x86

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 3 07:25:14 PST 2010


           Summary: zero extending i1 to i32 on x86
           Product: new-bugs
           Version: 2.6
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: pete.cooper at gmail.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=4377)
 --> (http://llvm.org/bugs/attachment.cgi?id=4377)
intermediate test file

This curently generates a redundant zero extension as 

movzbl    %al, %eax
andl    $1, %eax

which can just be 

andl    $1, %eax

I've written a new pattern for X86InstrInfo.td which removes the unused mov but
i wasn't sure where in that file to put it so i'm not attaching it as a patch

def : Pat<(i32 (and (i32 (anyext GR8 :$src)), (i32 1))),
          (AND32ri (SUBREG_TO_REG (i32 0), GR8:$src, x86_subreg_8bit), 1)>;

Can someone please verify if i've done the right thing here.  I get the right
result which is always a good start.  Also, i've only seen this case (mask with
1) be output, but would it be better to match any constant in the 1-255 range
here, and if it is worth it, could someone please tell me how that would be

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