Skip to content

Commit 125542b

Browse files
committed
Formatting changes, don't use saturated add
1 parent 412712f commit 125542b

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,13 +1354,10 @@ let Features = "avx512bitalg", Attributes = [NoThrow, Const, RequiredVectorWidth
13541354
def vpshufbitqmb512_mask : X86Builtin<"unsigned long long int(_Vector<64, char>, _Vector<64, char>, unsigned long long int)">;
13551355
}
13561356

1357-
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
1358-
def pmulhrsw512 : X86Builtin<"_Vector<32, short>(_Vector<32, short>, _Vector<32, short>)">;
1359-
}
1360-
13611357
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
13621358
def pavgb512 : X86Builtin<"_Vector<64, unsigned char>(_Vector<64, unsigned char>, _Vector<64, unsigned char>)">;
13631359
def pavgw512 : X86Builtin<"_Vector<32, unsigned short>(_Vector<32, unsigned short>, _Vector<32, unsigned short>)">;
1360+
def pmulhrsw512 : X86Builtin<"_Vector<32, short>(_Vector<32, short>, _Vector<32, short>)">;
13641361
def pmulhuw512 : X86Builtin<"_Vector<32, unsigned short>(_Vector<32, unsigned short>, _Vector<32, unsigned short>)">;
13651362
def pmulhw512 : X86Builtin<"_Vector<32, short>(_Vector<32, short>, _Vector<32, short>)">;
13661363
}

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,11 +3430,10 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
34303430
return interp__builtin_elementwise_int_binop(
34313431
S, OpPC, Call, [](const APSInt &LHS, const APSInt &RHS) {
34323432
unsigned Width = LHS.getBitWidth();
3433-
34343433
APInt Mul = llvm::APIntOps::mulhs(LHS, RHS);
34353434
Mul = Mul.relativeLShr(14);
3436-
Mul = Mul.sadd_sat(APInt(Width, 1, true));
3437-
return APInt(Mul.relativeLShr(1));
3435+
Mul = Mul + APInt(Width, 1, true);
3436+
return Mul.relativeLShr(1);
34383437
});
34393438

34403439
case clang::X86::BI__builtin_ia32_pavgb128:

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
#include <cstring>
6868
#include <functional>
6969
#include <limits>
70-
#include <llvm/ADT/APSInt.h>
7170
#include <optional>
7271

7372
#define DEBUG_TYPE "exprconstant"
@@ -11733,8 +11732,8 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1173311732
unsigned Width = LHS.getBitWidth();
1173411733
APInt Mul = llvm::APIntOps::mulhs(LHS, RHS);
1173511734
Mul = Mul.relativeLShr(14);
11736-
Mul = Mul.sadd_sat(APInt(Width, 1, true));
11737-
return APInt(Mul.relativeLShr(1));
11735+
Mul = Mul + APInt(Width, 1, true);
11736+
return Mul.relativeLShr(1);
1173811737
});
1173911738

1174011739
case clang::X86::BI__builtin_ia32_pmulhuw128:

clang/lib/Headers/tmmintrin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ _mm_sign_pi32(__m64 __a, __m64 __b)
799799
}
800800

801801
#undef __anyext128
802+
#undef __zext128
802803
#undef __trunc64
803804
#undef __DEFAULT_FN_ATTRS
804805
#undef __DEFAULT_FN_ATTRS_CONSTEXPR

0 commit comments

Comments
 (0)