aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Headers
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Headers')
-rw-r--r--clang/lib/Headers/altivec.h62
-rw-r--r--clang/lib/Headers/arm_acle.h26
-rw-r--r--clang/lib/Headers/arm_cmse.h217
-rw-r--r--clang/lib/Headers/avx512bwintrin.h12
-rw-r--r--clang/lib/Headers/avx512fintrin.h28
-rw-r--r--clang/lib/Headers/avx512vlbwintrin.h24
-rw-r--r--clang/lib/Headers/avx512vlintrin.h112
-rw-r--r--clang/lib/Headers/avxintrin.h10
-rw-r--r--clang/lib/Headers/emmintrin.h28
-rw-r--r--clang/lib/Headers/immintrin.h6
-rw-r--r--clang/lib/Headers/intrin.h26
-rw-r--r--clang/lib/Headers/mwaitxintrin.h4
-rw-r--r--clang/lib/Headers/pmmintrin.h2
-rw-r--r--clang/lib/Headers/xmmintrin.h14
14 files changed, 420 insertions, 151 deletions
diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h
index 8352f8f740c2..7e231a2a428e 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -14784,7 +14784,7 @@ static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
vector float __b) {
#ifdef __VSX__
- return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, (vector double)__a, (vector double)__b);
+ return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b);
#else
return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
#endif
@@ -16364,27 +16364,32 @@ vec_xl(signed long long __offset, unsigned char *__ptr) {
static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset,
signed short *__ptr) {
- return *(unaligned_vec_sshort *)(__ptr + __offset);
+ signed char *__addr = (signed char *)__ptr + __offset;
+ return *(unaligned_vec_sshort *)__addr;
}
static inline __ATTRS_o_ai vector unsigned short
vec_xl(signed long long __offset, unsigned short *__ptr) {
- return *(unaligned_vec_ushort *)(__ptr + __offset);
+ signed char *__addr = (signed char *)__ptr + __offset;
+ return *(unaligned_vec_ushort *)__addr;
}
static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset,
signed int *__ptr) {
- return *(unaligned_vec_sint *)(__ptr + __offset);
+ signed char *__addr = (signed char *)__ptr + __offset;
+ return *(unaligned_vec_sint *)__addr;
}
static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset,
unsigned int *__ptr) {
- return *(unaligned_vec_uint *)(__ptr + __offset);
+ signed char *__addr = (signed char *)__ptr + __offset;
+ return *(unaligned_vec_uint *)__addr;
}
static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset,
float *__ptr) {
- return *(unaligned_vec_float *)(__ptr + __offset);
+ signed char *__addr = (signed char *)__ptr + __offset;
+ return *(unaligned_vec_float *)__addr;
}
#ifdef __VSX__
@@ -16394,17 +16399,20 @@ typedef vector double unaligned_vec_double __attribute__((aligned(1)));
static inline __ATTRS_o_ai vector signed long long
vec_xl(signed long long __offset, signed long long *__ptr) {
- return *(unaligned_vec_sll *)(__ptr + __offset);
+ signed char *__addr = (signed char *)__ptr + __offset;
+ return *(unaligned_vec_sll *)__addr;
}
static inline __ATTRS_o_ai vector unsigned long long
vec_xl(signed long long __offset, unsigned long long *__ptr) {
- return *(unaligned_vec_ull *)(__ptr + __offset);
+ signed char *__addr = (signed char *)__ptr + __offset;
+ return *(unaligned_vec_ull *)__addr;
}
static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset,
double *__ptr) {
- return *(unaligned_vec_double *)(__ptr + __offset);
+ signed char *__addr = (signed char *)__ptr + __offset;
+ return *(unaligned_vec_double *)__addr;
}
#endif
@@ -16414,12 +16422,14 @@ typedef vector unsigned __int128 unaligned_vec_ui128
__attribute__((aligned(1)));
static inline __ATTRS_o_ai vector signed __int128
vec_xl(signed long long __offset, signed __int128 *__ptr) {
- return *(unaligned_vec_si128 *)(__ptr + __offset);
+ signed char *__addr = (signed char *)__ptr + __offset;
+ return *(unaligned_vec_si128 *)__addr;
}
static inline __ATTRS_o_ai vector unsigned __int128
vec_xl(signed long long __offset, unsigned __int128 *__ptr) {
- return *(unaligned_vec_ui128 *)(__ptr + __offset);
+ signed char *__addr = (signed char *)__ptr + __offset;
+ return *(unaligned_vec_ui128 *)__addr;
}
#endif
@@ -16516,50 +16526,58 @@ static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec,
static inline __ATTRS_o_ai void vec_xst(vector signed short __vec,
signed long long __offset,
signed short *__ptr) {
- *(unaligned_vec_sshort *)(__ptr + __offset) = __vec;
+ signed char *__addr = (signed char *)__ptr + __offset;
+ *(unaligned_vec_sshort *)__addr = __vec;
}
static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
signed long long __offset,
unsigned short *__ptr) {
- *(unaligned_vec_ushort *)(__ptr + __offset) = __vec;
+ signed char *__addr = (signed char *)__ptr + __offset;
+ *(unaligned_vec_ushort *)__addr = __vec;
}
static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
signed long long __offset,
signed int *__ptr) {
- *(unaligned_vec_sint *)(__ptr + __offset) = __vec;
+ signed char *__addr = (signed char *)__ptr + __offset;
+ *(unaligned_vec_sint *)__addr = __vec;
}
static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec,
signed long long __offset,
unsigned int *__ptr) {
- *(unaligned_vec_uint *)(__ptr + __offset) = __vec;
+ signed char *__addr = (signed char *)__ptr + __offset;
+ *(unaligned_vec_uint *)__addr = __vec;
}
static inline __ATTRS_o_ai void vec_xst(vector float __vec,
signed long long __offset,
float *__ptr) {
- *(unaligned_vec_float *)(__ptr + __offset) = __vec;
+ signed char *__addr = (signed char *)__ptr + __offset;
+ *(unaligned_vec_float *)__addr = __vec;
}
#ifdef __VSX__
static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
signed long long __offset,
signed long long *__ptr) {
- *(unaligned_vec_sll *)(__ptr + __offset) = __vec;
+ signed char *__addr = (signed char *)__ptr + __offset;
+ *(unaligned_vec_sll *)__addr = __vec;
}
static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
signed long long __offset,
unsigned long long *__ptr) {
- *(unaligned_vec_ull *)(__ptr + __offset) = __vec;
+ signed char *__addr = (signed char *)__ptr + __offset;
+ *(unaligned_vec_ull *)__addr = __vec;
}
static inline __ATTRS_o_ai void vec_xst(vector double __vec,
signed long long __offset,
double *__ptr) {
- *(unaligned_vec_double *)(__ptr + __offset) = __vec;
+ signed char *__addr = (signed char *)__ptr + __offset;
+ *(unaligned_vec_double *)__addr = __vec;
}
#endif
@@ -16567,13 +16585,15 @@ static inline __ATTRS_o_ai void vec_xst(vector double __vec,
static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
signed long long __offset,
signed __int128 *__ptr) {
- *(unaligned_vec_si128 *)(__ptr + __offset) = __vec;
+ signed char *__addr = (signed char *)__ptr + __offset;
+ *(unaligned_vec_si128 *)__addr = __vec;
}
static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
signed long long __offset,
unsigned __int128 *__ptr) {
- *(unaligned_vec_ui128 *)(__ptr + __offset) = __vec;
+ signed char *__addr = (signed char *)__ptr + __offset;
+ *(unaligned_vec_ui128 *)__addr = __vec;
}
#endif
diff --git a/clang/lib/Headers/arm_acle.h b/clang/lib/Headers/arm_acle.h
index 0510e6fd809f..596ea03cff2f 100644
--- a/clang/lib/Headers/arm_acle.h
+++ b/clang/lib/Headers/arm_acle.h
@@ -90,9 +90,11 @@ __swp(uint32_t __x, volatile uint32_t *__p) {
#endif
/* 8.7 NOP */
+#if !defined(_MSC_VER) || !defined(__aarch64__)
static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) {
__builtin_arm_nop();
}
+#endif
/* 9 DATA-PROCESSING INTRINSICS */
/* 9.2 Miscellaneous data-processing intrinsics */
@@ -139,6 +141,26 @@ __clzll(uint64_t __t) {
return __builtin_clzll(__t);
}
+/* CLS */
+static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
+__cls(uint32_t __t) {
+ return __builtin_arm_cls(__t);
+}
+
+static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
+__clsl(unsigned long __t) {
+#if __SIZEOF_LONG__ == 4
+ return __builtin_arm_cls(__t);
+#else
+ return __builtin_arm_cls64(__t);
+#endif
+}
+
+static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
+__clsll(uint64_t __t) {
+ return __builtin_arm_cls64(__t);
+}
+
/* REV */
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__rev(uint32_t __t) {
@@ -609,9 +631,13 @@ __jcvt(double __a) {
#define __arm_rsr(sysreg) __builtin_arm_rsr(sysreg)
#define __arm_rsr64(sysreg) __builtin_arm_rsr64(sysreg)
#define __arm_rsrp(sysreg) __builtin_arm_rsrp(sysreg)
+#define __arm_rsrf(sysreg) __builtin_bit_cast(float, __arm_rsr(sysreg))
+#define __arm_rsrf64(sysreg) __builtin_bit_cast(double, __arm_rsr64(sysreg))
#define __arm_wsr(sysreg, v) __builtin_arm_wsr(sysreg, v)
#define __arm_wsr64(sysreg, v) __builtin_arm_wsr64(sysreg, v)
#define __arm_wsrp(sysreg, v) __builtin_arm_wsrp(sysreg, v)
+#define __arm_wsrf(sysreg, v) __arm_wsr(sysreg, __builtin_bit_cast(uint32_t, v))
+#define __arm_wsrf64(sysreg, v) __arm_wsr64(sysreg, __builtin_bit_cast(uint64_t, v))
/* Memory Tagging Extensions (MTE) Intrinsics */
#if __ARM_FEATURE_MEMORY_TAGGING
diff --git a/clang/lib/Headers/arm_cmse.h b/clang/lib/Headers/arm_cmse.h
new file mode 100644
index 000000000000..ecf50ecc5c8e
--- /dev/null
+++ b/clang/lib/Headers/arm_cmse.h
@@ -0,0 +1,217 @@
+//===---- arm_cmse.h - Arm CMSE support -----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __ARM_CMSE_H
+#define __ARM_CMSE_H
+
+#if (__ARM_FEATURE_CMSE & 0x1)
+#include <stddef.h>
+#include <stdint.h>
+
+#define __ARM_CMSE_SECURE_MODE (__ARM_FEATURE_CMSE & 0x2)
+#define CMSE_MPU_READWRITE 1 /* checks if readwrite_ok field is set */
+#define CMSE_AU_NONSECURE 2 /* checks if permissions have secure field unset */
+#define CMSE_MPU_UNPRIV 4 /* sets T flag on TT insrtuction */
+#define CMSE_MPU_READ 8 /* checks if read_ok field is set */
+#define CMSE_MPU_NONSECURE 16 /* sets A flag, checks if secure field unset */
+#define CMSE_NONSECURE (CMSE_AU_NONSECURE | CMSE_MPU_NONSECURE)
+
+#define cmse_check_pointed_object(p, f) \
+ cmse_check_address_range((p), sizeof(*(p)), (f))
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+typedef union {
+ struct cmse_address_info {
+#ifdef __ARM_BIG_ENDIAN
+ /* __ARM_BIG_ENDIAN */
+#if (__ARM_CMSE_SECURE_MODE)
+ unsigned idau_region : 8;
+ unsigned idau_region_valid : 1;
+ unsigned secure : 1;
+ unsigned nonsecure_readwrite_ok : 1;
+ unsigned nonsecure_read_ok : 1;
+#else
+ unsigned : 12;
+#endif
+ unsigned readwrite_ok : 1;
+ unsigned read_ok : 1;
+#if (__ARM_CMSE_SECURE_MODE)
+ unsigned sau_region_valid : 1;
+#else
+ unsigned : 1;
+#endif
+ unsigned mpu_region_valid : 1;
+#if (__ARM_CMSE_SECURE_MODE)
+ unsigned sau_region : 8;
+#else
+ unsigned : 8;
+#endif
+ unsigned mpu_region : 8;
+
+#else /* __ARM_LITTLE_ENDIAN */
+ unsigned mpu_region : 8;
+#if (__ARM_CMSE_SECURE_MODE)
+ unsigned sau_region : 8;
+#else
+ unsigned : 8;
+#endif
+ unsigned mpu_region_valid : 1;
+#if (__ARM_CMSE_SECURE_MODE)
+ unsigned sau_region_valid : 1;
+#else
+ unsigned : 1;
+#endif
+ unsigned read_ok : 1;
+ unsigned readwrite_ok : 1;
+#if (__ARM_CMSE_SECURE_MODE)
+ unsigned nonsecure_read_ok : 1;
+ unsigned nonsecure_readwrite_ok : 1;
+ unsigned secure : 1;
+ unsigned idau_region_valid : 1;
+ unsigned idau_region : 8;
+#else
+ unsigned : 12;
+#endif
+#endif /*__ARM_LITTLE_ENDIAN */
+ } flags;
+ unsigned value;
+} cmse_address_info_t;
+
+static cmse_address_info_t __attribute__((__always_inline__, __nodebug__))
+cmse_TT(void *__p) {
+ cmse_address_info_t __u;
+ __u.value = __builtin_arm_cmse_TT(__p);
+ return __u;
+}
+static cmse_address_info_t __attribute__((__always_inline__, __nodebug__))
+cmse_TTT(void *__p) {
+ cmse_address_info_t __u;
+ __u.value = __builtin_arm_cmse_TTT(__p);
+ return __u;
+}
+
+#if __ARM_CMSE_SECURE_MODE
+static cmse_address_info_t __attribute__((__always_inline__, __nodebug__))
+cmse_TTA(void *__p) {
+ cmse_address_info_t __u;
+ __u.value = __builtin_arm_cmse_TTA(__p);
+ return __u;
+}
+static cmse_address_info_t __attribute__((__always_inline__, __nodebug__))
+cmse_TTAT(void *__p) {
+ cmse_address_info_t __u;
+ __u.value = __builtin_arm_cmse_TTAT(__p);
+ return __u;
+}
+#endif
+
+#define cmse_TT_fptr(p) cmse_TT(__builtin_bit_cast(void *, (p)))
+#define cmse_TTT_fptr(p) cmse_TTT(__builtin_bit_cast(void *, (p)))
+
+#if __ARM_CMSE_SECURE_MODE
+#define cmse_TTA_fptr(p) cmse_TTA(__builtin_bit_cast(void *, (p)))
+#define cmse_TTAT_fptr(p) cmse_TTAT(__builtin_bit_cast(void *, (p)))
+#endif
+
+static void *__attribute__((__always_inline__))
+cmse_check_address_range(void *__pb, size_t __s, int __flags) {
+ uintptr_t __begin = (uintptr_t)__pb;
+ uintptr_t __end = __begin + __s - 1;
+
+ if (__end < __begin)
+ return NULL; /* wrap around check */
+
+ /* Check whether the range crosses a 32-bytes aligned address */
+ const int __single_check = (__begin ^ __end) < 0x20u;
+
+ /* execute the right variant of the TT instructions */
+ void *__pe = (void *)__end;
+ cmse_address_info_t __permb, __perme;
+ switch (__flags & (CMSE_MPU_UNPRIV | CMSE_MPU_NONSECURE)) {
+ case 0:
+ __permb = cmse_TT(__pb);
+ __perme = __single_check ? __permb : cmse_TT(__pe);
+ break;
+ case CMSE_MPU_UNPRIV:
+ __permb = cmse_TTT(__pb);
+ __perme = __single_check ? __permb : cmse_TTT(__pe);
+ break;
+#if __ARM_CMSE_SECURE_MODE
+ case CMSE_MPU_NONSECURE:
+ __permb = cmse_TTA(__pb);
+ __perme = __single_check ? __permb : cmse_TTA(__pe);
+ break;
+ case CMSE_MPU_UNPRIV | CMSE_MPU_NONSECURE:
+ __permb = cmse_TTAT(__pb);
+ __perme = __single_check ? __permb : cmse_TTAT(__pe);
+ break;
+#endif
+ /* if CMSE_NONSECURE is specified w/o __ARM_CMSE_SECURE_MODE */
+ default:
+ return NULL;
+ }
+
+ /* check that the range does not cross MPU, SAU, or IDAU region boundaries */
+ if (__permb.value != __perme.value)
+ return NULL;
+#if !(__ARM_CMSE_SECURE_MODE)
+ /* CMSE_AU_NONSECURE is only supported when __ARM_FEATURE_CMSE & 0x2 */
+ if (__flags & CMSE_AU_NONSECURE)
+ return NULL;
+#endif
+
+ /* check the permission on the range */
+ switch (__flags & ~(CMSE_MPU_UNPRIV | CMSE_MPU_NONSECURE)) {
+#if (__ARM_CMSE_SECURE_MODE)
+ case CMSE_MPU_READ | CMSE_MPU_READWRITE | CMSE_AU_NONSECURE:
+ case CMSE_MPU_READWRITE | CMSE_AU_NONSECURE:
+ return __permb.flags.nonsecure_readwrite_ok ? __pb : NULL;
+
+ case CMSE_MPU_READ | CMSE_AU_NONSECURE:
+ return __permb.flags.nonsecure_read_ok ? __pb : NULL;
+
+ case CMSE_AU_NONSECURE:
+ return __permb.flags.secure ? NULL : __pb;
+#endif
+ case CMSE_MPU_READ | CMSE_MPU_READWRITE:
+ case CMSE_MPU_READWRITE:
+ return __permb.flags.readwrite_ok ? __pb : NULL;
+
+ case CMSE_MPU_READ:
+ return __permb.flags.read_ok ? __pb : NULL;
+
+ default:
+ return NULL;
+ }
+}
+
+#if __ARM_CMSE_SECURE_MODE
+static int __attribute__((__always_inline__, __nodebug__))
+cmse_nonsecure_caller(void) {
+ return !((uintptr_t)__builtin_return_address(0) & 1);
+}
+
+#define cmse_nsfptr_create(p) \
+ __builtin_bit_cast(__typeof__(p), \
+ (__builtin_bit_cast(uintptr_t, p) & ~(uintptr_t)1))
+
+#define cmse_is_nsfptr(p) ((__builtin_bit_cast(uintptr_t, p) & 1) == 0)
+
+#endif /* __ARM_CMSE_SECURE_MODE */
+
+void __attribute__((__noreturn__)) cmse_abort(void);
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* (__ARM_FEATURE_CMSE & 0x1) */
+
+#endif /* __ARM_CMSE_H */
diff --git a/clang/lib/Headers/avx512bwintrin.h b/clang/lib/Headers/avx512bwintrin.h
index cb2e07619cb7..376558407683 100644
--- a/clang/lib/Headers/avx512bwintrin.h
+++ b/clang/lib/Headers/avx512bwintrin.h
@@ -1731,13 +1731,13 @@ _mm512_loadu_epi16 (void const *__P)
struct __loadu_epi16 {
__m512i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi16*)__P)->__v;
+ return ((const struct __loadu_epi16*)__P)->__v;
}
static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_loadu_epi16 (__m512i __W, __mmask32 __U, void const *__P)
{
- return (__m512i) __builtin_ia32_loaddquhi512_mask ((__v32hi *) __P,
+ return (__m512i) __builtin_ia32_loaddquhi512_mask ((const __v32hi *) __P,
(__v32hi) __W,
(__mmask32) __U);
}
@@ -1745,7 +1745,7 @@ _mm512_mask_loadu_epi16 (__m512i __W, __mmask32 __U, void const *__P)
static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_loadu_epi16 (__mmask32 __U, void const *__P)
{
- return (__m512i) __builtin_ia32_loaddquhi512_mask ((__v32hi *) __P,
+ return (__m512i) __builtin_ia32_loaddquhi512_mask ((const __v32hi *) __P,
(__v32hi)
_mm512_setzero_si512 (),
(__mmask32) __U);
@@ -1757,13 +1757,13 @@ _mm512_loadu_epi8 (void const *__P)
struct __loadu_epi8 {
__m512i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi8*)__P)->__v;
+ return ((const struct __loadu_epi8*)__P)->__v;
}
static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_loadu_epi8 (__m512i __W, __mmask64 __U, void const *__P)
{
- return (__m512i) __builtin_ia32_loaddquqi512_mask ((__v64qi *) __P,
+ return (__m512i) __builtin_ia32_loaddquqi512_mask ((const __v64qi *) __P,
(__v64qi) __W,
(__mmask64) __U);
}
@@ -1771,7 +1771,7 @@ _mm512_mask_loadu_epi8 (__m512i __W, __mmask64 __U, void const *__P)
static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_loadu_epi8 (__mmask64 __U, void const *__P)
{
- return (__m512i) __builtin_ia32_loaddquqi512_mask ((__v64qi *) __P,
+ return (__m512i) __builtin_ia32_loaddquqi512_mask ((const __v64qi *) __P,
(__v64qi)
_mm512_setzero_si512 (),
(__mmask64) __U);
diff --git a/clang/lib/Headers/avx512fintrin.h b/clang/lib/Headers/avx512fintrin.h
index 698e477fe5f3..7465da379bdd 100644
--- a/clang/lib/Headers/avx512fintrin.h
+++ b/clang/lib/Headers/avx512fintrin.h
@@ -4305,7 +4305,7 @@ _mm512_loadu_si512 (void const *__P)
struct __loadu_si512 {
__m512i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_si512*)__P)->__v;
+ return ((const struct __loadu_si512*)__P)->__v;
}
static __inline __m512i __DEFAULT_FN_ATTRS512
@@ -4314,7 +4314,7 @@ _mm512_loadu_epi32 (void const *__P)
struct __loadu_epi32 {
__m512i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi32*)__P)->__v;
+ return ((const struct __loadu_epi32*)__P)->__v;
}
static __inline __m512i __DEFAULT_FN_ATTRS512
@@ -4341,7 +4341,7 @@ _mm512_loadu_epi64 (void const *__P)
struct __loadu_epi64 {
__m512i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi64*)__P)->__v;
+ return ((const struct __loadu_epi64*)__P)->__v;
}
static __inline __m512i __DEFAULT_FN_ATTRS512
@@ -4401,7 +4401,7 @@ _mm512_loadu_pd(void const *__p)
struct __loadu_pd {
__m512d_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_pd*)__p)->__v;
+ return ((const struct __loadu_pd*)__p)->__v;
}
static __inline __m512 __DEFAULT_FN_ATTRS512
@@ -4410,13 +4410,13 @@ _mm512_loadu_ps(void const *__p)
struct __loadu_ps {
__m512_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_ps*)__p)->__v;
+ return ((const struct __loadu_ps*)__p)->__v;
}
static __inline __m512 __DEFAULT_FN_ATTRS512
_mm512_load_ps(void const *__p)
{
- return *(__m512*)__p;
+ return *(const __m512*)__p;
}
static __inline __m512 __DEFAULT_FN_ATTRS512
@@ -4439,7 +4439,7 @@ _mm512_maskz_load_ps(__mmask16 __U, void const *__P)
static __inline __m512d __DEFAULT_FN_ATTRS512
_mm512_load_pd(void const *__p)
{
- return *(__m512d*)__p;
+ return *(const __m512d*)__p;
}
static __inline __m512d __DEFAULT_FN_ATTRS512
@@ -4462,19 +4462,19 @@ _mm512_maskz_load_pd(__mmask8 __U, void const *__P)
static __inline __m512i __DEFAULT_FN_ATTRS512
_mm512_load_si512 (void const *__P)
{
- return *(__m512i *) __P;
+ return *(const __m512i *) __P;
}
static __inline __m512i __DEFAULT_FN_ATTRS512
_mm512_load_epi32 (void const *__P)
{
- return *(__m512i *) __P;
+ return *(const __m512i *) __P;
}
static __inline __m512i __DEFAULT_FN_ATTRS512
_mm512_load_epi64 (void const *__P)
{
- return *(__m512i *) __P;
+ return *(const __m512i *) __P;
}
/* SIMD store ops */
@@ -8724,13 +8724,13 @@ _mm_mask_load_ss (__m128 __W, __mmask8 __U, const float* __A)
(__v4sf)_mm_setzero_ps(),
0, 4, 4, 4);
- return (__m128) __builtin_ia32_loadss128_mask ((__v4sf *) __A, src, __U & 1);
+ return (__m128) __builtin_ia32_loadss128_mask ((const __v4sf *) __A, src, __U & 1);
}
static __inline__ __m128 __DEFAULT_FN_ATTRS128
_mm_maskz_load_ss (__mmask8 __U, const float* __A)
{
- return (__m128)__builtin_ia32_loadss128_mask ((__v4sf *) __A,
+ return (__m128)__builtin_ia32_loadss128_mask ((const __v4sf *) __A,
(__v4sf) _mm_setzero_ps(),
__U & 1);
}
@@ -8742,13 +8742,13 @@ _mm_mask_load_sd (__m128d __W, __mmask8 __U, const double* __A)
(__v2df)_mm_setzero_pd(),
0, 2);
- return (__m128d) __builtin_ia32_loadsd128_mask ((__v2df *) __A, src, __U & 1);
+ return (__m128d) __builtin_ia32_loadsd128_mask ((const __v2df *) __A, src, __U & 1);
}
static __inline__ __m128d __DEFAULT_FN_ATTRS128
_mm_maskz_load_sd (__mmask8 __U, const double* __A)
{
- return (__m128d) __builtin_ia32_loadsd128_mask ((__v2df *) __A,
+ return (__m128d) __builtin_ia32_loadsd128_mask ((const __v2df *) __A,
(__v2df) _mm_setzero_pd(),
__U & 1);
}
diff --git a/clang/lib/Headers/avx512vlbwintrin.h b/clang/lib/Headers/avx512vlbwintrin.h
index ead09466bc2c..cd9f2400daa0 100644
--- a/clang/lib/Headers/avx512vlbwintrin.h
+++ b/clang/lib/Headers/avx512vlbwintrin.h
@@ -2289,13 +2289,13 @@ _mm_loadu_epi16 (void const *__P)
struct __loadu_epi16 {
__m128i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi16*)__P)->__v;
+ return ((const struct __loadu_epi16*)__P)->__v;
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_loadu_epi16 (__m128i __W, __mmask8 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_loaddquhi128_mask ((__v8hi *) __P,
+ return (__m128i) __builtin_ia32_loaddquhi128_mask ((const __v8hi *) __P,
(__v8hi) __W,
(__mmask8) __U);
}
@@ -2303,7 +2303,7 @@ _mm_mask_loadu_epi16 (__m128i __W, __mmask8 __U, void const *__P)
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_loadu_epi16 (__mmask8 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_loaddquhi128_mask ((__v8hi *) __P,
+ return (__m128i) __builtin_ia32_loaddquhi128_mask ((const __v8hi *) __P,
(__v8hi)
_mm_setzero_si128 (),
(__mmask8) __U);
@@ -2315,13 +2315,13 @@ _mm256_loadu_epi16 (void const *__P)
struct __loadu_epi16 {
__m256i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi16*)__P)->__v;
+ return ((const struct __loadu_epi16*)__P)->__v;
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_loadu_epi16 (__m256i __W, __mmask16 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_loaddquhi256_mask ((__v16hi *) __P,
+ return (__m256i) __builtin_ia32_loaddquhi256_mask ((const __v16hi *) __P,
(__v16hi) __W,
(__mmask16) __U);
}
@@ -2329,7 +2329,7 @@ _mm256_mask_loadu_epi16 (__m256i __W, __mmask16 __U, void const *__P)
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_loadu_epi16 (__mmask16 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_loaddquhi256_mask ((__v16hi *) __P,
+ return (__m256i) __builtin_ia32_loaddquhi256_mask ((const __v16hi *) __P,
(__v16hi)
_mm256_setzero_si256 (),
(__mmask16) __U);
@@ -2341,13 +2341,13 @@ _mm_loadu_epi8 (void const *__P)
struct __loadu_epi8 {
__m128i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi8*)__P)->__v;
+ return ((const struct __loadu_epi8*)__P)->__v;
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_loadu_epi8 (__m128i __W, __mmask16 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_loaddquqi128_mask ((__v16qi *) __P,
+ return (__m128i) __builtin_ia32_loaddquqi128_mask ((const __v16qi *) __P,
(__v16qi) __W,
(__mmask16) __U);
}
@@ -2355,7 +2355,7 @@ _mm_mask_loadu_epi8 (__m128i __W, __mmask16 __U, void const *__P)
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_loadu_epi8 (__mmask16 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_loaddquqi128_mask ((__v16qi *) __P,
+ return (__m128i) __builtin_ia32_loaddquqi128_mask ((const __v16qi *) __P,
(__v16qi)
_mm_setzero_si128 (),
(__mmask16) __U);
@@ -2367,13 +2367,13 @@ _mm256_loadu_epi8 (void const *__P)
struct __loadu_epi8 {
__m256i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi8*)__P)->__v;
+ return ((const struct __loadu_epi8*)__P)->__v;
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_loadu_epi8 (__m256i __W, __mmask32 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_loaddquqi256_mask ((__v32qi *) __P,
+ return (__m256i) __builtin_ia32_loaddquqi256_mask ((const __v32qi *) __P,
(__v32qi) __W,
(__mmask32) __U);
}
@@ -2381,7 +2381,7 @@ _mm256_mask_loadu_epi8 (__m256i __W, __mmask32 __U, void const *__P)
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_loadu_epi8 (__mmask32 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_loaddquqi256_mask ((__v32qi *) __P,
+ return (__m256i) __builtin_ia32_loaddquqi256_mask ((const __v32qi *) __P,
(__v32qi)
_mm256_setzero_si256 (),
(__mmask32) __U);
diff --git a/clang/lib/Headers/avx512vlintrin.h b/clang/lib/Headers/avx512vlintrin.h
index 9494fc8a6e59..9d1d791bb248 100644
--- a/clang/lib/Headers/avx512vlintrin.h
+++ b/clang/lib/Headers/avx512vlintrin.h
@@ -2505,7 +2505,7 @@ _mm256_maskz_expand_epi64 (__mmask8 __U, __m256i __A) {
static __inline__ __m128d __DEFAULT_FN_ATTRS128
_mm_mask_expandloadu_pd (__m128d __W, __mmask8 __U, void const *__P) {
- return (__m128d) __builtin_ia32_expandloaddf128_mask ((__v2df *) __P,
+ return (__m128d) __builtin_ia32_expandloaddf128_mask ((const __v2df *) __P,
(__v2df) __W,
(__mmask8)
__U);
@@ -2513,7 +2513,7 @@ _mm_mask_expandloadu_pd (__m128d __W, __mmask8 __U, void const *__P) {
static __inline__ __m128d __DEFAULT_FN_ATTRS128
_mm_maskz_expandloadu_pd (__mmask8 __U, void const *__P) {
- return (__m128d) __builtin_ia32_expandloaddf128_mask ((__v2df *) __P,
+ return (__m128d) __builtin_ia32_expandloaddf128_mask ((const __v2df *) __P,
(__v2df)
_mm_setzero_pd (),
(__mmask8)
@@ -2522,7 +2522,7 @@ _mm_maskz_expandloadu_pd (__mmask8 __U, void const *__P) {
static __inline__ __m256d __DEFAULT_FN_ATTRS256
_mm256_mask_expandloadu_pd (__m256d __W, __mmask8 __U, void const *__P) {
- return (__m256d) __builtin_ia32_expandloaddf256_mask ((__v4df *) __P,
+ return (__m256d) __builtin_ia32_expandloaddf256_mask ((const __v4df *) __P,
(__v4df) __W,
(__mmask8)
__U);
@@ -2530,7 +2530,7 @@ _mm256_mask_expandloadu_pd (__m256d __W, __mmask8 __U, void const *__P) {
static __inline__ __m256d __DEFAULT_FN_ATTRS256
_mm256_maskz_expandloadu_pd (__mmask8 __U, void const *__P) {
- return (__m256d) __builtin_ia32_expandloaddf256_mask ((__v4df *) __P,
+ return (__m256d) __builtin_ia32_expandloaddf256_mask ((const __v4df *) __P,
(__v4df)
_mm256_setzero_pd (),
(__mmask8)
@@ -2539,7 +2539,7 @@ _mm256_maskz_expandloadu_pd (__mmask8 __U, void const *__P) {
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_expandloadu_epi64 (__m128i __W, __mmask8 __U, void const *__P) {
- return (__m128i) __builtin_ia32_expandloaddi128_mask ((__v2di *) __P,
+ return (__m128i) __builtin_ia32_expandloaddi128_mask ((const __v2di *) __P,
(__v2di) __W,
(__mmask8)
__U);
@@ -2547,7 +2547,7 @@ _mm_mask_expandloadu_epi64 (__m128i __W, __mmask8 __U, void const *__P) {
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_expandloadu_epi64 (__mmask8 __U, void const *__P) {
- return (__m128i) __builtin_ia32_expandloaddi128_mask ((__v2di *) __P,
+ return (__m128i) __builtin_ia32_expandloaddi128_mask ((const __v2di *) __P,
(__v2di)
_mm_setzero_si128 (),
(__mmask8)
@@ -2557,7 +2557,7 @@ _mm_maskz_expandloadu_epi64 (__mmask8 __U, void const *__P) {
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_expandloadu_epi64 (__m256i __W, __mmask8 __U,
void const *__P) {
- return (__m256i) __builtin_ia32_expandloaddi256_mask ((__v4di *) __P,
+ return (__m256i) __builtin_ia32_expandloaddi256_mask ((const __v4di *) __P,
(__v4di) __W,
(__mmask8)
__U);
@@ -2565,7 +2565,7 @@ _mm256_mask_expandloadu_epi64 (__m256i __W, __mmask8 __U,
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_expandloadu_epi64 (__mmask8 __U, void const *__P) {
- return (__m256i) __builtin_ia32_expandloaddi256_mask ((__v4di *) __P,
+ return (__m256i) __builtin_ia32_expandloaddi256_mask ((const __v4di *) __P,
(__v4di)
_mm256_setzero_si256 (),
(__mmask8)
@@ -2574,14 +2574,14 @@ _mm256_maskz_expandloadu_epi64 (__mmask8 __U, void const *__P) {
static __inline__ __m128 __DEFAULT_FN_ATTRS128
_mm_mask_expandloadu_ps (__m128 __W, __mmask8 __U, void const *__P) {
- return (__m128) __builtin_ia32_expandloadsf128_mask ((__v4sf *) __P,
+ return (__m128) __builtin_ia32_expandloadsf128_mask ((const __v4sf *) __P,
(__v4sf) __W,
(__mmask8) __U);
}
static __inline__ __m128 __DEFAULT_FN_ATTRS128
_mm_maskz_expandloadu_ps (__mmask8 __U, void const *__P) {
- return (__m128) __builtin_ia32_expandloadsf128_mask ((__v4sf *) __P,
+ return (__m128) __builtin_ia32_expandloadsf128_mask ((const __v4sf *) __P,
(__v4sf)
_mm_setzero_ps (),
(__mmask8)
@@ -2590,14 +2590,14 @@ _mm_maskz_expandloadu_ps (__mmask8 __U, void const *__P) {
static __inline__ __m256 __DEFAULT_FN_ATTRS256
_mm256_mask_expandloadu_ps (__m256 __W, __mmask8 __U, void const *__P) {
- return (__m256) __builtin_ia32_expandloadsf256_mask ((__v8sf *) __P,
+ return (__m256) __builtin_ia32_expandloadsf256_mask ((const __v8sf *) __P,
(__v8sf) __W,
(__mmask8) __U);
}
static __inline__ __m256 __DEFAULT_FN_ATTRS256
_mm256_maskz_expandloadu_ps (__mmask8 __U, void const *__P) {
- return (__m256) __builtin_ia32_expandloadsf256_mask ((__v8sf *) __P,
+ return (__m256) __builtin_ia32_expandloadsf256_mask ((const __v8sf *) __P,
(__v8sf)
_mm256_setzero_ps (),
(__mmask8)
@@ -2606,7 +2606,7 @@ _mm256_maskz_expandloadu_ps (__mmask8 __U, void const *__P) {
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_expandloadu_epi32 (__m128i __W, __mmask8 __U, void const *__P) {
- return (__m128i) __builtin_ia32_expandloadsi128_mask ((__v4si *) __P,
+ return (__m128i) __builtin_ia32_expandloadsi128_mask ((const __v4si *) __P,
(__v4si) __W,
(__mmask8)
__U);
@@ -2614,7 +2614,7 @@ _mm_mask_expandloadu_epi32 (__m128i __W, __mmask8 __U, void const *__P) {
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_expandloadu_epi32 (__mmask8 __U, void const *__P) {
- return (__m128i) __builtin_ia32_expandloadsi128_mask ((__v4si *) __P,
+ return (__m128i) __builtin_ia32_expandloadsi128_mask ((const __v4si *) __P,
(__v4si)
_mm_setzero_si128 (),
(__mmask8) __U);
@@ -2623,7 +2623,7 @@ _mm_maskz_expandloadu_epi32 (__mmask8 __U, void const *__P) {
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_expandloadu_epi32 (__m256i __W, __mmask8 __U,
void const *__P) {
- return (__m256i) __builtin_ia32_expandloadsi256_mask ((__v8si *) __P,
+ return (__m256i) __builtin_ia32_expandloadsi256_mask ((const __v8si *) __P,
(__v8si) __W,
(__mmask8)
__U);
@@ -2631,7 +2631,7 @@ _mm256_mask_expandloadu_epi32 (__m256i __W, __mmask8 __U,
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_expandloadu_epi32 (__mmask8 __U, void const *__P) {
- return (__m256i) __builtin_ia32_expandloadsi256_mask ((__v8si *) __P,
+ return (__m256i) __builtin_ia32_expandloadsi256_mask ((const __v8si *) __P,
(__v8si)
_mm256_setzero_si256 (),
(__mmask8)
@@ -5073,13 +5073,13 @@ _mm256_maskz_mov_epi32 (__mmask8 __U, __m256i __A)
static __inline __m128i __DEFAULT_FN_ATTRS128
_mm_load_epi32 (void const *__P)
{
- return *(__m128i *) __P;
+ return *(const __m128i *) __P;
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_load_epi32 (__m128i __W, __mmask8 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_movdqa32load128_mask ((__v4si *) __P,
+ return (__m128i) __builtin_ia32_movdqa32load128_mask ((const __v4si *) __P,
(__v4si) __W,
(__mmask8)
__U);
@@ -5088,7 +5088,7 @@ _mm_mask_load_epi32 (__m128i __W, __mmask8 __U, void const *__P)
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_load_epi32 (__mmask8 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_movdqa32load128_mask ((__v4si *) __P,
+ return (__m128i) __builtin_ia32_movdqa32load128_mask ((const __v4si *) __P,
(__v4si)
_mm_setzero_si128 (),
(__mmask8)
@@ -5098,13 +5098,13 @@ _mm_maskz_load_epi32 (__mmask8 __U, void const *__P)
static __inline __m256i __DEFAULT_FN_ATTRS256
_mm256_load_epi32 (void const *__P)
{
- return *(__m256i *) __P;
+ return *(const __m256i *) __P;
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_load_epi32 (__m256i __W, __mmask8 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_movdqa32load256_mask ((__v8si *) __P,
+ return (__m256i) __builtin_ia32_movdqa32load256_mask ((const __v8si *) __P,
(__v8si) __W,
(__mmask8)
__U);
@@ -5113,7 +5113,7 @@ _mm256_mask_load_epi32 (__m256i __W, __mmask8 __U, void const *__P)
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_load_epi32 (__mmask8 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_movdqa32load256_mask ((__v8si *) __P,
+ return (__m256i) __builtin_ia32_movdqa32load256_mask ((const __v8si *) __P,
(__v8si)
_mm256_setzero_si256 (),
(__mmask8)
@@ -5183,13 +5183,13 @@ _mm256_maskz_mov_epi64 (__mmask8 __U, __m256i __A)
static __inline __m128i __DEFAULT_FN_ATTRS128
_mm_load_epi64 (void const *__P)
{
- return *(__m128i *) __P;
+ return *(const __m128i *) __P;
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_load_epi64 (__m128i __W, __mmask8 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_movdqa64load128_mask ((__v2di *) __P,
+ return (__m128i) __builtin_ia32_movdqa64load128_mask ((const __v2di *) __P,
(__v2di) __W,
(__mmask8)
__U);
@@ -5198,7 +5198,7 @@ _mm_mask_load_epi64 (__m128i __W, __mmask8 __U, void const *__P)
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_load_epi64 (__mmask8 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_movdqa64load128_mask ((__v2di *) __P,
+ return (__m128i) __builtin_ia32_movdqa64load128_mask ((const __v2di *) __P,
(__v2di)
_mm_setzero_si128 (),
(__mmask8)
@@ -5208,13 +5208,13 @@ _mm_maskz_load_epi64 (__mmask8 __U, void const *__P)
static __inline __m256i __DEFAULT_FN_ATTRS256
_mm256_load_epi64 (void const *__P)
{
- return *(__m256i *) __P;
+ return *(const __m256i *) __P;
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_load_epi64 (__m256i __W, __mmask8 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_movdqa64load256_mask ((__v4di *) __P,
+ return (__m256i) __builtin_ia32_movdqa64load256_mask ((const __v4di *) __P,
(__v4di) __W,
(__mmask8)
__U);
@@ -5223,7 +5223,7 @@ _mm256_mask_load_epi64 (__m256i __W, __mmask8 __U, void const *__P)
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_load_epi64 (__mmask8 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_movdqa64load256_mask ((__v4di *) __P,
+ return (__m256i) __builtin_ia32_movdqa64load256_mask ((const __v4di *) __P,
(__v4di)
_mm256_setzero_si256 (),
(__mmask8)
@@ -5430,7 +5430,7 @@ _mm256_maskz_set1_epi64 (__mmask8 __M, long long __A)
static __inline__ __m128d __DEFAULT_FN_ATTRS128
_mm_mask_load_pd (__m128d __W, __mmask8 __U, void const *__P)
{
- return (__m128d) __builtin_ia32_loadapd128_mask ((__v2df *) __P,
+ return (__m128d) __builtin_ia32_loadapd128_mask ((const __v2df *) __P,
(__v2df) __W,
(__mmask8) __U);
}
@@ -5438,7 +5438,7 @@ _mm_mask_load_pd (__m128d __W, __mmask8 __U, void const *__P)
static __inline__ __m128d __DEFAULT_FN_ATTRS128
_mm_maskz_load_pd (__mmask8 __U, void const *__P)
{
- return (__m128d) __builtin_ia32_loadapd128_mask ((__v2df *) __P,
+ return (__m128d) __builtin_ia32_loadapd128_mask ((const __v2df *) __P,
(__v2df)
_mm_setzero_pd (),
(__mmask8) __U);
@@ -5447,7 +5447,7 @@ _mm_maskz_load_pd (__mmask8 __U, void const *__P)
static __inline__ __m256d __DEFAULT_FN_ATTRS256
_mm256_mask_load_pd (__m256d __W, __mmask8 __U, void const *__P)
{
- return (__m256d) __builtin_ia32_loadapd256_mask ((__v4df *) __P,
+ return (__m256d) __builtin_ia32_loadapd256_mask ((const __v4df *) __P,
(__v4df) __W,
(__mmask8) __U);
}
@@ -5455,7 +5455,7 @@ _mm256_mask_load_pd (__m256d __W, __mmask8 __U, void const *__P)
static __inline__ __m256d __DEFAULT_FN_ATTRS256
_mm256_maskz_load_pd (__mmask8 __U, void const *__P)
{
- return (__m256d) __builtin_ia32_loadapd256_mask ((__v4df *) __P,
+ return (__m256d) __builtin_ia32_loadapd256_mask ((const __v4df *) __P,
(__v4df)
_mm256_setzero_pd (),
(__mmask8) __U);
@@ -5464,7 +5464,7 @@ _mm256_maskz_load_pd (__mmask8 __U, void const *__P)
static __inline__ __m128 __DEFAULT_FN_ATTRS128
_mm_mask_load_ps (__m128 __W, __mmask8 __U, void const *__P)
{
- return (__m128) __builtin_ia32_loadaps128_mask ((__v4sf *) __P,
+ return (__m128) __builtin_ia32_loadaps128_mask ((const __v4sf *) __P,
(__v4sf) __W,
(__mmask8) __U);
}
@@ -5472,7 +5472,7 @@ _mm_mask_load_ps (__m128 __W, __mmask8 __U, void const *__P)
static __inline__ __m128 __DEFAULT_FN_ATTRS128
_mm_maskz_load_ps (__mmask8 __U, void const *__P)
{
- return (__m128) __builtin_ia32_loadaps128_mask ((__v4sf *) __P,
+ return (__m128) __builtin_ia32_loadaps128_mask ((const __v4sf *) __P,
(__v4sf)
_mm_setzero_ps (),
(__mmask8) __U);
@@ -5481,7 +5481,7 @@ _mm_maskz_load_ps (__mmask8 __U, void const *__P)
static __inline__ __m256 __DEFAULT_FN_ATTRS256
_mm256_mask_load_ps (__m256 __W, __mmask8 __U, void const *__P)
{
- return (__m256) __builtin_ia32_loadaps256_mask ((__v8sf *) __P,
+ return (__m256) __builtin_ia32_loadaps256_mask ((const __v8sf *) __P,
(__v8sf) __W,
(__mmask8) __U);
}
@@ -5489,7 +5489,7 @@ _mm256_mask_load_ps (__m256 __W, __mmask8 __U, void const *__P)
static __inline__ __m256 __DEFAULT_FN_ATTRS256
_mm256_maskz_load_ps (__mmask8 __U, void const *__P)
{
- return (__m256) __builtin_ia32_loadaps256_mask ((__v8sf *) __P,
+ return (__m256) __builtin_ia32_loadaps256_mask ((const __v8sf *) __P,
(__v8sf)
_mm256_setzero_ps (),
(__mmask8) __U);
@@ -5501,13 +5501,13 @@ _mm_loadu_epi64 (void const *__P)
struct __loadu_epi64 {
__m128i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi64*)__P)->__v;
+ return ((const struct __loadu_epi64*)__P)->__v;
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_loadu_epi64 (__m128i __W, __mmask8 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_loaddqudi128_mask ((__v2di *) __P,
+ return (__m128i) __builtin_ia32_loaddqudi128_mask ((const __v2di *) __P,
(__v2di) __W,
(__mmask8) __U);
}
@@ -5515,7 +5515,7 @@ _mm_mask_loadu_epi64 (__m128i __W, __mmask8 __U, void const *__P)
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_loadu_epi64 (__mmask8 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_loaddqudi128_mask ((__v2di *) __P,
+ return (__m128i) __builtin_ia32_loaddqudi128_mask ((const __v2di *) __P,
(__v2di)
_mm_setzero_si128 (),
(__mmask8) __U);
@@ -5527,13 +5527,13 @@ _mm256_loadu_epi64 (void const *__P)
struct __loadu_epi64 {
__m256i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi64*)__P)->__v;
+ return ((const struct __loadu_epi64*)__P)->__v;
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_loadu_epi64 (__m256i __W, __mmask8 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_loaddqudi256_mask ((__v4di *) __P,
+ return (__m256i) __builtin_ia32_loaddqudi256_mask ((const __v4di *) __P,
(__v4di) __W,
(__mmask8) __U);
}
@@ -5541,7 +5541,7 @@ _mm256_mask_loadu_epi64 (__m256i __W, __mmask8 __U, void const *__P)
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_loadu_epi64 (__mmask8 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_loaddqudi256_mask ((__v4di *) __P,
+ return (__m256i) __builtin_ia32_loaddqudi256_mask ((const __v4di *) __P,
(__v4di)
_mm256_setzero_si256 (),
(__mmask8) __U);
@@ -5553,13 +5553,13 @@ _mm_loadu_epi32 (void const *__P)
struct __loadu_epi32 {
__m128i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi32*)__P)->__v;
+ return ((const struct __loadu_epi32*)__P)->__v;
}
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_loadu_epi32 (__m128i __W, __mmask8 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_loaddqusi128_mask ((__v4si *) __P,
+ return (__m128i) __builtin_ia32_loaddqusi128_mask ((const __v4si *) __P,
(__v4si) __W,
(__mmask8) __U);
}
@@ -5567,7 +5567,7 @@ _mm_mask_loadu_epi32 (__m128i __W, __mmask8 __U, void const *__P)
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_loadu_epi32 (__mmask8 __U, void const *__P)
{
- return (__m128i) __builtin_ia32_loaddqusi128_mask ((__v4si *) __P,
+ return (__m128i) __builtin_ia32_loaddqusi128_mask ((const __v4si *) __P,
(__v4si)
_mm_setzero_si128 (),
(__mmask8) __U);
@@ -5579,13 +5579,13 @@ _mm256_loadu_epi32 (void const *__P)
struct __loadu_epi32 {
__m256i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_epi32*)__P)->__v;
+ return ((const struct __loadu_epi32*)__P)->__v;
}
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_mask_loadu_epi32 (__m256i __W, __mmask8 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_loaddqusi256_mask ((__v8si *) __P,
+ return (__m256i) __builtin_ia32_loaddqusi256_mask ((const __v8si *) __P,
(__v8si) __W,
(__mmask8) __U);
}
@@ -5593,7 +5593,7 @@ _mm256_mask_loadu_epi32 (__m256i __W, __mmask8 __U, void const *__P)
static __inline__ __m256i __DEFAULT_FN_ATTRS256
_mm256_maskz_loadu_epi32 (__mmask8 __U, void const *__P)
{
- return (__m256i) __builtin_ia32_loaddqusi256_mask ((__v8si *) __P,
+ return (__m256i) __builtin_ia32_loaddqusi256_mask ((const __v8si *) __P,
(__v8si)
_mm256_setzero_si256 (),
(__mmask8) __U);
@@ -5602,7 +5602,7 @@ _mm256_maskz_loadu_epi32 (__mmask8 __U, void const *__P)
static __inline__ __m128d __DEFAULT_FN_ATTRS128
_mm_mask_loadu_pd (__m128d __W, __mmask8 __U, void const *__P)
{
- return (__m128d) __builtin_ia32_loadupd128_mask ((__v2df *) __P,
+ return (__m128d) __builtin_ia32_loadupd128_mask ((const __v2df *) __P,
(__v2df) __W,
(__mmask8) __U);
}
@@ -5610,7 +5610,7 @@ _mm_mask_loadu_pd (__m128d __W, __mmask8 __U, void const *__P)
static __inline__ __m128d __DEFAULT_FN_ATTRS128
_mm_maskz_loadu_pd (__mmask8 __U, void const *__P)
{
- return (__m128d) __builtin_ia32_loadupd128_mask ((__v2df *) __P,
+ return (__m128d) __builtin_ia32_loadupd128_mask ((const __v2df *) __P,
(__v2df)
_mm_setzero_pd (),
(__mmask8) __U);
@@ -5619,7 +5619,7 @@ _mm_maskz_loadu_pd (__mmask8 __U, void const *__P)
static __inline__ __m256d __DEFAULT_FN_ATTRS256
_mm256_mask_loadu_pd (__m256d __W, __mmask8 __U, void const *__P)
{
- return (__m256d) __builtin_ia32_loadupd256_mask ((__v4df *) __P,
+ return (__m256d) __builtin_ia32_loadupd256_mask ((const __v4df *) __P,
(__v4df) __W,
(__mmask8) __U);
}
@@ -5627,7 +5627,7 @@ _mm256_mask_loadu_pd (__m256d __W, __mmask8 __U, void const *__P)
static __inline__ __m256d __DEFAULT_FN_ATTRS256
_mm256_maskz_loadu_pd (__mmask8 __U, void const *__P)
{
- return (__m256d) __builtin_ia32_loadupd256_mask ((__v4df *) __P,
+ return (__m256d) __builtin_ia32_loadupd256_mask ((const __v4df *) __P,
(__v4df)
_mm256_setzero_pd (),
(__mmask8) __U);
@@ -5636,7 +5636,7 @@ _mm256_maskz_loadu_pd (__mmask8 __U, void const *__P)
static __inline__ __m128 __DEFAULT_FN_ATTRS128
_mm_mask_loadu_ps (__m128 __W, __mmask8 __U, void const *__P)
{
- return (__m128) __builtin_ia32_loadups128_mask ((__v4sf *) __P,
+ return (__m128) __builtin_ia32_loadups128_mask ((const __v4sf *) __P,
(__v4sf) __W,
(__mmask8) __U);
}
@@ -5644,7 +5644,7 @@ _mm_mask_loadu_ps (__m128 __W, __mmask8 __U, void const *__P)
static __inline__ __m128 __DEFAULT_FN_ATTRS128
_mm_maskz_loadu_ps (__mmask8 __U, void const *__P)
{
- return (__m128) __builtin_ia32_loadups128_mask ((__v4sf *) __P,
+ return (__m128) __builtin_ia32_loadups128_mask ((const __v4sf *) __P,
(__v4sf)
_mm_setzero_ps (),
(__mmask8) __U);
@@ -5653,7 +5653,7 @@ _mm_maskz_loadu_ps (__mmask8 __U, void const *__P)
static __inline__ __m256 __DEFAULT_FN_ATTRS256
_mm256_mask_loadu_ps (__m256 __W, __mmask8 __U, void const *__P)
{
- return (__m256) __builtin_ia32_loadups256_mask ((__v8sf *) __P,
+ return (__m256) __builtin_ia32_loadups256_mask ((const __v8sf *) __P,
(__v8sf) __W,
(__mmask8) __U);
}
@@ -5661,7 +5661,7 @@ _mm256_mask_loadu_ps (__m256 __W, __mmask8 __U, void const *__P)
static __inline__ __m256 __DEFAULT_FN_ATTRS256
_mm256_maskz_loadu_ps (__mmask8 __U, void const *__P)
{
- return (__m256) __builtin_ia32_loadups256_mask ((__v8sf *) __P,
+ return (__m256) __builtin_ia32_loadups256_mask ((const __v8sf *) __P,
(__v8sf)
_mm256_setzero_ps (),
(__mmask8) __U);
diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h
index a01240b9d157..84421bf1b9d5 100644
--- a/clang/lib/Headers/avxintrin.h
+++ b/clang/lib/Headers/avxintrin.h
@@ -3069,7 +3069,7 @@ _mm256_broadcast_ps(__m128 const *__a)
static __inline __m256d __DEFAULT_FN_ATTRS
_mm256_load_pd(double const *__p)
{
- return *(__m256d *)__p;
+ return *(const __m256d *)__p;
}
/// Loads 8 single-precision floating point values from a 32-byte aligned
@@ -3085,7 +3085,7 @@ _mm256_load_pd(double const *__p)
static __inline __m256 __DEFAULT_FN_ATTRS
_mm256_load_ps(float const *__p)
{
- return *(__m256 *)__p;
+ return *(const __m256 *)__p;
}
/// Loads 4 double-precision floating point values from an unaligned
@@ -3105,7 +3105,7 @@ _mm256_loadu_pd(double const *__p)
struct __loadu_pd {
__m256d_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_pd*)__p)->__v;
+ return ((const struct __loadu_pd*)__p)->__v;
}
/// Loads 8 single-precision floating point values from an unaligned
@@ -3125,7 +3125,7 @@ _mm256_loadu_ps(float const *__p)
struct __loadu_ps {
__m256_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_ps*)__p)->__v;
+ return ((const struct __loadu_ps*)__p)->__v;
}
/// Loads 256 bits of integer data from a 32-byte aligned memory
@@ -3161,7 +3161,7 @@ _mm256_loadu_si256(__m256i_u const *__p)
struct __loadu_si256 {
__m256i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_si256*)__p)->__v;
+ return ((const struct __loadu_si256*)__p)->__v;
}
/// Loads 256 bits of integer data from an unaligned memory location
diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h
index c8fefdfc792a..993c688ce818 100644
--- a/clang/lib/Headers/emmintrin.h
+++ b/clang/lib/Headers/emmintrin.h
@@ -1578,7 +1578,7 @@ _mm_cvtsd_f64(__m128d __a)
static __inline__ __m128d __DEFAULT_FN_ATTRS
_mm_load_pd(double const *__dp)
{
- return *(__m128d*)__dp;
+ return *(const __m128d*)__dp;
}
/// Loads a double-precision floating-point value from a specified memory
@@ -1599,7 +1599,7 @@ _mm_load1_pd(double const *__dp)
struct __mm_load1_pd_struct {
double __u;
} __attribute__((__packed__, __may_alias__));
- double __u = ((struct __mm_load1_pd_struct*)__dp)->__u;
+ double __u = ((const struct __mm_load1_pd_struct*)__dp)->__u;
return __extension__ (__m128d){ __u, __u };
}
@@ -1622,7 +1622,7 @@ _mm_load1_pd(double const *__dp)
static __inline__ __m128d __DEFAULT_FN_ATTRS
_mm_loadr_pd(double const *__dp)
{
- __m128d __u = *(__m128d*)__dp;
+ __m128d __u = *(const __m128d*)__dp;
return __builtin_shufflevector((__v2df)__u, (__v2df)__u, 1, 0);
}
@@ -1643,7 +1643,7 @@ _mm_loadu_pd(double const *__dp)
struct __loadu_pd {
__m128d_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_pd*)__dp)->__v;
+ return ((const struct __loadu_pd*)__dp)->__v;
}
/// Loads a 64-bit integer value to the low element of a 128-bit integer
@@ -1663,7 +1663,7 @@ _mm_loadu_si64(void const *__a)
struct __loadu_si64 {
long long __v;
} __attribute__((__packed__, __may_alias__));
- long long __u = ((struct __loadu_si64*)__a)->__v;
+ long long __u = ((const struct __loadu_si64*)__a)->__v;
return __extension__ (__m128i)(__v2di){__u, 0LL};
}
@@ -1684,7 +1684,7 @@ _mm_loadu_si32(void const *__a)
struct __loadu_si32 {
int __v;
} __attribute__((__packed__, __may_alias__));
- int __u = ((struct __loadu_si32*)__a)->__v;
+ int __u = ((const struct __loadu_si32*)__a)->__v;
return __extension__ (__m128i)(__v4si){__u, 0, 0, 0};
}
@@ -1705,7 +1705,7 @@ _mm_loadu_si16(void const *__a)
struct __loadu_si16 {
short __v;
} __attribute__((__packed__, __may_alias__));
- short __u = ((struct __loadu_si16*)__a)->__v;
+ short __u = ((const struct __loadu_si16*)__a)->__v;
return __extension__ (__m128i)(__v8hi){__u, 0, 0, 0, 0, 0, 0, 0};
}
@@ -1726,7 +1726,7 @@ _mm_load_sd(double const *__dp)
struct __mm_load_sd_struct {
double __u;
} __attribute__((__packed__, __may_alias__));
- double __u = ((struct __mm_load_sd_struct*)__dp)->__u;
+ double __u = ((const struct __mm_load_sd_struct*)__dp)->__u;
return __extension__ (__m128d){ __u, 0 };
}
@@ -1753,7 +1753,7 @@ _mm_loadh_pd(__m128d __a, double const *__dp)
struct __mm_loadh_pd_struct {
double __u;
} __attribute__((__packed__, __may_alias__));
- double __u = ((struct __mm_loadh_pd_struct*)__dp)->__u;
+ double __u = ((const struct __mm_loadh_pd_struct*)__dp)->__u;
return __extension__ (__m128d){ __a[0], __u };
}
@@ -1780,7 +1780,7 @@ _mm_loadl_pd(__m128d __a, double const *__dp)
struct __mm_loadl_pd_struct {
double __u;
} __attribute__((__packed__, __may_alias__));
- double __u = ((struct __mm_loadl_pd_struct*)__dp)->__u;
+ double __u = ((const struct __mm_loadl_pd_struct*)__dp)->__u;
return __extension__ (__m128d){ __u, __a[1] };
}
@@ -2288,7 +2288,7 @@ _mm_adds_epu16(__m128i __a, __m128i __b)
return (__m128i)__builtin_ia32_paddusw128((__v8hi)__a, (__v8hi)__b);
}
-/// Computes the rounded avarages of corresponding elements of two
+/// Computes the rounded averages of corresponding elements of two
/// 128-bit unsigned [16 x i8] vectors, saving each result in the
/// corresponding element of a 128-bit result vector of [16 x i8].
///
@@ -2308,7 +2308,7 @@ _mm_avg_epu8(__m128i __a, __m128i __b)
return (__m128i)__builtin_ia32_pavgb128((__v16qi)__a, (__v16qi)__b);
}
-/// Computes the rounded avarages of corresponding elements of two
+/// Computes the rounded averages of corresponding elements of two
/// 128-bit unsigned [8 x i16] vectors, saving each result in the
/// corresponding element of a 128-bit result vector of [8 x i16].
///
@@ -3550,7 +3550,7 @@ _mm_loadu_si128(__m128i_u const *__p)
struct __loadu_si128 {
__m128i_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_si128*)__p)->__v;
+ return ((const struct __loadu_si128*)__p)->__v;
}
/// Returns a vector of [2 x i64] where the lower element is taken from
@@ -3571,7 +3571,7 @@ _mm_loadl_epi64(__m128i_u const *__p)
struct __mm_loadl_epi64_struct {
long long __u;
} __attribute__((__packed__, __may_alias__));
- return __extension__ (__m128i) { ((struct __mm_loadl_epi64_struct*)__p)->__u, 0};
+ return __extension__ (__m128i) { ((const struct __mm_loadl_epi64_struct*)__p)->__u, 0};
}
/// Generates a 128-bit vector of [4 x i32] with unspecified content.
diff --git a/clang/lib/Headers/immintrin.h b/clang/lib/Headers/immintrin.h
index ae900ee85b76..edf8c42ec491 100644
--- a/clang/lib/Headers/immintrin.h
+++ b/clang/lib/Headers/immintrin.h
@@ -301,7 +301,7 @@ _loadbe_i16(void const * __P) {
struct __loadu_i16 {
short __v;
} __attribute__((__packed__, __may_alias__));
- return __builtin_bswap16(((struct __loadu_i16*)__P)->__v);
+ return __builtin_bswap16(((const struct __loadu_i16*)__P)->__v);
}
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("movbe")))
@@ -317,7 +317,7 @@ _loadbe_i32(void const * __P) {
struct __loadu_i32 {
int __v;
} __attribute__((__packed__, __may_alias__));
- return __builtin_bswap32(((struct __loadu_i32*)__P)->__v);
+ return __builtin_bswap32(((const struct __loadu_i32*)__P)->__v);
}
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("movbe")))
@@ -334,7 +334,7 @@ _loadbe_i64(void const * __P) {
struct __loadu_i64 {
long long __v;
} __attribute__((__packed__, __may_alias__));
- return __builtin_bswap64(((struct __loadu_i64*)__P)->__v);
+ return __builtin_bswap64(((const struct __loadu_i64*)__P)->__v);
}
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("movbe")))
diff --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h
index 9786ba147fca..f85f7a2beb49 100644
--- a/clang/lib/Headers/intrin.h
+++ b/clang/lib/Headers/intrin.h
@@ -36,6 +36,12 @@
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
+#if __x86_64__
+#define __LPTRINT_TYPE__ __int64
+#else
+#define __LPTRINT_TYPE__ long
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -94,8 +100,7 @@ void __outword(unsigned short, unsigned short);
void __outwordstring(unsigned short, unsigned short *, unsigned long);
unsigned long __readcr0(void);
unsigned long __readcr2(void);
-static __inline__
-unsigned long __readcr3(void);
+unsigned __LPTRINT_TYPE__ __readcr3(void);
unsigned long __readcr4(void);
unsigned long __readcr8(void);
unsigned int __readdr(unsigned int);
@@ -132,7 +137,7 @@ void __vmx_vmptrst(unsigned __int64 *);
void __wbinvd(void);
void __writecr0(unsigned int);
static __inline__
-void __writecr3(unsigned int);
+void __writecr3(unsigned __INTPTR_TYPE__);
void __writecr4(unsigned int);
void __writecr8(unsigned int);
void __writedr(unsigned int, unsigned int);
@@ -164,7 +169,6 @@ long _InterlockedExchangeAdd_HLEAcquire(long volatile *, long);
long _InterlockedExchangeAdd_HLERelease(long volatile *, long);
__int64 _InterlockedExchangeAdd64_HLEAcquire(__int64 volatile *, __int64);
__int64 _InterlockedExchangeAdd64_HLERelease(__int64 volatile *, __int64);
-void __cdecl _invpcid(unsigned int, void *);
static __inline__ void
__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
_ReadBarrier(void);
@@ -565,24 +569,26 @@ __readmsr(unsigned long __register) {
__asm__ ("rdmsr" : "=d"(__edx), "=a"(__eax) : "c"(__register));
return (((unsigned __int64)__edx) << 32) | (unsigned __int64)__eax;
}
+#endif
-static __inline__ unsigned long __DEFAULT_FN_ATTRS
+static __inline__ unsigned __LPTRINT_TYPE__ __DEFAULT_FN_ATTRS
__readcr3(void) {
- unsigned long __cr3_val;
- __asm__ __volatile__ ("mov %%cr3, %0" : "=q"(__cr3_val) : : "memory");
+ unsigned __LPTRINT_TYPE__ __cr3_val;
+ __asm__ __volatile__ ("mov %%cr3, %0" : "=r"(__cr3_val) : : "memory");
return __cr3_val;
}
static __inline__ void __DEFAULT_FN_ATTRS
-__writecr3(unsigned int __cr3_val) {
- __asm__ ("mov %0, %%cr3" : : "q"(__cr3_val) : "memory");
+__writecr3(unsigned __INTPTR_TYPE__ __cr3_val) {
+ __asm__ ("mov %0, %%cr3" : : "r"(__cr3_val) : "memory");
}
-#endif
#ifdef __cplusplus
}
#endif
+#undef __LPTRINT_TYPE__
+
#undef __DEFAULT_FN_ATTRS
#endif /* __INTRIN_H */
diff --git a/clang/lib/Headers/mwaitxintrin.h b/clang/lib/Headers/mwaitxintrin.h
index bca395b0e0d1..ed485380af79 100644
--- a/clang/lib/Headers/mwaitxintrin.h
+++ b/clang/lib/Headers/mwaitxintrin.h
@@ -17,9 +17,9 @@
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("mwaitx")))
static __inline__ void __DEFAULT_FN_ATTRS
-_mm_monitorx(void const * __p, unsigned __extensions, unsigned __hints)
+_mm_monitorx(void * __p, unsigned __extensions, unsigned __hints)
{
- __builtin_ia32_monitorx((void *)__p, __extensions, __hints);
+ __builtin_ia32_monitorx(__p, __extensions, __hints);
}
static __inline__ void __DEFAULT_FN_ATTRS
diff --git a/clang/lib/Headers/pmmintrin.h b/clang/lib/Headers/pmmintrin.h
index c376f298cc30..a83b2eb6d8e2 100644
--- a/clang/lib/Headers/pmmintrin.h
+++ b/clang/lib/Headers/pmmintrin.h
@@ -263,7 +263,7 @@ _mm_movedup_pd(__m128d __a)
static __inline__ void __DEFAULT_FN_ATTRS
_mm_monitor(void const *__p, unsigned __extensions, unsigned __hints)
{
- __builtin_ia32_monitor((void *)__p, __extensions, __hints);
+ __builtin_ia32_monitor(__p, __extensions, __hints);
}
/// Used with the MONITOR instruction to wait while the processor is in
diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h
index 75ff37655bda..0e61eab44aeb 100644
--- a/clang/lib/Headers/xmmintrin.h
+++ b/clang/lib/Headers/xmmintrin.h
@@ -1627,7 +1627,7 @@ _mm_loadh_pi(__m128 __a, const __m64 *__p)
struct __mm_loadh_pi_struct {
__mm_loadh_pi_v2f32 __u;
} __attribute__((__packed__, __may_alias__));
- __mm_loadh_pi_v2f32 __b = ((struct __mm_loadh_pi_struct*)__p)->__u;
+ __mm_loadh_pi_v2f32 __b = ((const struct __mm_loadh_pi_struct*)__p)->__u;
__m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
return __builtin_shufflevector(__a, __bb, 0, 1, 4, 5);
}
@@ -1654,7 +1654,7 @@ _mm_loadl_pi(__m128 __a, const __m64 *__p)
struct __mm_loadl_pi_struct {
__mm_loadl_pi_v2f32 __u;
} __attribute__((__packed__, __may_alias__));
- __mm_loadl_pi_v2f32 __b = ((struct __mm_loadl_pi_struct*)__p)->__u;
+ __mm_loadl_pi_v2f32 __b = ((const struct __mm_loadl_pi_struct*)__p)->__u;
__m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
return __builtin_shufflevector(__a, __bb, 4, 5, 2, 3);
}
@@ -1680,7 +1680,7 @@ _mm_load_ss(const float *__p)
struct __mm_load_ss_struct {
float __u;
} __attribute__((__packed__, __may_alias__));
- float __u = ((struct __mm_load_ss_struct*)__p)->__u;
+ float __u = ((const struct __mm_load_ss_struct*)__p)->__u;
return __extension__ (__m128){ __u, 0, 0, 0 };
}
@@ -1702,7 +1702,7 @@ _mm_load1_ps(const float *__p)
struct __mm_load1_ps_struct {
float __u;
} __attribute__((__packed__, __may_alias__));
- float __u = ((struct __mm_load1_ps_struct*)__p)->__u;
+ float __u = ((const struct __mm_load1_ps_struct*)__p)->__u;
return __extension__ (__m128){ __u, __u, __u, __u };
}
@@ -1722,7 +1722,7 @@ _mm_load1_ps(const float *__p)
static __inline__ __m128 __DEFAULT_FN_ATTRS
_mm_load_ps(const float *__p)
{
- return *(__m128*)__p;
+ return *(const __m128*)__p;
}
/// Loads a 128-bit floating-point vector of [4 x float] from an
@@ -1742,7 +1742,7 @@ _mm_loadu_ps(const float *__p)
struct __loadu_ps {
__m128_u __v;
} __attribute__((__packed__, __may_alias__));
- return ((struct __loadu_ps*)__p)->__v;
+ return ((const struct __loadu_ps*)__p)->__v;
}
/// Loads four packed float values, in reverse order, from an aligned
@@ -2100,7 +2100,7 @@ _mm_storer_ps(float *__p, __m128 __a)
/// be generated. \n
/// _MM_HINT_T2: Move data using the T2 hint. The PREFETCHT2 instruction will
/// be generated.
-#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), \
+#define _mm_prefetch(a, sel) (__builtin_prefetch((const void *)(a), \
((sel) >> 2) & 1, (sel) & 0x3))
#endif