Skip to content

Commit 725a052

Browse files
authored
[Headers][X86] Add specific results to comparisons (#83316)
Some comparison intrinsics were described as returning the "result" without specifying how. The "cmp" intrinsics return zero or all 1's in the corresponding elements of a returned vector; the "com" intrinsics return an integer 0 or 1. Also removed some redundant information.
1 parent 2a3f27c commit 725a052

File tree

3 files changed

+177
-143
lines changed

3 files changed

+177
-143
lines changed

clang/lib/Headers/emmintrin.h

Lines changed: 54 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,9 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_xor_pd(__m128d __a,
410410
}
411411

412412
/// Compares each of the corresponding double-precision values of the
413-
/// 128-bit vectors of [2 x double] for equality. Each comparison yields 0x0
414-
/// for false, 0xFFFFFFFFFFFFFFFF for true.
413+
/// 128-bit vectors of [2 x double] for equality.
414+
///
415+
/// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
415416
///
416417
/// \headerfile <x86intrin.h>
417418
///
@@ -429,8 +430,9 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_cmpeq_pd(__m128d __a,
429430

430431
/// Compares each of the corresponding double-precision values of the
431432
/// 128-bit vectors of [2 x double] to determine if the values in the first
432-
/// operand are less than those in the second operand. Each comparison
433-
/// yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
433+
/// operand are less than those in the second operand.
434+
///
435+
/// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
434436
///
435437
/// \headerfile <x86intrin.h>
436438
///
@@ -949,8 +951,8 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_cmpnge_sd(__m128d __a,
949951
/// Compares the lower double-precision floating-point values in each of
950952
/// the two 128-bit floating-point vectors of [2 x double] for equality.
951953
///
952-
/// The comparison yields 0 for false, 1 for true. If either of the two
953-
/// lower double-precision values is NaN, 0 is returned.
954+
/// The comparison returns 0 for false, 1 for true. If either of the two
955+
/// lower double-precision values is NaN, returns 0.
954956
///
955957
/// \headerfile <x86intrin.h>
956958
///
@@ -962,8 +964,7 @@ static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_cmpnge_sd(__m128d __a,
962964
/// \param __b
963965
/// A 128-bit vector of [2 x double]. The lower double-precision value is
964966
/// compared to the lower double-precision value of \a __a.
965-
/// \returns An integer containing the comparison results. If either of the two
966-
/// lower double-precision values is NaN, 0 is returned.
967+
/// \returns An integer containing the comparison results.
967968
static __inline__ int __DEFAULT_FN_ATTRS _mm_comieq_sd(__m128d __a,
968969
__m128d __b) {
969970
return __builtin_ia32_comisdeq((__v2df)__a, (__v2df)__b);
@@ -974,8 +975,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comieq_sd(__m128d __a,
974975
/// the value in the first parameter is less than the corresponding value in
975976
/// the second parameter.
976977
///
977-
/// The comparison yields 0 for false, 1 for true. If either of the two
978-
/// lower double-precision values is NaN, 0 is returned.
978+
/// The comparison returns 0 for false, 1 for true. If either of the two
979+
/// lower double-precision values is NaN, returns 0.
979980
///
980981
/// \headerfile <x86intrin.h>
981982
///
@@ -987,8 +988,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comieq_sd(__m128d __a,
987988
/// \param __b
988989
/// A 128-bit vector of [2 x double]. The lower double-precision value is
989990
/// compared to the lower double-precision value of \a __a.
990-
/// \returns An integer containing the comparison results. If either of the two
991-
/// lower double-precision values is NaN, 0 is returned.
991+
/// \returns An integer containing the comparison results.
992992
static __inline__ int __DEFAULT_FN_ATTRS _mm_comilt_sd(__m128d __a,
993993
__m128d __b) {
994994
return __builtin_ia32_comisdlt((__v2df)__a, (__v2df)__b);
@@ -999,8 +999,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comilt_sd(__m128d __a,
999999
/// the value in the first parameter is less than or equal to the
10001000
/// corresponding value in the second parameter.
10011001
///
1002-
/// The comparison yields 0 for false, 1 for true. If either of the two
1003-
/// lower double-precision values is NaN, 0 is returned.
1002+
/// The comparison returns 0 for false, 1 for true. If either of the two
1003+
/// lower double-precision values is NaN, returns 0.
10041004
///
10051005
/// \headerfile <x86intrin.h>
10061006
///
@@ -1012,8 +1012,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comilt_sd(__m128d __a,
10121012
/// \param __b
10131013
/// A 128-bit vector of [2 x double]. The lower double-precision value is
10141014
/// compared to the lower double-precision value of \a __a.
1015-
/// \returns An integer containing the comparison results. If either of the two
1016-
/// lower double-precision values is NaN, 0 is returned.
1015+
/// \returns An integer containing the comparison results.
10171016
static __inline__ int __DEFAULT_FN_ATTRS _mm_comile_sd(__m128d __a,
10181017
__m128d __b) {
10191018
return __builtin_ia32_comisdle((__v2df)__a, (__v2df)__b);
@@ -1024,8 +1023,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comile_sd(__m128d __a,
10241023
/// the value in the first parameter is greater than the corresponding value
10251024
/// in the second parameter.
10261025
///
1027-
/// The comparison yields 0 for false, 1 for true. If either of the two
1028-
/// lower double-precision values is NaN, 0 is returned.
1026+
/// The comparison returns 0 for false, 1 for true. If either of the two
1027+
/// lower double-precision values is NaN, returns 0.
10291028
///
10301029
/// \headerfile <x86intrin.h>
10311030
///
@@ -1037,8 +1036,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comile_sd(__m128d __a,
10371036
/// \param __b
10381037
/// A 128-bit vector of [2 x double]. The lower double-precision value is
10391038
/// compared to the lower double-precision value of \a __a.
1040-
/// \returns An integer containing the comparison results. If either of the two
1041-
/// lower double-precision values is NaN, 0 is returned.
1039+
/// \returns An integer containing the comparison results.
10421040
static __inline__ int __DEFAULT_FN_ATTRS _mm_comigt_sd(__m128d __a,
10431041
__m128d __b) {
10441042
return __builtin_ia32_comisdgt((__v2df)__a, (__v2df)__b);
@@ -1049,8 +1047,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comigt_sd(__m128d __a,
10491047
/// the value in the first parameter is greater than or equal to the
10501048
/// corresponding value in the second parameter.
10511049
///
1052-
/// The comparison yields 0 for false, 1 for true. If either of the two
1053-
/// lower double-precision values is NaN, 0 is returned.
1050+
/// The comparison returns 0 for false, 1 for true. If either of the two
1051+
/// lower double-precision values is NaN, returns 0.
10541052
///
10551053
/// \headerfile <x86intrin.h>
10561054
///
@@ -1062,8 +1060,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comigt_sd(__m128d __a,
10621060
/// \param __b
10631061
/// A 128-bit vector of [2 x double]. The lower double-precision value is
10641062
/// compared to the lower double-precision value of \a __a.
1065-
/// \returns An integer containing the comparison results. If either of the two
1066-
/// lower double-precision values is NaN, 0 is returned.
1063+
/// \returns An integer containing the comparison results.
10671064
static __inline__ int __DEFAULT_FN_ATTRS _mm_comige_sd(__m128d __a,
10681065
__m128d __b) {
10691066
return __builtin_ia32_comisdge((__v2df)__a, (__v2df)__b);
@@ -1074,7 +1071,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comige_sd(__m128d __a,
10741071
/// the value in the first parameter is unequal to the corresponding value in
10751072
/// the second parameter.
10761073
///
1077-
/// The comparison yields 0 for false, 1 for true. If either of the two
1074+
/// The comparison returns 0 for false, 1 for true. If either of the two
10781075
/// lower double-precision values is NaN, 1 is returned.
10791076
///
10801077
/// \headerfile <x86intrin.h>
@@ -1087,18 +1084,17 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comige_sd(__m128d __a,
10871084
/// \param __b
10881085
/// A 128-bit vector of [2 x double]. The lower double-precision value is
10891086
/// compared to the lower double-precision value of \a __a.
1090-
/// \returns An integer containing the comparison results. If either of the two
1091-
/// lower double-precision values is NaN, 1 is returned.
1087+
/// \returns An integer containing the comparison results.
10921088
static __inline__ int __DEFAULT_FN_ATTRS _mm_comineq_sd(__m128d __a,
10931089
__m128d __b) {
10941090
return __builtin_ia32_comisdneq((__v2df)__a, (__v2df)__b);
10951091
}
10961092

10971093
/// Compares the lower double-precision floating-point values in each of
1098-
/// the two 128-bit floating-point vectors of [2 x double] for equality. The
1099-
/// comparison yields 0 for false, 1 for true.
1094+
/// the two 128-bit floating-point vectors of [2 x double] for equality.
11001095
///
1101-
/// If either of the two lower double-precision values is NaN, 0 is returned.
1096+
/// The comparison returns 0 for false, 1 for true. If either of the two
1097+
/// lower double-precision values is NaN, returns 0.
11021098
///
11031099
/// \headerfile <x86intrin.h>
11041100
///
@@ -1110,8 +1106,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_comineq_sd(__m128d __a,
11101106
/// \param __b
11111107
/// A 128-bit vector of [2 x double]. The lower double-precision value is
11121108
/// compared to the lower double-precision value of \a __a.
1113-
/// \returns An integer containing the comparison results. If either of the two
1114-
/// lower double-precision values is NaN, 0 is returned.
1109+
/// \returns An integer containing the comparison results.
11151110
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomieq_sd(__m128d __a,
11161111
__m128d __b) {
11171112
return __builtin_ia32_ucomisdeq((__v2df)__a, (__v2df)__b);
@@ -1122,8 +1117,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomieq_sd(__m128d __a,
11221117
/// the value in the first parameter is less than the corresponding value in
11231118
/// the second parameter.
11241119
///
1125-
/// The comparison yields 0 for false, 1 for true. If either of the two lower
1126-
/// double-precision values is NaN, 0 is returned.
1120+
/// The comparison returns 0 for false, 1 for true. If either of the two
1121+
/// lower double-precision values is NaN, returns 0.
11271122
///
11281123
/// \headerfile <x86intrin.h>
11291124
///
@@ -1135,8 +1130,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomieq_sd(__m128d __a,
11351130
/// \param __b
11361131
/// A 128-bit vector of [2 x double]. The lower double-precision value is
11371132
/// compared to the lower double-precision value of \a __a.
1138-
/// \returns An integer containing the comparison results. If either of the two
1139-
/// lower double-precision values is NaN, 0 is returned.
1133+
/// \returns An integer containing the comparison results.
11401134
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomilt_sd(__m128d __a,
11411135
__m128d __b) {
11421136
return __builtin_ia32_ucomisdlt((__v2df)__a, (__v2df)__b);
@@ -1147,8 +1141,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomilt_sd(__m128d __a,
11471141
/// the value in the first parameter is less than or equal to the
11481142
/// corresponding value in the second parameter.
11491143
///
1150-
/// The comparison yields 0 for false, 1 for true. If either of the two lower
1151-
/// double-precision values is NaN, 0 is returned.
1144+
/// The comparison returns 0 for false, 1 for true. If either of the two
1145+
/// lower double-precision values is NaN, returns 0.
11521146
///
11531147
/// \headerfile <x86intrin.h>
11541148
///
@@ -1160,8 +1154,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomilt_sd(__m128d __a,
11601154
/// \param __b
11611155
/// A 128-bit vector of [2 x double]. The lower double-precision value is
11621156
/// compared to the lower double-precision value of \a __a.
1163-
/// \returns An integer containing the comparison results. If either of the two
1164-
/// lower double-precision values is NaN, 0 is returned.
1157+
/// \returns An integer containing the comparison results.
11651158
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomile_sd(__m128d __a,
11661159
__m128d __b) {
11671160
return __builtin_ia32_ucomisdle((__v2df)__a, (__v2df)__b);
@@ -1172,8 +1165,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomile_sd(__m128d __a,
11721165
/// the value in the first parameter is greater than the corresponding value
11731166
/// in the second parameter.
11741167
///
1175-
/// The comparison yields 0 for false, 1 for true. If either of the two lower
1176-
/// double-precision values is NaN, 0 is returned.
1168+
/// The comparison returns 0 for false, 1 for true. If either of the two
1169+
/// lower double-precision values is NaN, returns 0.
11771170
///
11781171
/// \headerfile <x86intrin.h>
11791172
///
@@ -1185,8 +1178,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomile_sd(__m128d __a,
11851178
/// \param __b
11861179
/// A 128-bit vector of [2 x double]. The lower double-precision value is
11871180
/// compared to the lower double-precision value of \a __a.
1188-
/// \returns An integer containing the comparison results. If either of the two
1189-
/// lower double-precision values is NaN, 0 is returned.
1181+
/// \returns An integer containing the comparison results.
11901182
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomigt_sd(__m128d __a,
11911183
__m128d __b) {
11921184
return __builtin_ia32_ucomisdgt((__v2df)__a, (__v2df)__b);
@@ -1197,8 +1189,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomigt_sd(__m128d __a,
11971189
/// the value in the first parameter is greater than or equal to the
11981190
/// corresponding value in the second parameter.
11991191
///
1200-
/// The comparison yields 0 for false, 1 for true. If either of the two
1201-
/// lower double-precision values is NaN, 0 is returned.
1192+
/// The comparison returns 0 for false, 1 for true. If either of the two
1193+
/// lower double-precision values is NaN, returns 0.
12021194
///
12031195
/// \headerfile <x86intrin.h>
12041196
///
@@ -1210,8 +1202,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomigt_sd(__m128d __a,
12101202
/// \param __b
12111203
/// A 128-bit vector of [2 x double]. The lower double-precision value is
12121204
/// compared to the lower double-precision value of \a __a.
1213-
/// \returns An integer containing the comparison results. If either of the two
1214-
/// lower double-precision values is NaN, 0 is returned.
1205+
/// \returns An integer containing the comparison results.
12151206
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomige_sd(__m128d __a,
12161207
__m128d __b) {
12171208
return __builtin_ia32_ucomisdge((__v2df)__a, (__v2df)__b);
@@ -1222,8 +1213,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomige_sd(__m128d __a,
12221213
/// the value in the first parameter is unequal to the corresponding value in
12231214
/// the second parameter.
12241215
///
1225-
/// The comparison yields 0 for false, 1 for true. If either of the two lower
1226-
/// double-precision values is NaN, 1 is returned.
1216+
/// The comparison returns 0 for false, 1 for true. If either of the two
1217+
/// lower double-precision values is NaN, 1 is returned.
12271218
///
12281219
/// \headerfile <x86intrin.h>
12291220
///
@@ -1235,8 +1226,7 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomige_sd(__m128d __a,
12351226
/// \param __b
12361227
/// A 128-bit vector of [2 x double]. The lower double-precision value is
12371228
/// compared to the lower double-precision value of \a __a.
1238-
/// \returns An integer containing the comparison result. If either of the two
1239-
/// lower double-precision values is NaN, 1 is returned.
1229+
/// \returns An integer containing the comparison result.
12401230
static __inline__ int __DEFAULT_FN_ATTRS _mm_ucomineq_sd(__m128d __a,
12411231
__m128d __b) {
12421232
return __builtin_ia32_ucomisdneq((__v2df)__a, (__v2df)__b);
@@ -3023,8 +3013,9 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_srl_epi64(__m128i __a,
30233013
}
30243014

30253015
/// Compares each of the corresponding 8-bit values of the 128-bit
3026-
/// integer vectors for equality. Each comparison yields 0x0 for false, 0xFF
3027-
/// for true.
3016+
/// integer vectors for equality.
3017+
///
3018+
/// Each comparison yields 0x0 for false, 0xFF for true.
30283019
///
30293020
/// \headerfile <x86intrin.h>
30303021
///
@@ -3041,8 +3032,9 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi8(__m128i __a,
30413032
}
30423033

30433034
/// Compares each of the corresponding 16-bit values of the 128-bit
3044-
/// integer vectors for equality. Each comparison yields 0x0 for false,
3045-
/// 0xFFFF for true.
3035+
/// integer vectors for equality.
3036+
///
3037+
/// Each comparison yields 0x0 for false, 0xFFFF for true.
30463038
///
30473039
/// \headerfile <x86intrin.h>
30483040
///
@@ -3059,8 +3051,9 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi16(__m128i __a,
30593051
}
30603052

30613053
/// Compares each of the corresponding 32-bit values of the 128-bit
3062-
/// integer vectors for equality. Each comparison yields 0x0 for false,
3063-
/// 0xFFFFFFFF for true.
3054+
/// integer vectors for equality.
3055+
///
3056+
/// Each comparison yields 0x0 for false, 0xFFFFFFFF for true.
30643057
///
30653058
/// \headerfile <x86intrin.h>
30663059
///
@@ -3078,8 +3071,9 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_cmpeq_epi32(__m128i __a,
30783071

30793072
/// Compares each of the corresponding signed 8-bit values of the 128-bit
30803073
/// integer vectors to determine if the values in the first operand are
3081-
/// greater than those in the second operand. Each comparison yields 0x0 for
3082-
/// false, 0xFF for true.
3074+
/// greater than those in the second operand.
3075+
///
3076+
/// Each comparison yields 0x0 for false, 0xFF for true.
30833077
///
30843078
/// \headerfile <x86intrin.h>
30853079
///

clang/lib/Headers/smmintrin.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,8 @@ static __inline__ int __DEFAULT_FN_ATTRS _mm_testnzc_si128(__m128i __M,
11881188
/// Compares each of the corresponding 64-bit values of the 128-bit
11891189
/// integer vectors for equality.
11901190
///
1191+
/// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
1192+
///
11911193
/// \headerfile <x86intrin.h>
11921194
///
11931195
/// This intrinsic corresponds to the <c> VPCMPEQQ / PCMPEQQ </c> instruction.
@@ -2301,6 +2303,8 @@ static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_minpos_epu16(__m128i __V) {
23012303
/// integer vectors to determine if the values in the first operand are
23022304
/// greater than those in the second operand.
23032305
///
2306+
/// Each comparison yields 0x0 for false, 0xFFFFFFFFFFFFFFFF for true.
2307+
///
23042308
/// \headerfile <x86intrin.h>
23052309
///
23062310
/// This intrinsic corresponds to the <c> VPCMPGTQ / PCMPGTQ </c> instruction.

0 commit comments

Comments
 (0)