<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - LLVM introduces unneeded shifts in bitfield comparison"
   href="http://llvm.org/bugs/show_bug.cgi?id=17956">17956</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLVM introduces unneeded shifts in bitfield comparison
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david.majnemer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>consider:
struct foo {
  int f_x : 1;
  int f_y : 1;
};

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

we generate:
    movb    (%rdi), %al
    movb    %al, %cl
    shlb    $6, %cl
    sarb    $7, %cl
    shlb    $7, %al
    sarb    $7, %al
    cmpb    %cl, %al
    sete    %al
    movzbl    %al, %eax
    ret

All of those shifts seem superfluous:
    movl    (%rdi), %ecx
    testl    %ecx, %ecx
    sete    %al # set $al to 1 if *f == zero
    cmpl    $3, %ecx
    sete    %cl # set $cl to 1 if *f == 3
    orb    %al, %cl
    movzbl    %cl, %eax</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>