Skip to content

Commit

Permalink
[GlobalISel] Add a G_FRINT opcode
Browse files Browse the repository at this point in the history
Equivalent to SelectionDAG's frint node.

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

llvm-svn: 358785
  • Loading branch information
Jessica Paquette committed Apr 19, 2019
1 parent f919a2e commit 627e8f8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions llvm/include/llvm/Support/TargetOpcodes.def
Expand Up @@ -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)

Expand Down
7 changes: 7 additions & 0 deletions llvm/include/llvm/Target/GenericOpcodes.td
Expand Up @@ -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
//------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td
Expand Up @@ -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
Expand Down
Expand Up @@ -346,6 +346,9 @@
# 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
Expand Down

0 comments on commit 627e8f8

Please sign in to comment.