]> granicus.if.org Git - llvm/commitdiff
[GlobalISel] Add a G_FNEARBYINT opcode
authorJessica Paquette <jpaquette@apple.com>
Thu, 25 Apr 2019 16:36:03 +0000 (16:36 +0000)
committerJessica Paquette <jpaquette@apple.com>
Thu, 25 Apr 2019 16:36:03 +0000 (16:36 +0000)
For eventually selecting llvm.nearbyint. Equivalent to the SelectionDAG
nearbyint node.

Update legalizer-info-validation.mir.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359201 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 3513a43478457ae16cf19960815ec814ed325111..cce59c37308b94e16af306ed2d7c14130496b19d 100644 (file)
@@ -539,6 +539,9 @@ HANDLE_TARGET_OPCODE(G_FFLOOR)
 /// Floating point round to next integer.
 HANDLE_TARGET_OPCODE(G_FRINT)
 
+/// Floating point round to nearest integer.
+HANDLE_TARGET_OPCODE(G_FNEARBYINT)
+
 /// Generic AddressSpaceCast.
 HANDLE_TARGET_OPCODE(G_ADDRSPACE_CAST)
 
index ede632b33859a494f8853e5fc5249b4a986c025d..1900870d6da779ec17ec47816707d1ad3c340d31 100644 (file)
@@ -599,6 +599,13 @@ def G_FRINT : GenericInstruction {
   let hasSideEffects = 0;
 }
 
+// Floating point round to the nearest integer.
+def G_FNEARBYINT : GenericInstruction {
+  let OutOperandList = (outs type0:$dst);
+  let InOperandList = (ins type0:$src1);
+  let hasSideEffects = 0;
+}
+
 //------------------------------------------------------------------------------
 // Opcodes for LLVM Intrinsics
 //------------------------------------------------------------------------------
index a6eb3b58f81054b57f6a8798a925087e4b5c77ca..d355c948fd3cf2b012e54fa90b17f5d11b58a17c 100644 (file)
@@ -96,6 +96,7 @@ def : GINodeEquiv<G_FABS, fabs>;
 def : GINodeEquiv<G_FSQRT, fsqrt>;
 def : GINodeEquiv<G_FFLOOR, ffloor>;
 def : GINodeEquiv<G_FRINT, frint>;
+def : GINodeEquiv<G_FNEARBYINT, fnearbyint>;
 
 // 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 c4a0af07a5d809f6d5df6a915c505262fe63bfc8..570d1f35a8a581521bb5d6a0a939294dd7f8acc9 100644 (file)
 #
 # DEBUG-NEXT: G_FRINT (opcode {{[0-9]+}}): 1 type index
 # DEBUG: .. type index coverage check SKIPPED: user-defined predicate detected
+#
+# DEBUG-NEXT: G_FNEARBYINT (opcode {{[0-9]+}}): 1 type index
+# DEBUG: .. type index coverage check SKIPPED: no rules defined
 
 # CHECK-NOT: ill-defined