[clang] 12dc13b - prfchwintrin.h: Make _m_prefetchw take a pointer to volatile (PR49124)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 2 06:16:16 PDT 2021


Author: Hans Wennborg
Date: 2021-08-02T15:16:04+02:00
New Revision: 12dc13b73cf8c11da1bcc354c78bd6a9c92408e8

URL: https://github.com/llvm/llvm-project/commit/12dc13b73cf8c11da1bcc354c78bd6a9c92408e8
DIFF: https://github.com/llvm/llvm-project/commit/12dc13b73cf8c11da1bcc354c78bd6a9c92408e8.diff

LOG: prfchwintrin.h: Make _m_prefetchw take a pointer to volatile (PR49124)

For some reason, Microsoft declares _m_prefetch to take a const void*,
but _m_prefetchw to take a /volatile/ const void*.

Do the same for compatibility.

Differential revision: https://reviews.llvm.org/D106790

Added: 
    

Modified: 
    clang/lib/Headers/prfchwintrin.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/prfchwintrin.h b/clang/lib/Headers/prfchwintrin.h
index 6e8a4ef2ec971..d2f91aa0123e0 100644
--- a/clang/lib/Headers/prfchwintrin.h
+++ b/clang/lib/Headers/prfchwintrin.h
@@ -47,9 +47,12 @@ _m_prefetch(void *__P)
 /// \param __P
 ///    A pointer specifying the memory address to be prefetched.
 static __inline__ void __attribute__((__always_inline__, __nodebug__))
-_m_prefetchw(void *__P)
+_m_prefetchw(volatile const void *__P)
 {
-  __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wcast-qual"
+  __builtin_prefetch ((const void*)__P, 1, 3 /* _MM_HINT_T0 */);
+#pragma clang diagnostic pop
 }
 
 #endif /* __PRFCHWINTRIN_H */


        


More information about the cfe-commits mailing list