<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 --- - wrong code generated for monotonic loads and stores"
   href="https://llvm.org/bugs/show_bug.cgi?id=25171">25171</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wrong code generated for monotonic loads and stores
          </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>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>richard-llvm@metafoo.co.uk
          </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>target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@d = global double 0.000000e+00, align 8

define void @_Z1fv() #0 {
entry:
  %0 = load atomic i64, i64* bitcast (double* @d to i64*) monotonic, align 8
  %1 = bitcast i64 %0 to double
  %add = fadd double %1, 1.000000e+00
  %2 = bitcast double %add to i64
  store atomic i64 %2, i64* bitcast (double* @d to i64*) monotonic, align 8
  ret void
}

attributes #0 = { nounwind uwtable "disable-tail-calls"="false"
"less-precise-fpmad"="false" "no-frame-pointer-elim"="false"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+mmx,+sse,+sse2" "unsafe-fp-math"="false"
"use-soft-float"="false" }


Generates:

_Z1fv:                                  # @_Z1fv
        movsd   .LCPI0_0(%rip), %xmm0   # xmm0 = mem[0],zero
        addsd   (%rip), %xmm0
        movsd   %xmm0, (%rip)
        retq


Instead of loading and storing @d, we load and store over random instructions
within 'f'.</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>