[Intrinsic] Add the llvm.umul.fix.sat intrinsic
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Sat, 7 Sep 2019 12:16:14 +0000 (12:16 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Sat, 7 Sep 2019 12:16:14 +0000 (12:16 +0000)
commit5e331e4ce85ad37dca45739846c2a801f06ab573
tree9fd99630a22771b748a2c0d3e6282a55116e4130
parent314893cc4ba05e65da4be26afb21b2fb50eab7b3
[Intrinsic] Add the llvm.umul.fix.sat intrinsic

Summary:
Add an intrinsic that takes 2 unsigned integers with
the scale of them provided as the third argument and
performs fixed point multiplication on them. The
result is saturated and clamped between the largest and
smallest representable values of the first 2 operands.

This is a part of implementing fixed point arithmetic
in clang where some of the more complex operations
will be implemented as intrinsics.

Patch by: leonardchan, bjope

Reviewers: RKSimon, craig.topper, bevinh, leonardchan, lebedev.ri, spatel

Reviewed By: leonardchan

Subscribers: ychen, wuzish, nemanjai, MaskRay, jsji, jdoerfert, Ka-Ka, hiraditya, rjmccall, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D57836

llvm-svn: 371308
22 files changed:
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/ISDOpcodes.h
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/include/llvm/IR/Intrinsics.td
llvm/include/llvm/Target/TargetSelectionDAG.td
llvm/lib/Analysis/VectorUtils.cpp
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/CodeGen/TargetLoweringBase.cpp
llvm/lib/IR/Verifier.cpp
llvm/test/CodeGen/PowerPC/umulfixsat.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/mulfix_combine.ll
llvm/test/CodeGen/X86/umul_fix_sat.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/vector-mulfix-legalize.ll
llvm/test/Transforms/Scalarizer/intrinsics.ll
llvm/test/Verifier/intrinsic-immarg.ll