]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: xtheadmemidx: Document inline asm issue with memory constraint
authorChristoph Müllner <christoph.muellner@vrull.eu>
Tue, 5 Dec 2023 01:54:52 +0000 (02:54 +0100)
committerChristoph Müllner <christoph.muellner@vrull.eu>
Thu, 7 Dec 2023 09:31:36 +0000 (10:31 +0100)
commit570d74119d2daaa9ea909b6326a3756f548097d0
treea70e49dcada61530b3758e4a8c153752b1898f68
parent8c09c73adf4c537876e8ef418378d6581b768a64
RISC-V: xtheadmemidx: Document inline asm issue with memory constraint

The XTheadMemIdx support relies on the fact that memory operands that
can be expressed by XTheadMemIdx instructions, will only appear as
operands of such instructions.  For internal instruction generation
this is guaranteed by the implemenation.  However, in case of inline
assembly, this guarantee is not given and we cannot differentiate
these two cases when printing the operand:

  asm volatile ("sd %1,%0" : "=m"(*tmp) : "r"(val));
  asm volatile ("th.srd %1,%0" : "=m"(*tmp) : "r"(val));

If XTheadMemIdx is enabled, then the address will be printed as if an
XTheadMemIdx instruction is emitted, which is obviously wrong in the
first case.

There might be solutions to handle this (e.g. using TARGET_MEM_CONSTRAINT
or extending the mnemonics to accept the standard operands for
XTheadMemIdx instructions), but let's document this behavior for now
as a known issue by adding xfail tests until we have an acceptable fix.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/xtheadmemidx-inline-asm-1.c: New test.

Reported-by: Jin Ma <jinma@linux.alibaba.com>
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
gcc/testsuite/gcc.target/riscv/xtheadmemidx-inline-asm-1.c [new file with mode: 0644]