[PATCH] D74268: [X86] Add back fmaddsub intrinsics to work towards fixing the strict fp implementation

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 16:58:56 PST 2020


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel, andrew.w.kaylor, kpn, uweigand.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: LLVM.

Previously we emitted an fmadd and a fmadd+fneg and combined them with a shufflevector. But this doesn't follow the correct exception behavior for unselected elements so the backend can't merge them into the fmaddsub/fmsubadd instructions.

This patch restores the the fmaddsub intrinsics so we don't have two arithmetic operations. We lose out on optimization opportunity in the non-strict FP case, but I don't think this is a big loss. If someone gives us a test case we can look into adding instcombine/dagcombine improvements. I'd rather not have the frontend do completely different things for strict and non-strict.

This still has problems because target specific intrinsics don't support strict semantics yet. We also still have all of the problems with masking. But we at least generate the right instruction in constrained mode now.


https://reviews.llvm.org/D74268

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/avx512f-builtins.c
  clang/test/CodeGen/avx512vl-builtins.c
  clang/test/CodeGen/fma-builtins-constrained.c
  clang/test/CodeGen/fma-builtins.c
  clang/test/CodeGen/fma4-builtins.c
  llvm/include/llvm/IR/IntrinsicsX86.td
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/Target/X86/X86IntrinsicsInfo.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74268.243319.patch
Type: text/x-patch
Size: 67549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200208/3ad32761/attachment.bin>


More information about the llvm-commits mailing list