[PATCH] D13710: New X86 FMA3*_Int opcodes for scalar FMA intrinsics.

Vyacheslav Klochkov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 16:00:25 PDT 2015


v_klochkov created this revision.
v_klochkov added subscribers: ab, qcolombet, llvm-commits.

This change-set is one in the series of change-sets improving X86-FMA3 optimizations.
Please see (D11370) and (D13269) for more details.

This change-sets adds new X86-FMA3 opcodes that must be used for SCALAR FMA INTRINSICS.
The new FMA*_Int opcodes are similar to existing ADD*_Int, SUB*_Int, MUL*_Int opcodes.

The key difference between FMA* and FMA*_Int opcodes is that FMA*_Int opcodes are handled 
more conservatively. For example, it is illegal to commute 1st and 2nd operands of FMA*_Int 
as such commute transformation would change the upper bits of the intrinsic result which should be taken
from the 1st operand of the FMA intrinsic.

So, this patch fixes the existing problem in LLVM X86 Code-Gen.

The definitions of X86-FMA3 opcodes were simplified a lot. 
Unused or unnecessary template parameters were removed.
Now the definitions look quite similar to definitions of ADD/SUB/MUL opcodes.

Temporarily, the FMA*_Int opcodes are defined as non-commutable.
This constraint was added to reduce the size of the current patch and it will be eliminated
in the next changes very soon.


X86InstrFMA.td:
- Simplified the definitions of scalar FMA3 opcodes by removing the template parameters 
  that were unused or not really necessary.
- Added definitions for FMA3 opcodes generated for scalar FMA instructions.

X86InstrInfo.cpp:
- Added the new FMA*_Int opcodes to MemoryFoldTable3 to enable memory-folding optimization.

fma-intrinsics-ph-213-to-231.ll:
- Added tests for scalar FMA intrinscis. 
  PHI-213-to-231 optimization should not be used for scalar intrinsics.
- Added tests for FNMADD and FNMSUB intrinsics to make the test more complete.

fma-intrinsics-x86.ll:
- Added more test cases to check that 1st and 2nd operands of scalar FMAs generated for intrinsics are not commuted anymore.


http://reviews.llvm.org/D13710

Files:
  llvm/lib/Target/X86/X86InstrFMA.td
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/test/CodeGen/X86/fma-intrinsics-phi-213-to-231.ll
  llvm/test/CodeGen/X86/fma-intrinsics-x86.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13710.37297.patch
Type: text/x-patch
Size: 30105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151013/a78633c6/attachment.bin>


More information about the llvm-commits mailing list