Skip to content

Update documentation on x86 constraint codes #68830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2023
Merged

Conversation

bjacob
Copy link
Contributor

@bjacob bjacob commented Oct 11, 2023

This updates the documentation on these inline asm constraint codes to match reality. Context: #68818 (comment) . @parvizmp

Note: dropping also the 'o' from the docs because I can't find any mention of it in X86ISelLowering.cpp.

@llvmbot
Copy link
Member

llvmbot commented Oct 11, 2023

@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-llvm-ir

Author: None (bjacob)

Changes

This updates the documentation on these inline asm constraint codes to match reality. Context: #68818 (comment) . @parvizmp

Note: dropping also the 'o' from the docs because I can't find any mention of it in X86ISelLowering.cpp.


Full diff: https://github.com/llvm/llvm-project/pull/68830.diff

1 Files Affected:

  • (modified) llvm/docs/LangRef.rst (+5-3)
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 1883e9f6290b151..0e5621f9b650a3b 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -5282,7 +5282,6 @@ X86:
 - ``O``: An immediate integer between 0 and 127.
 - ``e``: An immediate 32-bit signed integer.
 - ``Z``: An immediate 32-bit unsigned integer.
-- ``o``, ``v``: Treated the same as ``m``, at the moment.
 - ``q``: An 8, 16, 32, or 64-bit register which can be accessed as an 8-bit
   ``l`` integer register. On X86-32, this is the ``a``, ``b``, ``c``, and ``d``
   registers, and on X86-64, it is all of the integer registers.
@@ -5293,10 +5292,13 @@ X86:
   existed since i386, and can be accessed without the REX prefix.
 - ``f``: A 32, 64, or 80-bit '387 FPU stack pseudo-register.
 - ``y``: A 64-bit MMX register, if MMX is enabled.
-- ``x``: If SSE is enabled: a 32 or 64-bit scalar operand, or 128-bit vector
+- ``v``: If SSE is enabled: a 32 or 64-bit scalar operand, or 128-bit vector
   operand in a SSE register. If AVX is also enabled, can also be a 256-bit
   vector operand in an AVX register. If AVX-512 is also enabled, can also be a
-  512-bit vector operand in an AVX512 register, Otherwise, an error.
+  512-bit vector operand in an AVX512 register. Otherwise, an error.
+- ``x``: The same as ``v``, except that when AVX-512 is enabled, the ``x`` code
+  only allocates into the first 16 AVX-512 registers, while the ``v`` code
+  allocates into any of the 32 AVX-512 registers.
 - ``Y``: The same as ``x``, if *SSE2* is enabled, otherwise an error.
 - ``A``: Special case: allocates EAX first, then EDX, for a single operand (in
   32-bit mode, a 64-bit integer operand will get split into two registers). It

@bjacob bjacob changed the title inline-asm-docs Update documentation on x86 constraint codes Oct 11, 2023
@bjacob
Copy link
Contributor Author

bjacob commented Oct 11, 2023

I'm not an expert here, this needs to be checked for correctness. @qcolombet can you think of an appropriate reviewer?

@qcolombet
Copy link
Collaborator

Tentatively assigning this to @nickdesaulniers.
Nick, since you're looking at the inline asm lowering, the modifier syntax may be fresher than my recollection.
Could you take a look?

@bjacob
Copy link
Contributor Author

bjacob commented Oct 12, 2023

Oh hi @nickdesaulniers (we used to be colleagues at Mozilla)!

@bjacob
Copy link
Contributor Author

bjacob commented Oct 17, 2023

ping :-)

Copy link
Contributor

@phoebewang phoebewang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@bjacob bjacob merged commit 3dc263b into llvm:main Oct 17, 2023
@nickdesaulniers
Copy link
Member

Hi! Sorry for being late here.

Curiously, https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html doesn't make such distinctions about x constraint wrt AVX512.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants