Permalink
Browse files

Misc SIMD fixes for issues pointed out by the clang sanitiser.

  • Loading branch information...
Arild Fuldseth (arilfuld) Thomas Davies
Arild Fuldseth (arilfuld) authored and Thomas Davies committed Mar 20, 2017
1 parent ec3eb81 commit d0a88bd003c6a85d462f349a9f21e555b199f710
Showing with 7 additions and 13 deletions.
  1. +0 −4 common/simd/v128_intrinsics_arm.h
  2. +1 −3 common/simd/v64_intrinsics_arm.h
  3. +6 −6 common/simd/v64_intrinsics_c.h
@@ -227,10 +227,6 @@ SIMD_INLINE v128 v128_sub_8(v128 x, v128 y) {
return vreinterpretq_s64_u8(vsubq_u8(vreinterpretq_u8_s64(x), vreinterpretq_u8_s64(y)));
}
-SIMD_INLINE v128 v128_sub_u8(v128 x, v128 y) {
- return vreinterpretq_s64_u8(vqsubq_u8(vreinterpretq_u8_s64(x), vreinterpretq_u8_s64(y)));
-}
-
SIMD_INLINE v128 v128_sub_16(v128 x, v128 y) {
return vreinterpretq_s64_s16(vsubq_s16(vreinterpretq_s16_s64(x), vreinterpretq_s16_s64(y)));
}
@@ -115,14 +115,12 @@ SIMD_INLINE v64 v64_align(v64 a, v64 b, const unsigned int c) {
#if __OPTIMIZE__ && !__clang__
return c ? vreinterpret_s64_s8(vext_s8(vreinterpret_s8_s64(b), vreinterpret_s8_s64(a), c)) : b;
#else
- return c ? v64_from_64((uint64_t)b >> c * 8) | ((uint64_t)a << (8 - c) * 8) : b;
+ return c ? v64_from_64(((uint64_t)b >> c * 8) | ((uint64_t)a << (8 - c) * 8)) : b;
#endif
}
SIMD_INLINE v64 v64_zero() { return vreinterpret_s64_u8(vdup_n_u8(0)); }
-SIMD_INLINE v64 v64_ones() { return vreinterpret_s64_u8(vdup_n_u8(-1)); }
-
SIMD_INLINE v64 v64_dup_8(uint8_t x) {
return vreinterpret_s64_u8(vdup_n_u8(x));
}
@@ -227,8 +227,8 @@ SIMD_INLINE c_v64 c_v64_sadd_s16(c_v64 a, c_v64 b) {
SIMD_INLINE c_v64 c_v64_add_32(c_v64 a, c_v64 b) {
c_v64 t;
- t.u32[0] = a.u32[0] + b.u32[0];
- t.u32[1] = a.u32[1] + b.u32[1];
+ t.u32[0] = (uint32_t)((uint64_t)a.u32[0] + b.u32[0]);
+ t.u32[1] = (uint32_t)((uint64_t)a.u32[1] + b.u32[1]);
return t;
}
@@ -277,8 +277,8 @@ SIMD_INLINE c_v64 c_v64_ssub_s16(c_v64 a, c_v64 b) {
SIMD_INLINE c_v64 c_v64_sub_32(c_v64 a, c_v64 b) {
c_v64 t;
- t.u32[0] = a.u32[0] - b.u32[0];
- t.u32[1] = a.u32[1] - b.u32[1];
+ t.u32[0] = (uint32_t)((int64_t)a.u32[0] - b.u32[0]);
+ t.u32[1] = (uint32_t)((int64_t)a.u32[1] - b.u32[1]);
return t;
}
@@ -651,8 +651,8 @@ SIMD_INLINE c_v64 c_v64_mulhi_s16(c_v64 a, c_v64 b) {
SIMD_INLINE c_v64 c_v64_mullo_s32(c_v64 a, c_v64 b) {
c_v64 t;
- t.s32[0] = a.s32[0] * b.s32[0];
- t.s32[1] = a.s32[1] * b.s32[1];
+ t.s32[0] = (int32_t)((int64_t)a.s32[0] * b.s32[0]);
+ t.s32[1] = (int32_t)((int64_t)a.s32[1] * b.s32[1]);
return t;
}

0 comments on commit d0a88bd

Please sign in to comment.