]> granicus.if.org Git - llvm/commitdiff
[GlobalISel] Add a G_FRINT opcode
authorJessica Paquette <jpaquette@apple.com>
Fri, 19 Apr 2019 21:44:16 +0000 (21:44 +0000)
committerJessica Paquette <jpaquette@apple.com>
Fri, 19 Apr 2019 21:44:16 +0000 (21:44 +0000)
Equivalent to SelectionDAG's frint node.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358785 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/TargetOpcodes.def
include/llvm/Target/GenericOpcodes.td
include/llvm/Target/GlobalISel/SelectionDAGCompat.td
test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir

index 661227492784fbfed04124df730a05c26ef36cbd..3513a43478457ae16cf19960815ec814ed325111 100644 (file)
@@ -536,6 +536,9 @@ HANDLE_TARGET_OPCODE(G_FSQRT)
 /// Floating point floor.
 HANDLE_TARGET_OPCODE(G_FFLOOR)
 
+/// Floating point round to next integer.
+HANDLE_TARGET_OPCODE(G_FRINT)
+
 /// Generic AddressSpaceCast.
 HANDLE_TARGET_OPCODE(G_ADDRSPACE_CAST)
 
index e4b452e91b9da9298f064a73d5791a3e7fec147e..ede632b33859a494f8853e5fc5249b4a986c025d 100644 (file)
@@ -592,6 +592,13 @@ def G_FFLOOR : GenericInstruction {
   let hasSideEffects = 0;
 }
 
+// Floating point round to next integer.
+def G_FRINT : GenericInstruction {
+  let OutOperandList = (outs type0:$dst);
+  let InOperandList = (ins type0:$src1);
+  let hasSideEffects = 0;
+}
+
 //------------------------------------------------------------------------------
 // Opcodes for LLVM Intrinsics
 //------------------------------------------------------------------------------
index d6c7c6e7a3906f1ed8c201627f1d52bc9b96f5f4..a6eb3b58f81054b57f6a8798a925087e4b5c77ca 100644 (file)
@@ -95,6 +95,7 @@ def : GINodeEquiv<G_FSIN, fsin>;
 def : GINodeEquiv<G_FABS, fabs>;
 def : GINodeEquiv<G_FSQRT, fsqrt>;
 def : GINodeEquiv<G_FFLOOR, ffloor>;
+def : GINodeEquiv<G_FRINT, frint>;
 
 // Broadly speaking G_LOAD is equivalent to ISD::LOAD but there are some
 // complications that tablegen must take care of. For example, Predicates such
index 88b6d5753dff2d5e99f83ba3b99def50ce607fd7..1e198e4a68340cdb94a4039647318309d44f90d8 100644 (file)
 # DEBUG: .. type index coverage check SKIPPED: user-defined predicate detected
 #
 # DEBUG-NEXT: G_FFLOOR (opcode {{[0-9]+}}): 1 type index
+# DEBUG: .. type index coverage check SKIPPED: user-defined predicate detected
+#
+# DEBUG-NEXT: G_FRINT (opcode 146): 1 type index
 # DEBUG: .. type index coverage check SKIPPED: no rules defined
 
 # CHECK-NOT: ill-defined