[PATCH] D147290: [documentation]neg documentation

Ayushi Shukla via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 18:06:57 PDT 2023


ayushi-8102 created this revision.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
ayushi-8102 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch fixes https://github.com/llvm/llvm-project/issues/19751


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147290

Files:
  llvm/docs/LangRef.rst


Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -8989,6 +8989,50 @@
 data, as is the case with the :ref:`vector <t_vector>` data type. The
 result value has the same type as its operand.
 
+.. _i_neg:
+
+'``neg``' Instruction
+^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+::
+
+     <result> = neg [nsw] [nuw] <ty> <op1> ; yields ty:result
+
+
+Overview:
+"""""""""
+
+The 'neg' instruction is a standard instruction that performs a two's complement negation operation on an integer value.
+
+The 'neg' instruction takes a single operand, which must be an integer value, and returns its negation.
+
+
+Arguments:
+""""""""""
+
+The argument to the '``neg``' instruction must be a
+:ref:`integer-value< <t_integer>` or :ref:`vector <t_vector>`.
+
+
+Semantics:
+""""""""""
+
+For a constant integer operand, the 'neg' instruction computes the two's complement negation of the operand and returns the result as a constant integer.
+
+
+For a register or variable integer operand, the 'neg' instruction computes the two's complement negation of the operand and stores the result in the destination register or variable.
+
+
+Example:
+""""""""
+
+.. code-block:: text
+
+     <result> = neg int %val          ; yields int:result = -%var
+
 .. _i_fneg:
 
 '``fneg``' Instruction


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147290.509870.patch
Type: text/x-patch
Size: 1380 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230331/3d167bf9/attachment.bin>


More information about the llvm-commits mailing list