public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: chenxiaolong <chenxiaolong@loongson.cn>
To: gcc-patches@gcc.gnu.org
Cc: xry111@xry111.site, i@xen0n.name, xuchenghua@loongson.cn,
	chenglulu@loongson.cn, chenxiaolong <chenxiaolong@loongson.cn>
Subject: [PATCH v1] LoongArch: Add modifiers for lsx and lasx.
Date: Tue,  7 Nov 2023 12:06:06 +0800	[thread overview]
Message-ID: <20231107040606.332-1-chenxiaolong@loongson.cn> (raw)

gcc/ChangeLog:

	* doc/extend.texi:Added modifiers for LoongArch architecture
	lsx and lasx in the manual.
---
 gcc/doc/extend.texi | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 6e2f5b5a58c..d42c3ca49ef 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -10582,6 +10582,31 @@ __asm__ ("btsl %2,%1\n\t" // Turn on zero-based bit #Offset in Base.
 return old;
 @end example
 
+In this LoongArch example, c (referred to in the template string as %0) is the
+output,and a (%1) and b (%2) are the inputs.Where the symbol "=f" refers to the
+use of a floating-point register as a constraint for the output type, and the
+"f" in the input operand refers to the use of a floating-point register operand,
+the constraint can refer to the definition of constraints in gcc.
+
+This is a 128-bit double-byte vector addition instruction,the instruction
+modifier (w) represents the 128-bit vector instruction modification format,its
+corresponding output instructions are @code{"vadd.d $vr0,$vr0,$vr1"}.
+
+On the @code{LoongArch} architecture, the operand can only output the
+corresponding vector (SX/ASX) instruction if it uses @code{'w}' and @code{'u'}
+in the assembly instruction,with @code{'f'} as the constraint character.
+
+@example
+__m128i  a,b,c;
+
+__asm__ ("vadd.d %w0,%w1,%w2\n\t"
+   :"=f" (c)
+   :"f" (a),"f" (b)
+   :"cc");
+
+return c;
+@end example
+
 Operands are separated by commas.  Each operand has this format:
 
 @example
@@ -11680,6 +11705,8 @@ The list below describes the supported modifiers and their effects for LoongArch
 @item @code{m} @tab Same as @code{c}, but the printed value is @code{operand - 1}.
 @item @code{X} @tab Print a constant integer operand in hexadecimal.
 @item @code{z} @tab Print the operand in its unmodified form, followed by a comma.
+@item @code{u} @tab Print a LASX register.
+@item @code{w} @tab Print a LSX register.
 @end multitable
 
 @anchor{riscvOperandmodifiers}
-- 
2.20.1


             reply	other threads:[~2023-11-07  4:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07  4:06 chenxiaolong [this message]
2023-11-07 11:10 ` Xi Ruoyao
2023-11-07 11:13   ` Xi Ruoyao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231107040606.332-1-chenxiaolong@loongson.cn \
    --to=chenxiaolong@loongson.cn \
    --cc=chenglulu@loongson.cn \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=i@xen0n.name \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).