<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 --- - PowerPC fast isel little endian issue with FP to INT conversion"
   href="https://llvm.org/bugs/show_bug.cgi?id=26180">26180</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PowerPC fast isel little endian issue with FP to INT conversion
          </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: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>anton@samba.org
          </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>I hit an issue when bootstrapping rust. It boils down to:

    600c:       5e 0e 20 fc     fctidz  f1,f1
    6010:       70 00 21 d8     stfd    f1,112(r1)
    6014:       74 00 81 80     lwz     r4,116(r1)

We load the wrong 4 bytes in little endian. A testcase:

define i32 @bad(double %x) {
  %1 = fptoui double %x to i32
  ret i32 %1
}

I struggled to reproduce this at first. POWER5 and later support fctiwz, and
looks like fctwiz writes the result twice:

f1             50000    (raw 0x40e86a0000000000)
...
fctiwuz f1,f1
...
f1             1.060997895729669e-309   (raw 0x0000c3500000c350)

So it seems we get lucky. I also need to work out why rust is emitting fctidz
and not the newer fctiwz, might be an LLVM initialization issue.</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>