[PATCH] D145416: [clang] model 'p' inline asm constraint as reading memory

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 6 15:34:30 PST 2023


nickdesaulniers added a comment.

In D145416#4173258 <https://reviews.llvm.org/D145416#4173258>, @jyknight wrote:

>> ā€˜pā€™ in the constraint must be accompanied by address_operand as the predicate in the match_operand. This predicate interprets the mode specified in the match_operand as the mode of the memory reference for which the address would be valid.
>
> How do you do that with inline-asm?

Good question. The only tests I see GCC using with "=p" or "p" (no "+p" AFAICT) are:

1. https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/testsuite/gcc.dg/pr58805.c;h=b46f7764260b29bc82fc8226d20019f05c5e05c0;hb=HEAD
2. https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/testsuite/gcc.dg/asm-4.c;h=180578e64e1dd68c2f5619f31fa46ac3433fd226;hb=HEAD

(maybe my grep-fu is weak). These didn't help explain what that sentence means (though maybe my comprehension skills are weak). AFAICT, the docs were added in this massive commit:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=03dda8e3c3b2f

Looking at why the kernel ever used it, it looks like:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.3-rc1&id=97b67ae559947f1e208439a1bf6a734da3087006 introduced it. That commit refers to an issue that was fixed in gcc 4.9:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63637

The linux kernel only support gcc 5.1+, so that issue is now irrelevant from the kernel's standpoint. Maybe it is time to unwind that change (97b67ae559947f1e208439a1bf6a734da3087006)...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145416/new/

https://reviews.llvm.org/D145416



More information about the cfe-commits mailing list