From 333ee5ef21e6903f2893c9dcf3bb941b88516542 Mon Sep 17 00:00:00 2001
From: liuhongt <hongtao.liu@intel.com>
Date: Fri, 8 May 2020 17:47:33 +0800
Subject: [PATCH] Document more x86 operand modifier.

Documents operand modifiers which are available in asm stmt but missing in document.

 | Modifier | Description | Available in asm stmt | Existed in documentation |
 | --- | --- | ------- | ----- |
 | L,W,B,Q,S,T | print the opcode suffix for specified size of operand. | Available | Not |
 | C | print opcode suffix for set/cmov insn. | Not | - |
 | c | like C, but print reversed condition | Not | - |
 | F,f | likewise, but for floating-point. | Not | - |
 | O | if HAVE_AS_IX86_CMOV_SUN_SYNTAX, expand to "w.", "l." or "q.", otherwise nothing | Not | - |
 | R | print embedded rounding and sae. | Available | Not |
 | r | print only sae. | Available | Not |
 | z | print the opcode suffix for the size of the current operand. | Available | Existed |
 | Z | likewise, with special suffixes for x87 instructions. | Availble | Not |
 | * | print a star (in certain assembler syntax) | Not | - |
 | A | print an absolute memory reference. | Available | Existed |
 | E | print address with DImode register names if TARGET_64BIT. | Available | Existed |
 | w | print the operand as if it's a "word" (HImode) even if it isn't. | Available | Existed |
 | s | print a shift double count, followed by the assemblers argument delimiter. | Available | Not |
 | b | print the QImode name of the register for the indicated operand %b0 would print %al if operands[0] is reg 0. | Available | Existed |
 | w | likewise, print the HImode name of the register. | Available | Existed |
 | k | likewise, print the SImode name of the register. | Available | Existed |
 | q | likewise, print the DImode name of the register. | Available | Existed |
 | x | likewise, print the V4SFmode name of the register. | Available | Not |
 | t | likewise, print the V8SFmode name of the register. | Available | Not |
 | g | likewise, print the V16SFmode name of the register. | Avaliable | Not |
 | h | print the QImode name for a "high" register, either ah, bh, ch or dh. | Available | Existed |
 | y | print "st(0)" instead of "st" as a register. | Available | Not |
 | d | print duplicated register operand for AVX instruction. | Available | Not |
 | D | print condition for SSE cmp instruction. | Not | - |
 | P | if PIC, print an @PLT suffix. | Available | Existed |
 | p | print raw symbol name. | Available | Existed |
 | X | don't print any sort of PIC '@' suffix for a symbol. | Not | - |
 | & | print some in-use local-dynamic symbol name. | Not | - |
 | H | print a memory address offset by 8; used for sse high-parts | Available | Existed |
 | Y | print condition for XOP pcom* instruction. | Not | - |
 | V | print naked full integer register name without %. | Available | Existed |
 | + | print a branch hint as 'cs' or 'ds' prefix | Not | - |
 | ; | print a semicolon (after prefixes due to bug in older gas). | Not | - |
 | ~ | print "i" if TARGET_AVX2, "f" otherwise. | Not | - |
 | ^ | print addr32 prefix if TARGET_64BIT and Pmode != word_mode | Not | - |
 | M | print addr32 prefix for TARGET_X32 with VSIB address. | Not | - |
 | ! | print NOTRACK prefix for jxx/call/ret instructions if required. | Not | - |
 | N | print maskz if it's constant 0 operand. | Available | Not |
 | I | print comparision predicate operand for sse cmp condition. | Not | - |

gcc/ChangeLog

	PR target/94118
	 * doc/extend.texi (x86Operandmodifiers): Document more x86
	 operand modifier.
	 * gcc/config/i386/i386.c: Add comment for operand modifier N
	 and I.

Modified-by: liuhongt <hongtao.liu@intel.com>
---
 gcc/config/i386/i386.c |  2 +
 gcc/doc/extend.texi    | 94 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 94 insertions(+), 2 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b40f443ba8a..405f6ba2622 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12506,6 +12506,8 @@ print_reg (rtx x, int code, FILE *file)
    ^ -- print addr32 prefix if TARGET_64BIT and Pmode != word_mode
    M -- print addr32 prefix for TARGET_X32 with VSIB address.
    ! -- print NOTRACK prefix for jxx/call/ret instructions if required.
+   N -- print maskz if it's constant 0 operand.
+   I -- print comparision predicate operand for sse cmp condition.
  */
 
 void
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 936c22e2fe7..7095d1f3e86 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -10431,6 +10431,15 @@ for the @samp{att} and @samp{intel} dialects of assembler:
 @item @code{%3}
 @tab @code{$.L3}
 @tab @code{OFFSET FLAT:.L3}
+@item @code{%4}
+@tab @code{$8}
+@tab @code{8}
+@item @code{%5}
+@tab @code{%xmm0}
+@tab @code{xmm0}
+@item @code{%7}
+@tab @code{$0}
+@tab @code{0}
 @end multitable
 
 The table below shows the list of supported modifiers and their effects.
@@ -10447,17 +10456,32 @@ The table below shows the list of supported modifiers and their effects.
 @tab @code{%b0}
 @tab @code{%al}
 @tab @code{al}
+@item @code{B}
+@tab print the opcode suffix of b.
+@tab @code{%B0}
+@tab @code{b}
+@tab
 @item @code{c}
 @tab Require a constant operand and print the constant expression with no punctuation.
 @tab @code{%c1}
 @tab @code{2}
 @tab @code{2}
+@item @code{d}
+@tab print duplicated register operand for AVX instruction.
+@tab @code{%d5}
+@tab @code{%xmm0, %xmm0}
+@tab @code{xmm0, xmm0}
 @item @code{E}
 @tab Print the address in Double Integer (DImode) mode (8 bytes) when the target is 64-bit.
 Otherwise mode is unspecified (VOIDmode).
 @tab @code{%E1}
 @tab @code{%(rax)}
 @tab @code{[rax]}
+@item @code{g}
+@tab Print the V16SFmode name of the register.
+@tab @code{%g0}
+@tab @code{%zmm0}
+@tab @code{zmm0}
 @item @code{h}
 @tab Print the QImode name for a ``high'' register.
 @tab @code{%h0}
@@ -10479,6 +10503,16 @@ high 8 bytes of SSE values. For a memref in (%rax), it generates
 @tab @code{%l3}
 @tab @code{.L3}
 @tab @code{.L3}
+@item @code{L}
+@tab print the opcode suffix of l.
+@tab @code{%L0}
+@tab @code{l}
+@tab
+@item @code{N}
+@tab print maskz.
+@tab @code{%N7}
+@tab @code{@{z@}}
+@tab @code{@{z@}}
 @item @code{p}
 @tab Print raw symbol name (without syntax-specific prefixes).
 @tab @code{%p2}
@@ -10494,20 +10528,76 @@ issue the bare constant. See @code{p} above.
 @tab @code{%q0}
 @tab @code{%rax}
 @tab @code{rax}
+@item @code{Q}
+@tab print the opcode suffix of q.
+@tab @code{%Q0}
+@tab @code{q}
+@tab
+@item @code{R}
+@tab print embedded rounding and sae.
+@tab @code{%R4}
+@tab @code{@{rn-sae@}, }
+@tab @code{, @{rn-sae@}}
+@item @code{r}
+@tab print only sae.
+@tab @code{%r4}
+@tab @code{@{sae@}, }
+@tab @code{, @{sae@}}
+@item @code{s}
+@tab print a shift double count, followed by the assemblers argument
+delimiterprint the opcode suffix of s.
+@tab @code{%s1}
+@tab @code{$2, }
+@tab @code{2, }
+@item @code{S}
+@tab print the opcode suffix of s.
+@tab @code{%S0}
+@tab @code{s}
+@tab
+@item @code{t}
+@tab print the V8SFmode name of the register.
+@tab @code{%t5}
+@tab @code{%ymm0}
+@tab @code{ymm0}
+@item @code{T}
+@tab print the opcode suffix of t.
+@tab @code{%T0}
+@tab @code{t}
+@tab
+@item @code{V}
+@tab print naked full integer register name without %.
+@tab @code{%V0}
+@tab @code{eax}
+@tab @code{eax}
 @item @code{w}
 @tab Print the HImode name of the register.
 @tab @code{%w0}
 @tab @code{%ax}
 @tab @code{ax}
+@item @code{W}
+@tab print the opcode suffix of w.
+@tab @code{%W0}
+@tab @code{w}
+@tab
+@item @code{x}
+@tab print the V4SFmode name of the register.
+@tab @code{%x5}
+@tab @code{%xmm0}
+@tab @code{xmm0}
+@item @code{y}
+@tab print "st(0)" instead of "st" as a register.
+@tab @code{%y6}
+@tab @code{%st(0)}
+@tab @code{st(0)}
 @item @code{z}
 @tab Print the opcode suffix for the size of the current integer operand (one of @code{b}/@code{w}/@code{l}/@code{q}).
 @tab @code{%z0}
 @tab @code{l}
 @tab 
+@item @code{Z}
+@tab Like @code{z}, with special suffixes for x87 instructions.
 @end multitable
 
-@code{V} is a special modifier which prints the name of the full integer
-register without @code{%}.
 
 @anchor{x86floatingpointasmoperands}
 @subsubsection x86 Floating-Point @code{asm} Operands
-- 
2.18.1

