[PATCH] D104245: [GlobalISel] Describe undefined values for G_SBFX/G_UBFX operands
Brendon Cahoon via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 14 10:54:00 PDT 2021
bcahoon created this revision.
bcahoon added reviewers: foad, paquette.
Herald added a subscriber: rovka.
bcahoon requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Describe the allowable values for the least-significant bit and width operands for
G_SBFX/G_UBFX. This is necessary when the values are run-time values (as opposed
to compile-time constants).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D104245
Files:
llvm/docs/GlobalISel/GenericOpcode.rst
llvm/include/llvm/Target/GenericOpcodes.td
Index: llvm/include/llvm/Target/GenericOpcodes.td
===================================================================
--- llvm/include/llvm/Target/GenericOpcodes.td
+++ llvm/include/llvm/Target/GenericOpcodes.td
@@ -1379,14 +1379,18 @@
// Bitfield extraction.
//------------------------------------------------------------------------------
-// Generic signed bitfield extraction.
+// Generic signed bitfield extraction. If lsb is larger than the number of
+// bits in src, the result is undefined. If width is 0 or width - lsb is
+// larger than the number of bits in src, the result is undefined.
def G_SBFX : GenericInstruction {
let OutOperandList = (outs type0:$dst);
let InOperandList = (ins type0:$src, type1:$lsb, type1:$width);
let hasSideEffects = false;
}
-// Generic unsigned bitfield extraction.
+// Generic unsigned bitfield extraction. If lsb is larger than the number of
+// bits in src, the result is undefined. If width is 0 or width - lsb is
+// larger than the number of bits in src, the result is undefined.
def G_UBFX : GenericInstruction {
let OutOperandList = (outs type0:$dst);
let InOperandList = (ins type0:$src, type1:$lsb, type1:$width);
Index: llvm/docs/GlobalISel/GenericOpcode.rst
===================================================================
--- llvm/docs/GlobalISel/GenericOpcode.rst
+++ llvm/docs/GlobalISel/GenericOpcode.rst
@@ -254,6 +254,11 @@
G_SBFX sign-extends the result, while G_UBFX zero-extends the result.
+If the least-significant bit is larger than the number of bits in the
+source, the result is undefined. If the width is zero or if
+width minus the least-significant bit is larger than the number of bits
+in the source, the result is undefined.
+
.. code-block:: none
; Extract 5 bits starting at bit 1 from %x and store them in %a.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104245.351928.patch
Type: text/x-patch
Size: 1827 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210614/faee87ab/attachment.bin>
More information about the llvm-commits
mailing list