[PATCH] D106790: prfchwintrin.h: Make _m_prefetchw take a pointer to volatile (PR49124)

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 27 02:18:55 PDT 2021


hans added a comment.

In D106790#2905110 <https://reviews.llvm.org/D106790#2905110>, @rnk wrote:

> Does this match GCC? They also provide this Intel intrinsic.

No, they define it without volatile (and also without const): https://github.com/gcc-mirror/gcc/blob/releases/gcc-11.1.0/gcc/config/i386/prfchwintrin.h#L32

But maybe their header doesn't get included together with Microsoft's header?



================
Comment at: clang/lib/Headers/prfchwintrin.h:54
+#pragma clang diagnostic ignored "-Wcast-qual"
+  __builtin_prefetch ((const void*)__P, 1, 3 /* _MM_HINT_T0 */);
+#pragma clang diagnostic pop
----------------
pengfei wrote:
> Can we declare `__builtin_prefetch` to volatile one in Builtins.def:
> ```
> BUILTIN(__builtin_prefetch, "vvCD*.", "nc")
> ```
We could, and that would remove the need for the cast, but I'm not sure it would make sense in itself. Since _m_prefetchw is the odd one here, I think it makes sense to do the fix in its implementation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106790



More information about the cfe-commits mailing list