[X86] Add back fmaddsub intrinsics to work towards fixing the strict fp implementation
authorCraig Topper <craig.topper@intel.com>
Mon, 24 Feb 2020 20:06:55 +0000 (12:06 -0800)
committerCraig Topper <craig.topper@intel.com>
Mon, 24 Feb 2020 20:07:21 +0000 (12:07 -0800)
commit727328433ad61b8c7acdd4d63e73241303a6beb7
treea94a423c251373e10ff2c22c58081f46a022a28e
parent4135077e2694435d675e64ff95f167b4e27ba5c7
[X86] Add back fmaddsub intrinsics to work towards fixing the strict fp implementation

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.

Differential Revision: https://reviews.llvm.org/D74268
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