summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorVolkan Keles <vkeles@apple.com>2018-03-05 22:31:55 +0000
committerVolkan Keles <vkeles@apple.com>2018-03-05 22:31:55 +0000
commit2bc42e90ed147c45a1f0c74b61bb9f6176dbb9ef (patch)
tree11cda8054bf6a22e9ef55ff4aa0f428aa1cc2b5d /llvm/include
parent82daad31fea78a9c75fcbbe79ce7070e642640d0 (diff)
downloadbcm5719-llvm-2bc42e90ed147c45a1f0c74b61bb9f6176dbb9ef.tar.gz
bcm5719-llvm-2bc42e90ed147c45a1f0c74b61bb9f6176dbb9ef.zip
GlobalISel: IRTranslate llvm.fabs.* intrinsic
Summary: Fabs is a common floating-point operation, especially for some expansions. This patch adds a new generic opcode for llvm.fabs.* intrinsic in order to avoid building/matching this intrinsic. Reviewers: qcolombet, aditya_nandakumar, dsanders, rovka Reviewed By: aditya_nandakumar Subscribers: kristof.beyls, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D43864 llvm-svn: 326749
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h5
-rw-r--r--llvm/include/llvm/CodeGen/TargetOpcodes.def3
-rw-r--r--llvm/include/llvm/Target/GenericOpcodes.td6
3 files changed, 14 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h b/llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
index e3302217696..2f31cab4ce8 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
@@ -287,6 +287,11 @@ m_GFPTrunc(const SrcTy &Src) {
}
template <typename SrcTy>
+inline UnaryOp_match<SrcTy, TargetOpcode::G_FABS> m_GFabs(const SrcTy &Src) {
+ return UnaryOp_match<SrcTy, TargetOpcode::G_FABS>(Src);
+}
+
+template <typename SrcTy>
inline UnaryOp_match<SrcTy, TargetOpcode::COPY> m_Copy(SrcTy &&Src) {
return UnaryOp_match<SrcTy, TargetOpcode::COPY>(std::forward<SrcTy>(Src));
}
diff --git a/llvm/include/llvm/CodeGen/TargetOpcodes.def b/llvm/include/llvm/CodeGen/TargetOpcodes.def
index d3e8483798a..30168077370 100644
--- a/llvm/include/llvm/CodeGen/TargetOpcodes.def
+++ b/llvm/include/llvm/CodeGen/TargetOpcodes.def
@@ -427,6 +427,9 @@ HANDLE_TARGET_OPCODE(G_SITOFP)
/// Generic unsigned-int to float conversion
HANDLE_TARGET_OPCODE(G_UITOFP)
+/// Generic FP absolute value.
+HANDLE_TARGET_OPCODE(G_FABS)
+
/// Generic pointer offset
HANDLE_TARGET_OPCODE(G_GEP)
diff --git a/llvm/include/llvm/Target/GenericOpcodes.td b/llvm/include/llvm/Target/GenericOpcodes.td
index 28c90bf2276..1af6a9ab9f2 100644
--- a/llvm/include/llvm/Target/GenericOpcodes.td
+++ b/llvm/include/llvm/Target/GenericOpcodes.td
@@ -378,6 +378,12 @@ def G_UITOFP : GenericInstruction {
let hasSideEffects = 0;
}
+def G_FABS : GenericInstruction {
+ let OutOperandList = (outs type0:$dst);
+ let InOperandList = (ins type0:$src);
+ let hasSideEffects = 0;
+}
+
//------------------------------------------------------------------------------
// Floating Point Binary ops.
//------------------------------------------------------------------------------
OpenPOWER on IntegriCloud