[PATCH] D96614: [AMDGPU][GlobalISel] Transform (fsub (fmul x, y), z) -> (fma x, y, -z)

Mirko Brkusanin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 10:50:24 PDT 2021


mbrkusanin added a comment.

clang-format for CombinerHelper.cpp



================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fma-sub-mul.ll:202
+  %a = fmul half %x, %y
+  %b = fsub half %a, %z
+  ret half %b
----------------
%a and %z should be swapped here, otherwise this is the same test as the one above.

Also combiner fails for this test for -mcpu=gfx900 --denormal-fp-math=preserve-sign.

Same for test above (test_half_sub_mul). It produces correct result only because fsub is replaced by fadd + fneg in legalizer and then is probably matched by one of other combiners that start from fadd.


================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fma-sub-mul.ll:679
+  %a = fmul <4 x double> %x, %y
+  %b = fsub <4 x double> %a, %z
+  ret <4 x double> %b
----------------
Same here, swap %a and %z.


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

https://reviews.llvm.org/D96614



More information about the llvm-commits mailing list