[PATCH] D90901: [DAGCombiner] Don't fold ((fma (fneg X), Y, (fneg Z)) to fneg (fma X, Y, Z))

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 06:07:19 PST 2020


spatel added a comment.

In D90901#2378427 <https://reviews.llvm.org/D90901#2378427>, @steven.zhang wrote:

> Also, target specific test is missing. The powerpc part test change is unexpected as there is already nsz flags there.

+1. The bug(s) appear to be in target-specific code, so we need a minimal test for x86 (and ARM and possibly others) to go with the code fix. IIUC, something like this:

  define double @fneg_fma(double %x, double %y, double %z) {
    %negx = fneg double %x
    %negz = fneg double %z
    %fma = call double @llvm.fma.f64(double %negx, double %y, double %negz)
    %n = fneg double %fma
    ret double %n
  }

Currently, that is transformed to vfmadd213sd, but that's a miscompile. We can simulate that in IR with Alive2:
https://alive2.llvm.org/ce/z/XxwBAJ


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90901



More information about the llvm-commits mailing list