<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 --- - Large lookup table could be packed into 64-bit integer"
   href="https://llvm.org/bugs/show_bug.cgi?id=30531">30531</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Large lookup table could be packed into 64-bit integer
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>skvadrik@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider the following source code (1.c):

int f(char c)
{
    switch (c) {
        case 'A'...'Z':
        case 'a'...'z':
            return 1;
        default:
            return 0;
    }
}

$ clang-3.8 -O2 -c 1.c -o 1.o && objdump -dr 1.o`

0000000000000000 <f>:
   0:   83 c7 bf                add    $0xffffffbf,%edi
   3:   83 ff 39                cmp    $0x39,%edi
   6:   77 0b                   ja     13 <f+0x13>
   8:   48 63 c7                movslq %edi,%rax
   b:   8b 04 85 00 00 00 00    mov    0x0(,%rax,4),%eax
                        e: R_X86_64_32S .rodata
  12:   c3                      retq   
  13:   31 c0                   xor    %eax,%eax
  15:   c3                      retq

Clang generates 232-byte lookup table in .rodata. For comparison, gcc packs
lookup table in one 64-bit integer:

$ gcc-5.4.0 -O2 -c 1.c -o 1.o && objdump -dr 1.o`

0000000000000000 <f>:
   0:   8d 4f bf                lea    -0x41(%rdi),%ecx
   3:   31 c0                   xor    %eax,%eax
   5:   80 f9 39                cmp    $0x39,%cl
   8:   77 18                   ja     22 <f+0x22>
   a:   b8 01 00 00 00          mov    $0x1,%eax
   f:   48 ba ff ff ff 03 ff    movabs $0x3ffffff03ffffff,%rdx
  16:   ff ff 03 
  19:   48 d3 e0                shl    %cl,%rax
  1c:   48 85 d0                test   %rdx,%rax
  1f:   0f 95 c0                setne  %al
  22:   0f b6 c0                movzbl %al,%eax
  25:   c3                      retq</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>