@@ -12116,10 +12116,57 @@ The list below describes the supported modifiers and their effects for LoongArch
12116
12116
@item @code{d} @tab Same as @code{c}.
12117
12117
@item @code{i} @tab Print the character ''@code{i}'' if the operand is not a register.
12118
12118
@item @code{m} @tab Same as @code{c}, but the printed value is @code{operand - 1}.
12119
+ @item @code{u} @tab Print a LASX register.
12120
+ @item @code{w} @tab Print a LSX register.
12119
12121
@item @code{X} @tab Print a constant integer operand in hexadecimal.
12120
12122
@item @code{z} @tab Print the operand in its unmodified form, followed by a comma.
12121
12123
@end multitable
12122
12124
12125
+ References to input and output operands in the assembler template of extended
12126
+ asm statements can use modifiers to affect the way the operands are formatted
12127
+ in the code output to the assembler. For example, the following code uses the
12128
+ 'w' modifier for LoongArch:
12129
+
12130
+ @example
12131
+ test-asm.c:
12132
+
12133
+ #include <lsxintrin.h>
12134
+
12135
+ __m128i foo (void)
12136
+ @{
12137
+ __m128i a,b,c;
12138
+ __asm__ ("vadd.d %w0,%w1,%w2\n\t"
12139
+ :"=f" (c)
12140
+ :"f" (a),"f" (b));
12141
+
12142
+ return c;
12143
+ @}
12144
+
12145
+ @end example
12146
+
12147
+ @noindent
12148
+ The compile command for the test case is as follows:
12149
+
12150
+ @example
12151
+ gcc test-asm.c -mlsx -S -o test-asm.s
12152
+ @end example
12153
+
12154
+ @noindent
12155
+ The assembly statement produces the following assembly code:
12156
+
12157
+ @example
12158
+ vadd.d $vr0,$vr0,$vr1
12159
+ @end example
12160
+
12161
+ This is a 128-bit vector addition instruction, @code{c} (referred to in the
12162
+ template string as %0) is the output, and @code{a} (%1) and @code{b} (%2) are
12163
+ the inputs. @code{__m128i} is a vector data type defined in the file
12164
+ @code{lsxintrin.h} (@xref{LoongArch SX Vector Intrinsics}). The symbol '=f'
12165
+ represents a constraint using a floating-point register as an output type, and
12166
+ the 'f' in the input operand represents a constraint using a floating-point
12167
+ register operand, which can refer to the definition of a constraint
12168
+ (@xref{Constraints}) in gcc.
12169
+
12123
12170
@anchor{riscvOperandmodifiers}
12124
12171
@subsubsection RISC-V Operand Modifiers
12125
12172
0 commit comments