<html>
    <head>
      <base href="https://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 --- - Optimize bitfield accesses to generate power of 2 load/store"
   href="https://llvm.org/bugs/show_bug.cgi?id=23321">23321</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Optimize bitfield accesses to generate power of 2 load/store
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </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>opt
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>pete.cooper@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>r235528 changed MachineOperand::OpKind from an unsigned char to a bitfield. 
This was to optimize the accesses of the bitfields after it.

We had a struct something like 

struct MachineOperand {
  unsigned char OpKind;
  unsigned int bitfield1 : 1;
  unsigned int bitfield2 : 1;
...
}

Although the 24-bits of bitfields and the unsigned char shared 32-bits of
storage space, the actual accesses to the bitfields were generated as i24
load/store which isn't legal.  This ultimately leads to the backend having to
split the i24 in to i8 and i16 operations.

We should be able to optimize this so that the load/store are done as i32
operations.  Attaching before/after IR which is an unsigned char/bitfield. 
Note that there may be issues with volatility which prevent doing an
optimization here.  That will have to be investigated.  If OpKind was volatile
then folding it in to the bitfields with load/store has the possibility to
change behavior.</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>