From: Jessica Paquette Date: Thu, 25 Apr 2019 16:36:03 +0000 (+0000) Subject: [GlobalISel] Add a G_FNEARBYINT opcode X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0dc647b6b952e94e58c969d8d094d99da3e5d86;p=llvm [GlobalISel] Add a G_FNEARBYINT opcode 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 --- diff --git a/include/llvm/Support/TargetOpcodes.def b/include/llvm/Support/TargetOpcodes.def index 3513a434784..cce59c37308 100644 --- a/include/llvm/Support/TargetOpcodes.def +++ b/include/llvm/Support/TargetOpcodes.def @@ -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) diff --git a/include/llvm/Target/GenericOpcodes.td b/include/llvm/Target/GenericOpcodes.td index ede632b3385..1900870d6da 100644 --- a/include/llvm/Target/GenericOpcodes.td +++ b/include/llvm/Target/GenericOpcodes.td @@ -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 //------------------------------------------------------------------------------ diff --git a/include/llvm/Target/GlobalISel/SelectionDAGCompat.td b/include/llvm/Target/GlobalISel/SelectionDAGCompat.td index a6eb3b58f81..d355c948fd3 100644 --- a/include/llvm/Target/GlobalISel/SelectionDAGCompat.td +++ b/include/llvm/Target/GlobalISel/SelectionDAGCompat.td @@ -96,6 +96,7 @@ def : GINodeEquiv; def : GINodeEquiv; def : GINodeEquiv; def : GINodeEquiv; +def : GINodeEquiv; // Broadly speaking G_LOAD is equivalent to ISD::LOAD but there are some // complications that tablegen must take care of. For example, Predicates such diff --git a/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir b/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir index c4a0af07a5d..570d1f35a8a 100644 --- a/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir +++ b/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir @@ -350,6 +350,9 @@ # # 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