This is an archive of the discontinued LLVM Phabricator instance.

[X86] Lowering FMA intrinsics to native IR (LLVM part)
ClosedPublic

Authored by tkrupa on May 28 2018, 1:23 AM.

Details

Summary

Suuport for Clang lowering of fused intrinsics. This patch:

  1. Removes bindings to clang fma intrinsics.
  2. Introduces new LLVM unmasked intrinsics with rounding mode:

int_x86_avx512_vfmadd_pd_512
int_x86_avx512_vfmadd_ps_512
int_x86_avx512_vfmaddsub_pd_512
int_x86_avx512_vfmaddsub_ps_512
supported with a new intrinsic type (INTR_TYPE_3OP_RM).

  1. Introduces new x86 fmaddsub/fmsubadd folding.
  2. Introduces new tests for code emitted by sequentions introduced in Clang part.

Corresponding Clang patch: D47444

Diff Detail

Event Timeline

tkrupa created this revision.May 28 2018, 1:23 AM
craig.topper added inline comments.May 28 2018, 11:32 AM
lib/Target/X86/X86ISelLowering.cpp
30595

Can we detect this pattern after the ISD::FMA+FNEG has been turned into X86ISD::FMSUB? It might simplify the code a little.

You're going to hate me for this, but we could do with -fast-isel test files covering the builtin test files codegen on the clang side

tkrupa updated this revision to Diff 148838.May 28 2018, 1:15 PM
tkrupa marked an inline comment as done.

You're going to hate me for this, but we could do with -fast-isel test files covering the builtin test files codegen on the clang side

Not really, thankfully these are all auto-generated from clang tests. So do you mean we could do with fast-isel tests instead of these or in addition to these?

You're going to hate me for this, but we could do with -fast-isel test files covering the builtin test files codegen on the clang side

Not really, thankfully these are all auto-generated from clang tests. So do you mean we could do with fast-isel tests instead of these or in addition to these?

We need both please - the fast-isel tests are there to ensure non-optimized builds do not deviate too much from what coders were trying to accomplish with intrinsics - which is quite different in purpose to the regular dag tests which concern optimization combines.

tkrupa updated this revision to Diff 148881.May 29 2018, 4:35 AM

Added fast-isel tests - there are some XORs/MOVs which aren't combined but it doesn't look terrible overall.

This revision is now accepted and ready to land.May 29 2018, 10:35 AM
This revision was automatically updated to reflect the committed changes.