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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to