Skip to content

Commit a9e0536

Browse files
committed
Use unsigned short vector types for pmulhuw intrinsics
1 parent ecf9ae0 commit a9e0536

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<128>] in {
105105
def vec_set_v8hi : X86Builtin<"_Vector<8, short>(_Vector<8, short>, short, _Constant int)">;
106106
}
107107

108-
let Features = "sse2", Attributes = [NoThrow, Const, Constexpr] in {
108+
let Features = "sse2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
109109
def pmulhw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">;
110-
def pmulhuw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">;
110+
def pmulhuw128 : X86Builtin<"_Vector<8, unsigned short>(_Vector<8, unsigned short>, _Vector<8, unsigned short>)">;
111111
}
112112

113113
let Features = "sse3" in {
@@ -621,7 +621,7 @@ let Features = "avx2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] i
621621
}
622622

623623
let Features = "avx2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
624-
def pmulhuw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
624+
def pmulhuw256 : X86Builtin<"_Vector<16, unsigned short>(_Vector<16, unsigned short>, _Vector<16, unsigned short>)">;
625625
def pmulhw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
626626
}
627627

@@ -1438,7 +1438,7 @@ let Features = "avx512bw,evex512", Attributes = [NoThrow, Const, RequiredVectorW
14381438
}
14391439

14401440
let Features = "avx512bw,evex512", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
1441-
def pmulhuw512 : X86Builtin<"_Vector<32, short>(_Vector<32, short>, _Vector<32, short>)">;
1441+
def pmulhuw512 : X86Builtin<"_Vector<32, unsigned short>(_Vector<32, unsigned short>, _Vector<32, unsigned short>)">;
14421442
def pmulhw512 : X86Builtin<"_Vector<32, short>(_Vector<32, short>, _Vector<32, short>)">;
14431443
}
14441444

clang/lib/Headers/avx2intrin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ _mm256_mulhrs_epi16(__m256i __a, __m256i __b)
17321732
static __inline__ __m256i __DEFAULT_FN_ATTRS256_CONSTEXPR
17331733
_mm256_mulhi_epu16(__m256i __a, __m256i __b)
17341734
{
1735-
return (__m256i)__builtin_ia32_pmulhuw256((__v16hi)__a, (__v16hi)__b);
1735+
return (__m256i)__builtin_ia32_pmulhuw256((__v16hu)__a, (__v16hu)__b);
17361736
}
17371737

17381738
/// Multiplies signed 16-bit integer elements of two 256-bit vectors of

clang/lib/Headers/avx512bwintrin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ _mm512_maskz_mulhi_epi16(__mmask32 __U, __m512i __A, __m512i __B)
11161116
static __inline__ __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
11171117
_mm512_mulhi_epu16(__m512i __A, __m512i __B)
11181118
{
1119-
return (__m512i)__builtin_ia32_pmulhuw512((__v32hi) __A, (__v32hi) __B);
1119+
return (__m512i)__builtin_ia32_pmulhuw512((__v32hu) __A, (__v32hu) __B);
11201120
}
11211121

11221122
static __inline__ __m512i __DEFAULT_FN_ATTRS512

clang/lib/Headers/emmintrin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2415,7 +2415,7 @@ _mm_mulhi_epi16(__m128i __a, __m128i __b) {
24152415
/// of each of the eight 32-bit products.
24162416
static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR
24172417
_mm_mulhi_epu16(__m128i __a, __m128i __b) {
2418-
return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)__a, (__v8hi)__b);
2418+
return (__m128i)__builtin_ia32_pmulhuw128((__v8hu)__a, (__v8hu)__b);
24192419
}
24202420

24212421
/// Multiplies the corresponding elements of two signed [8 x i16]

clang/lib/Headers/xmmintrin.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ typedef float __m128_u __attribute__((__vector_size__(16), __aligned__(1)));
2424

2525
/* Unsigned types */
2626
typedef unsigned int __v4su __attribute__((__vector_size__(16)));
27+
typedef unsigned short __v8hu __attribute__((__vector_size__(16)));
2728

2829
/* This header should only be included in a hosted environment as it depends on
2930
* a standard library to provide allocation routines. */
@@ -2450,8 +2451,8 @@ _mm_movemask_pi8(__m64 __a)
24502451
static __inline__ __m64 __DEFAULT_FN_ATTRS_SSE2_CONSTEXPR
24512452
_mm_mulhi_pu16(__m64 __a, __m64 __b)
24522453
{
2453-
return __trunc64(__builtin_ia32_pmulhuw128((__v8hi)__zext128(__a),
2454-
(__v8hi)__zext128(__b)));
2454+
return __trunc64(__builtin_ia32_pmulhuw128((__v8hu)__zext128(__a),
2455+
(__v8hu)__zext128(__b)));
24552456
}
24562457

24572458
/// Shuffles the 4 16-bit integers from a 64-bit integer vector to the

0 commit comments

Comments
 (0)