[PATCH] D57359: [GlobalISel] Introduce a G_FSQRT generic instruction

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 30 10:39:08 PST 2019


paquette updated this revision to Diff 184331.
paquette added a comment.

Updated patch to document errno behaviour.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57359/new/

https://reviews.llvm.org/D57359

Files:
  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: test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
===================================================================
--- test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
+++ test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
@@ -338,6 +338,9 @@
 #
 # DEBUG-NEXT: G_FSIN (opcode {{[0-9]+}}): 1 type index
 # DEBUG: .. the first uncovered type index: 1, OK
+#
+# DEBUG-NEXT: G_FSQRT (opcode {{[0-9]+}}): 1 type index
+# DEBUG: .. the first uncovered type index: 1, OK
 
 # CHECK-NOT: ill-defined
 
Index: include/llvm/Target/GlobalISel/SelectionDAGCompat.td
===================================================================
--- include/llvm/Target/GlobalISel/SelectionDAGCompat.td
+++ include/llvm/Target/GlobalISel/SelectionDAGCompat.td
@@ -91,6 +91,7 @@
 def : GINodeEquiv<G_FCEIL, fceil>;
 def : GINodeEquiv<G_FCOS, fcos>;
 def : GINodeEquiv<G_FSIN, fsin>;
+def : GINodeEquiv<G_FSQRT, fsqrt>;
 
 // 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: include/llvm/Target/GenericOpcodes.td
===================================================================
--- include/llvm/Target/GenericOpcodes.td
+++ include/llvm/Target/GenericOpcodes.td
@@ -569,6 +569,14 @@
   let hasSideEffects = 0;
 }
 
+// Floating point square root of a value.
+// NOTE: Unlike libm sqrt(), this never sets errno.
+def G_FSQRT : GenericInstruction {
+  let OutOperandList = (outs type0:$dst);
+  let InOperandList = (ins type0:$src1);
+  let hasSideEffects = 0;
+}
+
 //------------------------------------------------------------------------------
 // Opcodes for LLVM Intrinsics
 //------------------------------------------------------------------------------
Index: include/llvm/Support/TargetOpcodes.def
===================================================================
--- include/llvm/Support/TargetOpcodes.def
+++ include/llvm/Support/TargetOpcodes.def
@@ -526,6 +526,9 @@
 /// Floating point sine.
 HANDLE_TARGET_OPCODE(G_FSIN)
 
+/// Floating point square root.
+HANDLE_TARGET_OPCODE(G_FSQRT)
+
 /// Generic AddressSpaceCast.
 HANDLE_TARGET_OPCODE(G_ADDRSPACE_CAST)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57359.184331.patch
Type: text/x-patch
Size: 2208 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190130/65e7549a/attachment-0001.bin>


More information about the llvm-commits mailing list