diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-12-11 22:27:08 +0600 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2016-12-11 17:27:08 +0100 |
commit | 865fc9684661c46589a30c6021cf44de560940f3 (patch) | |
tree | 8f893ab9b1e0182b6aba091d4eb33d1c7a3c4989 /gcc | |
parent | 846fbd1e2b11a524563058d54f59447620497fde (diff) | |
download | gcc-865fc9684661c46589a30c6021cf44de560940f3.zip gcc-865fc9684661c46589a30c6021cf44de560940f3.tar.gz gcc-865fc9684661c46589a30c6021cf44de560940f3.tar.bz2 |
re PR target/70118 (UBSan claims misaligned access in SSE instrinsics)
PR target/70118
* config/i386/mmintrin.h (__m64_u): New type
* config/i386/emmintrin.h (_mm_loadl_epi64, _mm_storel_epi64):
Make the allowed unaligned memory access explicit.
From-SVN: r243527
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/i386/emmintrin.h | 8 | ||||
-rw-r--r-- | gcc/config/i386/mmintrin.h | 3 |
3 files changed, 14 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b384a8f..a990b2d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-12-10 Allan Sandfeld Jensen <allan.jensen@qt.io> + + PR target/70118 + * config/i386/mmintrin.h (__m64_u): New type + * config/i386/emmintrin.h (_mm_loadl_epi64, _mm_storel_epi64): + Make the allowed unaligned memory access explicit. + 2016-12-10 Krister Walfridsson <krister.walfridsson@gmail.com> * config.gcc (i386-*-netbsd*): Make i486 the default arch on NetBSD. diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h index b299cbc..d5aa46a 100644 --- a/gcc/config/i386/emmintrin.h +++ b/gcc/config/i386/emmintrin.h @@ -703,9 +703,9 @@ _mm_loadu_si128 (__m128i_u const *__P) } extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -_mm_loadl_epi64 (__m128i const *__P) +_mm_loadl_epi64 (__m128i_u const *__P) { - return _mm_set_epi64 ((__m64)0LL, *(__m64 *)__P); + return _mm_set_epi64 ((__m64)0LL, *(__m64_u *)__P); } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -721,9 +721,9 @@ _mm_storeu_si128 (__m128i_u *__P, __m128i __B) } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -_mm_storel_epi64 (__m128i *__P, __m128i __B) +_mm_storel_epi64 (__m128i_u *__P, __m128i __B) { - *(long long *)__P = ((__v2di)__B)[0]; + *(__m64_u *)__P = (__m64) ((__v2di)__B)[0]; } extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) diff --git a/gcc/config/i386/mmintrin.h b/gcc/config/i386/mmintrin.h index d5a1f00..2bd3bd1 100644 --- a/gcc/config/i386/mmintrin.h +++ b/gcc/config/i386/mmintrin.h @@ -37,6 +37,9 @@ vector types, and their scalar components. */ typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__)); +/* Unaligned version of the same type */ +typedef int __m64_u __attribute__ ((__vector_size__ (8), __may_alias__, __aligned__ (1))); + /* Internal data types for implementing the intrinsics. */ typedef int __v2si __attribute__ ((__vector_size__ (8))); typedef short __v4hi __attribute__ ((__vector_size__ (8))); |