[PATCH] D77564: [PowerPC] Do not attempt to reuse load for 64-bit FP_TO_UINT without FPCVT

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 13:37:54 PDT 2020


sfertile added a comment.

run clang-format, but otherwise for fixing the assertion it LGTM. FWIW I'm not sure the code we produce for the conversion handles negative numbers correctly. For the reduced IR I posted I get:

  # %bb.0:                                # %entry
          addis 3, 2, .LCPI0_0 at toc@ha
          li 4, 1
          lfs 0, .LCPI0_0 at toc@l(3)
          sldi 4, 4, 63
          fsub 2, 1, 0
          fctidz 2, 2
          stfd 2, -8(1)
          fctidz 2, 1
          stfd 2, -16(1)
          ld 3, -8(1)
          ld 5, -16(1)
          fcmpu 0, 1, 0
          xor 3, 3, 4
          bc 12, 0, .LBB0_1
          b .LBB0_2
  .LBB0_1:                                # %entry
          addi 3, 5, 0
  .LBB0_2:                                # %entry
          std 3, -24(1)
          lfd 0, -24(1)
          fcfid 1, 0
          blr

Which I //think// mishandles negative values. I cant produce the same output on powerpc64le so I haven't tested it yet, but will try on AIX64 to see if the assembly works like I think it does.



================
Comment at: llvm/test/CodeGen/PowerPC/pr43976.ll:4
+; RUN:   -ppc-asm-full-reg-names < %s | FileCheck %s
+ at a = dso_local local_unnamed_addr global double 0.000000e+00, align 8
+
----------------
We can reduce the test further and still exercise the assertion:


```
define dso_local double @b(double) local_unnamed_addr {
entry:
  %conv = fptoui double %0 to i64
  %conv1 = sitofp i64 %conv to double
  ret double %conv1
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77564/new/

https://reviews.llvm.org/D77564





More information about the llvm-commits mailing list