[LLVMbugs] [Bug 17955] New: LLVM 3.3 misses bitfield optimization

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 15 22:02:24 PST 2013


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

            Bug ID: 17955
           Summary: LLVM 3.3 misses bitfield optimization
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

consider:
struct foo {
  int f_x : 1;
  int f_y : 1;
};

int fun(struct foo *f) {
  return f->f_x || f->f_y;
}

we get:
    movb    (%rdi), %al
    movb    $1, %cl
    testb    $1, %al
    jne    .LBB0_2
    andb    $2, %al
    shrb    %al
    movb    %al, %cl
.LBB0_2:
    movzbl    %cl, %eax
    ret

it would be nicer to get:
    movl    (%rdi), %eax
    andl    $3, %eax

GCC 4.9 gets pretty close.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131116/cdce1188/attachment.html>


More information about the llvm-bugs mailing list