<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - multiply lowering of divide-by-constant doesn't occur on haswell"
   href="https://bugs.llvm.org/show_bug.cgi?id=38649">38649</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>multiply lowering of divide-by-constant doesn't occur on haswell
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jorg.brown@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Source:

struct SecsAndTicks {
  uint64_t seconds;
  uint32_t ticks;
};

SecsAndTicks DivBy4Bill(uint64_t tix) {
  return {tix / 4000000000,
          uint32_t(tix % 4000000000)};
}

x86-64 codegen:
        movq    %rdi, %rax
        shrq    $11, %rax
        movabsq $4835703278458517, %rcx # imm = 0x112E0BE826D695
        mulq    %rcx
        shrq    $9, %rdx
        imull   $-294967296, %edx, %eax # imm = 0xEE6B2800
        subl    %eax, %edi
        movq    %rdx, %rax
        movl    %edi, %edx
        retq

march=haswell codegen:
        movl    $4000000000, %ecx       # imm = 0xEE6B2800
        movq    %rdi, %rax
        shrq    $32, %rax
        je      .LBB0_1
        xorl    %edx, %edx
        movq    %rdi, %rax
        divq    %rcx
        retq
.LBB0_1:
        xorl    %edx, %edx
        movl    %edi, %eax
        divl    %ecx
        retq

See <a href="https://godbolt.org/g/qGTDGN">https://godbolt.org/g/qGTDGN</a> for repro</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>