<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 --- - Emit cmpxchg16b loops for i128 atomicrmw instructions when mattr=+cx16"
   href="http://llvm.org/bugs/show_bug.cgi?id=17611">17611</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Emit cmpxchg16b loops for i128 atomicrmw instructions when mattr=+cx16
          </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>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>Backend: X86
          </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:
define void @test(i128* %a) nounwind {
entry:
  %0 = cmpxchg i128* %a, i128 1, i128 1 seq_cst
  %1 = atomicrmw xchg i128* %a, i128 1 seq_cst
  %2 = atomicrmw add i128* %a, i128 1 seq_cst
  %3 = atomicrmw sub i128* %a, i128 1 seq_cst
  %4 = atomicrmw and i128* %a, i128 1 seq_cst
  %5 = atomicrmw nand i128* %a, i128 1 seq_cst
  %6 = atomicrmw or i128* %a, i128 1 seq_cst
  %7 = atomicrmw xor i128* %a, i128 1 seq_cst
  ret void
}

compile with:
~/llvm/build/bin/llc /var/tmp/PR17481.ll -o - -mattr=+cx16 -march=x86-64
-mcpu=corei7

note that we are emitting libcalls for atomicrmw instructions instead of doing
something like:
.L6:    
        movq    %rax, %rbx
        movq    %rdx, %rcx
        orq     $1, %rbx
        lock cmpxchg16b -16(%rsp)
        jne     .L6</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>