[llvm-bugs] [Bug 26180] New: PowerPC fast isel little endian issue with FP to INT conversion

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jan 17 03:25:45 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26180

            Bug ID: 26180
           Summary: PowerPC fast isel little endian issue with FP to INT
                    conversion
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: anton at samba.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160117/8729a0eb/attachment.html>


More information about the llvm-bugs mailing list