[llvm] [GlobalISel] Update the documentation of abd. (PR #164594)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 22 03:16:37 PDT 2025


https://github.com/davemgreen created https://github.com/llvm/llvm-project/pull/164594

The abd nodes do not perform the same as abs(x-y), although they are often mistaken to do so. They extend into a larger bit size before performing the sub / abs and so produce different results. Update the description of the instruction to avoid misunderstandings.

>From ab510a98d2bc86ca7574e8ab186c1d90c8c6b27f Mon Sep 17 00:00:00 2001
From: David Green <david.green at arm.com>
Date: Wed, 22 Oct 2025 11:13:03 +0100
Subject: [PATCH] [GlobalISel] Update the documentation of abd.

The abd nodes do not perform the same as abs(x-y), although they are often
mistaken to do so. They extend into a larger bit size before performing the sub
/ abs. Update the description of the instruction to avoid misunderstandings.
---
 llvm/docs/GlobalISel/GenericOpcode.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/docs/GlobalISel/GenericOpcode.rst b/llvm/docs/GlobalISel/GenericOpcode.rst
index b055327466739..661a11537cf57 100644
--- a/llvm/docs/GlobalISel/GenericOpcode.rst
+++ b/llvm/docs/GlobalISel/GenericOpcode.rst
@@ -504,7 +504,7 @@ undefined.
 G_ABDS, G_ABDU
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-Compute the absolute difference (signed and unsigned), e.g. abs(x-y).
+Compute the absolute difference (signed and unsigned), e.g. trunc(abs(ext(x)-ext(y)).
 
 .. code-block:: none
 



More information about the llvm-commits mailing list