[clang] [clang] Improve diagnostics for vector builtins (PR #125673)
Fraser Cormack via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 4 03:28:58 PST 2025
https://github.com/frasercrmck created https://github.com/llvm/llvm-project/pull/125673
This commit improves the diagnostics for vector (elementwise) builtins in a couple of ways.
It primarily provides more precise type-checking diagnostics for builtins with specific type requirements. Previously many builtins were receiving a catch-all diagnostic suggesting types which aren't valid.
It also makes consistent the type-checking behaviour between various binary and ternary builtins. The binary builtins would check for mismatched argument types before specific type requirements, whereas ternary builtins would perform the checks in the reverse order. The binary builtins now behave as the ternary ones do.
>From 3cf5fb689d6fdd1379f487f0080690d5c760f55f Mon Sep 17 00:00:00 2001
From: Fraser Cormack <fraser at codeplay.com>
Date: Tue, 4 Feb 2025 11:19:24 +0000
Subject: [PATCH] [clang] Improve diagnostics for vector builtins
Thie commit improves the diagnostics for vector (elementwise) builtins
in a couple of ways.
It primarily provides more precise type-checking diagnostics for
builtins with specific type requirements. Previously many builtins were
receiving a catch-all diagnostic suggesting types which aren't valid.
It also makes consistent the type-checking behaviour between various
binary and ternary builtins. The binary builtins would check for
mismatched argument types before specific type requirements, whereas
ternary builtins would perform the checks in the reverse order. The
binary builtins now behave as the ternary ones do.
---
.../clang/Basic/DiagnosticSemaKinds.td | 3 +-
clang/include/clang/Sema/Sema.h | 27 ++-
clang/lib/Sema/SemaChecking.cpp | 185 +++++++-----------
clang/lib/Sema/SemaHLSL.cpp | 12 +-
clang/test/Sema/aarch64-sve-vector-exp-ops.c | 4 +-
clang/test/Sema/aarch64-sve-vector-log-ops.c | 6 +-
clang/test/Sema/aarch64-sve-vector-trig-ops.c | 18 +-
clang/test/Sema/builtins-elementwise-math.c | 67 ++++---
clang/test/Sema/riscv-rvv-vector-exp-ops.c | 4 +-
clang/test/Sema/riscv-rvv-vector-log-ops.c | 6 +-
clang/test/Sema/riscv-rvv-vector-trig-ops.c | 18 +-
clang/test/SemaHLSL/BuiltIns/exp-errors.hlsl | 2 +-
.../SemaHLSL/BuiltIns/reversebits-errors.hlsl | 2 +-
.../test/SemaHLSL/BuiltIns/round-errors.hlsl | 2 +-
14 files changed, 169 insertions(+), 187 deletions(-)
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 00a94eb7a30367..e43d7293a1b45a 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -12403,7 +12403,8 @@ def err_builtin_invalid_arg_type: Error <
"a vector of integers|"
"an unsigned integer|"
"an 'int'|"
- "a vector of floating points}1 (was %2)">;
+ "a vector of floating points|"
+ "an integer or vector of integers}1 (was %2)">;
def err_builtin_matrix_disabled: Error<
"matrix types extension is disabled. Pass -fenable-matrix to enable it">;
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 472a0e25adc975..5e7a2d70df2dfb 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -2331,9 +2331,18 @@ class Sema final : public SemaBase {
bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
const FunctionProtoType *Proto);
+ enum class EltwiseBuiltinArgTyRestriction {
+ None,
+ FloatTy,
+ IntegerTy,
+ SignedIntOrFloatTy,
+ };
+
/// \param FPOnly restricts the arguments to floating-point types.
- std::optional<QualType> BuiltinVectorMath(CallExpr *TheCall,
- bool FPOnly = false);
+ std::optional<QualType>
+ BuiltinVectorMath(CallExpr *TheCall,
+ EltwiseBuiltinArgTyRestriction ArgTyRestr =
+ EltwiseBuiltinArgTyRestriction::None);
bool BuiltinVectorToScalarMath(CallExpr *TheCall);
void checkLifetimeCaptureBy(FunctionDecl *FDecl, bool IsMemberFunction,
@@ -2418,9 +2427,13 @@ class Sema final : public SemaBase {
bool *ICContext = nullptr,
bool IsListInit = false);
- bool BuiltinElementwiseTernaryMath(CallExpr *TheCall,
- bool CheckForFloatArgs = true);
- bool PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall);
+ bool
+ BuiltinElementwiseTernaryMath(CallExpr *TheCall,
+ EltwiseBuiltinArgTyRestriction ArgTyRestr =
+ EltwiseBuiltinArgTyRestriction::FloatTy);
+ bool PrepareBuiltinElementwiseMathOneArgCall(
+ CallExpr *TheCall, EltwiseBuiltinArgTyRestriction ArgTyRestr =
+ EltwiseBuiltinArgTyRestriction::None);
private:
void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
@@ -2529,7 +2542,9 @@ class Sema final : public SemaBase {
AtomicExpr::AtomicOp Op);
/// \param FPOnly restricts the arguments to floating-point types.
- bool BuiltinElementwiseMath(CallExpr *TheCall, bool FPOnly = false);
+ bool BuiltinElementwiseMath(CallExpr *TheCall,
+ EltwiseBuiltinArgTyRestriction ArgTyRestr =
+ EltwiseBuiltinArgTyRestriction::None);
bool PrepareBuiltinReduceMathOneArgCall(CallExpr *TheCall);
bool BuiltinNonDeterministicValue(CallExpr *TheCall);
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 61b2c8cf1cad72..6dacce85d1719c 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -1968,26 +1968,40 @@ bool Sema::CheckTSBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
// Check if \p Ty is a valid type for the elementwise math builtins. If it is
// not a valid type, emit an error message and return true. Otherwise return
// false.
-static bool checkMathBuiltinElementType(Sema &S, SourceLocation Loc,
- QualType ArgTy, int ArgIndex) {
- if (!ArgTy->getAs<VectorType>() &&
- !ConstantMatrixType::isValidElementType(ArgTy)) {
- return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
- << ArgIndex << /* vector, integer or float ty*/ 0 << ArgTy;
- }
-
- return false;
-}
-
-static bool checkFPMathBuiltinElementType(Sema &S, SourceLocation Loc,
- QualType ArgTy, int ArgIndex) {
+static bool
+checkMathBuiltinElementType(Sema &S, SourceLocation Loc, QualType ArgTy,
+ Sema::EltwiseBuiltinArgTyRestriction ArgTyRestr,
+ int ArgOrdinal) {
QualType EltTy = ArgTy;
if (auto *VecTy = EltTy->getAs<VectorType>())
EltTy = VecTy->getElementType();
- if (!EltTy->isRealFloatingType()) {
- return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
- << ArgIndex << /* vector or float ty*/ 5 << ArgTy;
+ switch (ArgTyRestr) {
+ case Sema::EltwiseBuiltinArgTyRestriction::None:
+ if (!ArgTy->getAs<VectorType>() &&
+ !ConstantMatrixType::isValidElementType(ArgTy)) {
+ return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
+ << ArgOrdinal << /* vector, integer or float ty*/ 0 << ArgTy;
+ }
+ break;
+ case Sema::EltwiseBuiltinArgTyRestriction::FloatTy:
+ if (!EltTy->isRealFloatingType()) {
+ return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
+ << ArgOrdinal << /* vector or float ty*/ 5 << ArgTy;
+ }
+ break;
+ case Sema::EltwiseBuiltinArgTyRestriction::IntegerTy:
+ if (!EltTy->isIntegerType()) {
+ return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
+ << ArgOrdinal << /* vector or int ty*/ 10 << ArgTy;
+ }
+ break;
+ case Sema::EltwiseBuiltinArgTyRestriction::SignedIntOrFloatTy:
+ if (EltTy->isUnsignedIntegerType()) {
+ return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
+ << 1 << /* signed integer or float ty*/ 3 << ArgTy;
+ }
+ break;
}
return false;
@@ -2694,23 +2708,11 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
// __builtin_elementwise_abs restricts the element type to signed integers or
// floating point types only.
- case Builtin::BI__builtin_elementwise_abs: {
- if (PrepareBuiltinElementwiseMathOneArgCall(TheCall))
+ case Builtin::BI__builtin_elementwise_abs:
+ if (PrepareBuiltinElementwiseMathOneArgCall(
+ TheCall, EltwiseBuiltinArgTyRestriction::SignedIntOrFloatTy))
return ExprError();
-
- QualType ArgTy = TheCall->getArg(0)->getType();
- QualType EltTy = ArgTy;
-
- if (auto *VecTy = EltTy->getAs<VectorType>())
- EltTy = VecTy->getElementType();
- if (EltTy->isUnsignedIntegerType()) {
- Diag(TheCall->getArg(0)->getBeginLoc(),
- diag::err_builtin_invalid_arg_type)
- << 1 << /* signed integer or float ty*/ 3 << ArgTy;
- return ExprError();
- }
break;
- }
// These builtins restrict the element type to floating point
// types only.
@@ -2736,21 +2738,15 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
case Builtin::BI__builtin_elementwise_tan:
case Builtin::BI__builtin_elementwise_tanh:
case Builtin::BI__builtin_elementwise_trunc:
- case Builtin::BI__builtin_elementwise_canonicalize: {
- if (PrepareBuiltinElementwiseMathOneArgCall(TheCall))
- return ExprError();
-
- QualType ArgTy = TheCall->getArg(0)->getType();
- if (checkFPMathBuiltinElementType(*this, TheCall->getArg(0)->getBeginLoc(),
- ArgTy, 1))
+ case Builtin::BI__builtin_elementwise_canonicalize:
+ if (PrepareBuiltinElementwiseMathOneArgCall(
+ TheCall, EltwiseBuiltinArgTyRestriction::FloatTy))
return ExprError();
break;
- }
- case Builtin::BI__builtin_elementwise_fma: {
+ case Builtin::BI__builtin_elementwise_fma:
if (BuiltinElementwiseTernaryMath(TheCall))
return ExprError();
break;
- }
// These builtins restrict the element type to floating point
// types only, and take in two arguments.
@@ -2758,59 +2754,30 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
case Builtin::BI__builtin_elementwise_maximum:
case Builtin::BI__builtin_elementwise_atan2:
case Builtin::BI__builtin_elementwise_fmod:
- case Builtin::BI__builtin_elementwise_pow: {
- if (BuiltinElementwiseMath(TheCall, /*FPOnly=*/true))
+ case Builtin::BI__builtin_elementwise_pow:
+ if (BuiltinElementwiseMath(TheCall,
+ EltwiseBuiltinArgTyRestriction::FloatTy))
return ExprError();
break;
- }
-
// These builtins restrict the element type to integer
// types only.
case Builtin::BI__builtin_elementwise_add_sat:
- case Builtin::BI__builtin_elementwise_sub_sat: {
- if (BuiltinElementwiseMath(TheCall))
- return ExprError();
-
- const Expr *Arg = TheCall->getArg(0);
- QualType ArgTy = Arg->getType();
- QualType EltTy = ArgTy;
-
- if (auto *VecTy = EltTy->getAs<VectorType>())
- EltTy = VecTy->getElementType();
-
- if (!EltTy->isIntegerType()) {
- Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
- << 1 << /* integer ty */ 6 << ArgTy;
+ case Builtin::BI__builtin_elementwise_sub_sat:
+ if (BuiltinElementwiseMath(TheCall,
+ EltwiseBuiltinArgTyRestriction::IntegerTy))
return ExprError();
- }
break;
- }
-
case Builtin::BI__builtin_elementwise_min:
case Builtin::BI__builtin_elementwise_max:
if (BuiltinElementwiseMath(TheCall))
return ExprError();
break;
case Builtin::BI__builtin_elementwise_popcount:
- case Builtin::BI__builtin_elementwise_bitreverse: {
- if (PrepareBuiltinElementwiseMathOneArgCall(TheCall))
- return ExprError();
-
- const Expr *Arg = TheCall->getArg(0);
- QualType ArgTy = Arg->getType();
- QualType EltTy = ArgTy;
-
- if (auto *VecTy = EltTy->getAs<VectorType>())
- EltTy = VecTy->getElementType();
-
- if (!EltTy->isIntegerType()) {
- Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
- << 1 << /* integer ty */ 6 << ArgTy;
+ case Builtin::BI__builtin_elementwise_bitreverse:
+ if (PrepareBuiltinElementwiseMathOneArgCall(
+ TheCall, EltwiseBuiltinArgTyRestriction::IntegerTy))
return ExprError();
- }
break;
- }
-
case Builtin::BI__builtin_elementwise_copysign: {
if (checkArgCount(TheCall, 2))
return ExprError();
@@ -2822,10 +2789,12 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
QualType MagnitudeTy = Magnitude.get()->getType();
QualType SignTy = Sign.get()->getType();
- if (checkFPMathBuiltinElementType(*this, TheCall->getArg(0)->getBeginLoc(),
- MagnitudeTy, 1) ||
- checkFPMathBuiltinElementType(*this, TheCall->getArg(1)->getBeginLoc(),
- SignTy, 2)) {
+ if (checkMathBuiltinElementType(
+ *this, TheCall->getArg(0)->getBeginLoc(), MagnitudeTy,
+ EltwiseBuiltinArgTyRestriction::FloatTy, 1) ||
+ checkMathBuiltinElementType(
+ *this, TheCall->getArg(1)->getBeginLoc(), SignTy,
+ EltwiseBuiltinArgTyRestriction::FloatTy, 2)) {
return ExprError();
}
@@ -14661,7 +14630,8 @@ static ExprResult BuiltinVectorMathConversions(Sema &S, Expr *E) {
return S.UsualUnaryFPConversions(Res.get());
}
-bool Sema::PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall) {
+bool Sema::PrepareBuiltinElementwiseMathOneArgCall(
+ CallExpr *TheCall, EltwiseBuiltinArgTyRestriction ArgTyRestr) {
if (checkArgCount(TheCall, 1))
return true;
@@ -14672,15 +14642,17 @@ bool Sema::PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall) {
TheCall->setArg(0, A.get());
QualType TyA = A.get()->getType();
- if (checkMathBuiltinElementType(*this, A.get()->getBeginLoc(), TyA, 1))
+ if (checkMathBuiltinElementType(*this, A.get()->getBeginLoc(), TyA,
+ ArgTyRestr, 1))
return true;
TheCall->setType(TyA);
return false;
}
-bool Sema::BuiltinElementwiseMath(CallExpr *TheCall, bool FPOnly) {
- if (auto Res = BuiltinVectorMath(TheCall, FPOnly); Res.has_value()) {
+bool Sema::BuiltinElementwiseMath(CallExpr *TheCall,
+ EltwiseBuiltinArgTyRestriction ArgTyRestr) {
+ if (auto Res = BuiltinVectorMath(TheCall, ArgTyRestr); Res.has_value()) {
TheCall->setType(*Res);
return false;
}
@@ -14713,8 +14685,9 @@ static bool checkBuiltinVectorMathMixedEnums(Sema &S, Expr *LHS, Expr *RHS,
return false;
}
-std::optional<QualType> Sema::BuiltinVectorMath(CallExpr *TheCall,
- bool FPOnly) {
+std::optional<QualType>
+Sema::BuiltinVectorMath(CallExpr *TheCall,
+ EltwiseBuiltinArgTyRestriction ArgTyRestr) {
if (checkArgCount(TheCall, 2))
return std::nullopt;
@@ -14735,26 +14708,21 @@ std::optional<QualType> Sema::BuiltinVectorMath(CallExpr *TheCall,
QualType TyA = Args[0]->getType();
QualType TyB = Args[1]->getType();
+ if (checkMathBuiltinElementType(*this, LocA, TyA, ArgTyRestr, 1))
+ return std::nullopt;
+
if (TyA.getCanonicalType() != TyB.getCanonicalType()) {
Diag(LocA, diag::err_typecheck_call_different_arg_types) << TyA << TyB;
return std::nullopt;
}
- if (FPOnly) {
- if (checkFPMathBuiltinElementType(*this, LocA, TyA, 1))
- return std::nullopt;
- } else {
- if (checkMathBuiltinElementType(*this, LocA, TyA, 1))
- return std::nullopt;
- }
-
TheCall->setArg(0, Args[0]);
TheCall->setArg(1, Args[1]);
return TyA;
}
-bool Sema::BuiltinElementwiseTernaryMath(CallExpr *TheCall,
- bool CheckForFloatArgs) {
+bool Sema::BuiltinElementwiseTernaryMath(
+ CallExpr *TheCall, EltwiseBuiltinArgTyRestriction ArgTyRestr) {
if (checkArgCount(TheCall, 3))
return true;
@@ -14774,20 +14742,11 @@ bool Sema::BuiltinElementwiseTernaryMath(CallExpr *TheCall,
Args[I] = Converted.get();
}
- if (CheckForFloatArgs) {
- int ArgOrdinal = 1;
- for (Expr *Arg : Args) {
- if (checkFPMathBuiltinElementType(*this, Arg->getBeginLoc(),
- Arg->getType(), ArgOrdinal++))
- return true;
- }
- } else {
- int ArgOrdinal = 1;
- for (Expr *Arg : Args) {
- if (checkMathBuiltinElementType(*this, Arg->getBeginLoc(), Arg->getType(),
- ArgOrdinal++))
- return true;
- }
+ int ArgOrdinal = 1;
+ for (Expr *Arg : Args) {
+ if (checkMathBuiltinElementType(*this, Arg->getBeginLoc(), Arg->getType(),
+ ArgTyRestr, ArgOrdinal++))
+ return true;
}
for (int I = 1; I < 3; ++I) {
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index d748c10455289b..b4587931472704 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -2259,8 +2259,10 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
if (CheckVectorElementCallArgs(&SemaRef, TheCall))
return true;
if (SemaRef.BuiltinElementwiseTernaryMath(
- TheCall, /*CheckForFloatArgs*/
- TheCall->getArg(0)->getType()->hasFloatingRepresentation()))
+ TheCall, /*ArgTyRestr*/
+ TheCall->getArg(0)->getType()->hasFloatingRepresentation()
+ ? Sema::EltwiseBuiltinArgTyRestriction::FloatTy
+ : Sema::EltwiseBuiltinArgTyRestriction::None))
return true;
break;
}
@@ -2393,8 +2395,10 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
if (CheckVectorElementCallArgs(&SemaRef, TheCall))
return true;
if (SemaRef.BuiltinElementwiseTernaryMath(
- TheCall, /*CheckForFloatArgs*/
- TheCall->getArg(0)->getType()->hasFloatingRepresentation()))
+ TheCall, /*ArgTyRestr*/
+ TheCall->getArg(0)->getType()->hasFloatingRepresentation()
+ ? Sema::EltwiseBuiltinArgTyRestriction::FloatTy
+ : Sema::EltwiseBuiltinArgTyRestriction::None))
return true;
break;
}
diff --git a/clang/test/Sema/aarch64-sve-vector-exp-ops.c b/clang/test/Sema/aarch64-sve-vector-exp-ops.c
index f2bba8c7eeb196..4b411babbc3471 100644
--- a/clang/test/Sema/aarch64-sve-vector-exp-ops.c
+++ b/clang/test/Sema/aarch64-sve-vector-exp-ops.c
@@ -7,11 +7,11 @@
svfloat32_t test_exp_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_exp(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_exp2_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_exp2(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
diff --git a/clang/test/Sema/aarch64-sve-vector-log-ops.c b/clang/test/Sema/aarch64-sve-vector-log-ops.c
index ef16e8581844d7..bc81323b560c9c 100644
--- a/clang/test/Sema/aarch64-sve-vector-log-ops.c
+++ b/clang/test/Sema/aarch64-sve-vector-log-ops.c
@@ -7,17 +7,17 @@
svfloat32_t test_log_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_log(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_log10_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_log10(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_log2_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_log2(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
diff --git a/clang/test/Sema/aarch64-sve-vector-trig-ops.c b/clang/test/Sema/aarch64-sve-vector-trig-ops.c
index 3fe6834be2e0b7..46df63cbba42bf 100644
--- a/clang/test/Sema/aarch64-sve-vector-trig-ops.c
+++ b/clang/test/Sema/aarch64-sve-vector-trig-ops.c
@@ -7,19 +7,19 @@
svfloat32_t test_asin_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_asin(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_acos_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_acos(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_atan_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_atan(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_atan2_vv_i8mf8(svfloat32_t v) {
@@ -31,35 +31,35 @@ svfloat32_t test_atan2_vv_i8mf8(svfloat32_t v) {
svfloat32_t test_sin_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_sin(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_cos_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_cos(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_tan_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_tan(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_sinh_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_sinh(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_cosh_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_cosh(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
svfloat32_t test_tanh_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_tanh(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
diff --git a/clang/test/Sema/builtins-elementwise-math.c b/clang/test/Sema/builtins-elementwise-math.c
index d6785f78340caf..cfa96657ae468b 100644
--- a/clang/test/Sema/builtins-elementwise-math.c
+++ b/clang/test/Sema/builtins-elementwise-math.c
@@ -45,7 +45,7 @@ void test_builtin_elementwise_abs(int i, double d, float4 v, int3 iv, unsigned u
void test_builtin_elementwise_add_sat(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
i = __builtin_elementwise_add_sat(p, d);
- // expected-error at -1 {{arguments are of different types ('int *' vs 'double')}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'int *')}}
struct Foo foo = __builtin_elementwise_add_sat(i, i);
// expected-error at -1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
@@ -60,13 +60,16 @@ void test_builtin_elementwise_add_sat(int i, short s, double d, float4 v, int3 i
// expected-error at -1 {{too many arguments to function call, expected 2, have 3}}
i = __builtin_elementwise_add_sat(v, iv);
- // expected-error at -1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'float4' (vector of 4 'float' values))}}
+
+ i = __builtin_elementwise_add_sat(iv, v);
+ // expected-error at -1 {{arguments are of different types ('int3' (vector of 3 'int' values) vs 'float4' (vector of 4 'float' values))}}
i = __builtin_elementwise_add_sat(uv, iv);
// expected-error at -1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
v = __builtin_elementwise_add_sat(v, v);
- // expected-error at -1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'float4' (vector of 4 'float' values))}}
s = __builtin_elementwise_add_sat(i, s);
// expected-error at -1 {{arguments are of different types ('int' vs 'short')}}
@@ -95,7 +98,7 @@ void test_builtin_elementwise_add_sat(int i, short s, double d, float4 v, int3 i
int A[10];
A = __builtin_elementwise_add_sat(A, A);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'int *')}}
int(ii);
int j;
@@ -103,12 +106,12 @@ void test_builtin_elementwise_add_sat(int i, short s, double d, float4 v, int3 i
_Complex float c1, c2;
c1 = __builtin_elementwise_add_sat(c1, c2);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was '_Complex float')}}
}
void test_builtin_elementwise_sub_sat(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
i = __builtin_elementwise_sub_sat(p, d);
- // expected-error at -1 {{arguments are of different types ('int *' vs 'double')}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'int *')}}
struct Foo foo = __builtin_elementwise_sub_sat(i, i);
// expected-error at -1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
@@ -123,13 +126,16 @@ void test_builtin_elementwise_sub_sat(int i, short s, double d, float4 v, int3 i
// expected-error at -1 {{too many arguments to function call, expected 2, have 3}}
i = __builtin_elementwise_sub_sat(v, iv);
- // expected-error at -1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'float4' (vector of 4 'float' values))}}
+
+ i = __builtin_elementwise_sub_sat(iv, v);
+ // expected-error at -1 {{arguments are of different types ('int3' (vector of 3 'int' values) vs 'float4' (vector of 4 'float' values))}}
i = __builtin_elementwise_sub_sat(uv, iv);
// expected-error at -1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
v = __builtin_elementwise_sub_sat(v, v);
- // expected-error at -1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'float4' (vector of 4 'float' values))}}
s = __builtin_elementwise_sub_sat(i, s);
// expected-error at -1 {{arguments are of different types ('int' vs 'short')}}
@@ -158,7 +164,7 @@ void test_builtin_elementwise_sub_sat(int i, short s, double d, float4 v, int3 i
int A[10];
A = __builtin_elementwise_sub_sat(A, A);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'int *')}}
int(ii);
int j;
@@ -166,12 +172,12 @@ void test_builtin_elementwise_sub_sat(int i, short s, double d, float4 v, int3 i
_Complex float c1, c2;
c1 = __builtin_elementwise_sub_sat(c1, c2);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was '_Complex float')}}
}
void test_builtin_elementwise_max(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
i = __builtin_elementwise_max(p, d);
- // expected-error at -1 {{arguments are of different types ('int *' vs 'double')}}
+ // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
struct Foo foo = __builtin_elementwise_max(i, i);
// expected-error at -1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
@@ -231,7 +237,7 @@ void test_builtin_elementwise_max(int i, short s, double d, float4 v, int3 iv, u
void test_builtin_elementwise_min(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
i = __builtin_elementwise_min(p, d);
- // expected-error at -1 {{arguments are of different types ('int *' vs 'double')}}
+ // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was 'int *')}}
struct Foo foo = __builtin_elementwise_min(i, i);
// expected-error at -1 {{initializing 'struct Foo' with an expression of incompatible type 'int'}}
@@ -291,7 +297,7 @@ void test_builtin_elementwise_min(int i, short s, double d, float4 v, int3 iv, u
void test_builtin_elementwise_maximum(int i, short s, float f, double d, float4 fv, double4 dv, int3 iv, unsigned3 uv, int *p) {
i = __builtin_elementwise_maximum(p, d);
- // expected-error at -1 {{arguments are of different types ('int *' vs 'double')}}
+ // expected-error at -1 {{1st argument must be a floating point type (was 'int *')}}
struct Foo foo = __builtin_elementwise_maximum(d, d);
// expected-error at -1 {{initializing 'struct Foo' with an expression of incompatible type 'double'}}
@@ -309,7 +315,7 @@ void test_builtin_elementwise_maximum(int i, short s, float f, double d, float4
// expected-error at -1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
i = __builtin_elementwise_maximum(uv, iv);
- // expected-error at -1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
+ // expected-error at -1 {{1st argument must be a floating point type (was 'unsigned3' (vector of 3 'unsigned int' values))}}
dv = __builtin_elementwise_maximum(fv, dv);
// expected-error at -1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}}
@@ -336,7 +342,7 @@ void test_builtin_elementwise_maximum(int i, short s, float f, double d, float4
void test_builtin_elementwise_minimum(int i, short s, float f, double d, float4 fv, double4 dv, int3 iv, unsigned3 uv, int *p) {
i = __builtin_elementwise_minimum(p, d);
- // expected-error at -1 {{arguments are of different types ('int *' vs 'double')}}
+ // expected-error at -1 {{1st argument must be a floating point type (was 'int *')}}
struct Foo foo = __builtin_elementwise_minimum(d, d);
// expected-error at -1 {{initializing 'struct Foo' with an expression of incompatible type 'double'}}
@@ -354,7 +360,7 @@ void test_builtin_elementwise_minimum(int i, short s, float f, double d, float4
// expected-error at -1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
i = __builtin_elementwise_minimum(uv, iv);
- // expected-error at -1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
+ // expected-error at -1 {{1st argument must be a floating point type (was 'unsigned3' (vector of 3 'unsigned int' values))}}
dv = __builtin_elementwise_minimum(fv, dv);
// expected-error at -1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'double4' (vector of 4 'double' values))}}
@@ -388,16 +394,16 @@ void test_builtin_elementwise_bitreverse(int i, float f, double d, float4 v, int
// expected-error at -1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_elementwise_bitreverse(f);
- // expected-error at -1 {{1st argument must be a vector of integers (was 'float')}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'float')}}
i = __builtin_elementwise_bitreverse(f, f);
// expected-error at -1 {{too many arguments to function call, expected 1, have 2}}
u = __builtin_elementwise_bitreverse(d);
- // expected-error at -1 {{1st argument must be a vector of integers (was 'double')}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'double')}}
v = __builtin_elementwise_bitreverse(v);
- // expected-error at -1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'float4' (vector of 4 'float' values))}}
}
void test_builtin_elementwise_ceil(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
@@ -620,16 +626,16 @@ void test_builtin_elementwise_popcount(int i, float f, double d, float4 v, int3
// expected-error at -1 {{too few arguments to function call, expected 1, have 0}}
i = __builtin_elementwise_popcount(f);
- // expected-error at -1 {{1st argument must be a vector of integers (was 'float')}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'float')}}
i = __builtin_elementwise_popcount(f, f);
// expected-error at -1 {{too many arguments to function call, expected 1, have 2}}
u = __builtin_elementwise_popcount(d);
- // expected-error at -1 {{1st argument must be a vector of integers (was 'double')}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'double')}}
v = __builtin_elementwise_popcount(v);
- // expected-error at -1 {{1st argument must be a vector of integers (was 'float4' (vector of 4 'float' values))}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'float4' (vector of 4 'float' values))}}
int2 i2 = __builtin_elementwise_popcount(iv);
// expected-error at -1 {{initializing 'int2' (vector of 2 'int' values) with an expression of incompatible type 'int3' (vector of 3 'int' values)}}
@@ -646,7 +652,7 @@ void test_builtin_elementwise_popcount(int i, float f, double d, float4 v, int3
void test_builtin_elementwise_fmod(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
i = __builtin_elementwise_fmod(p, d);
- // expected-error at -1 {{arguments are of different types ('int *' vs 'double')}}
+ // expected-error at -1 {{1st argument must be a floating point type (was 'int *')}}
struct Foo foo = __builtin_elementwise_fmod(i, i);
// expected-error at -1 {{1st argument must be a floating point type (was 'int')}}
@@ -664,7 +670,7 @@ void test_builtin_elementwise_fmod(int i, short s, double d, float4 v, int3 iv,
// expected-error at -1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
i = __builtin_elementwise_fmod(uv, iv);
- // expected-error at -1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
+ // expected-error at -1 {{1st argument must be a floating point type (was 'unsigned3' (vector of 3 'unsigned int' values))}}
i = __builtin_elementwise_fmod(d, v);
// expected-error at -1 {{arguments are of different types ('double' vs 'float4' (vector of 4 'float' values))}}
@@ -672,7 +678,7 @@ void test_builtin_elementwise_fmod(int i, short s, double d, float4 v, int3 iv,
void test_builtin_elementwise_pow(int i, short s, double d, float4 v, int3 iv, unsigned3 uv, int *p) {
i = __builtin_elementwise_pow(p, d);
- // expected-error at -1 {{arguments are of different types ('int *' vs 'double')}}
+ // expected-error at -1 {{1st argument must be a floating point type (was 'int *')}}
struct Foo foo = __builtin_elementwise_pow(i, i);
// expected-error at -1 {{1st argument must be a floating point type (was 'int')}}
@@ -690,7 +696,7 @@ void test_builtin_elementwise_pow(int i, short s, double d, float4 v, int3 iv, u
// expected-error at -1 {{arguments are of different types ('float4' (vector of 4 'float' values) vs 'int3' (vector of 3 'int' values))}}
i = __builtin_elementwise_pow(uv, iv);
- // expected-error at -1 {{arguments are of different types ('unsigned3' (vector of 3 'unsigned int' values) vs 'int3' (vector of 3 'int' values))}}
+ // expected-error at -1 {{1st argument must be a floating point type (was 'unsigned3' (vector of 3 'unsigned int' values))}}
}
@@ -734,10 +740,9 @@ void test_builtin_elementwise_round(int i, float f, double d, float4 v, int3 iv,
uv = __builtin_elementwise_round(uv);
// expected-error at -1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
- // FIXME: Error should not mention integer
_Complex float c1, c2;
c1 = __builtin_elementwise_round(c1);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
+ // expected-error at -1 {{1st argument must be a floating point type (was '_Complex float')}}
}
void test_builtin_elementwise_rint(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
@@ -759,10 +764,9 @@ void test_builtin_elementwise_rint(int i, float f, double d, float4 v, int3 iv,
uv = __builtin_elementwise_rint(uv);
// expected-error at -1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
- // FIXME: Error should not mention integer
_Complex float c1, c2;
c1 = __builtin_elementwise_rint(c1);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
+ // expected-error at -1 {{1st argument must be a floating point type (was '_Complex float')}}
}
void test_builtin_elementwise_nearbyint(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
@@ -784,10 +788,9 @@ void test_builtin_elementwise_nearbyint(int i, float f, double d, float4 v, int3
uv = __builtin_elementwise_nearbyint(uv);
// expected-error at -1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
- // FIXME: Error should not mention integer
_Complex float c1, c2;
c1 = __builtin_elementwise_nearbyint(c1);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
+ // expected-error at -1 {{1st argument must be a floating point type (was '_Complex float')}}
}
void test_builtin_elementwise_asin(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
diff --git a/clang/test/Sema/riscv-rvv-vector-exp-ops.c b/clang/test/Sema/riscv-rvv-vector-exp-ops.c
index a0ac46f760a309..7f8f59ab5cfebb 100644
--- a/clang/test/Sema/riscv-rvv-vector-exp-ops.c
+++ b/clang/test/Sema/riscv-rvv-vector-exp-ops.c
@@ -9,11 +9,11 @@
vfloat32mf2_t test_exp_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_exp(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_exp2_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_exp2(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
diff --git a/clang/test/Sema/riscv-rvv-vector-log-ops.c b/clang/test/Sema/riscv-rvv-vector-log-ops.c
index 970cfe3fd68bfb..5028803efd861d 100644
--- a/clang/test/Sema/riscv-rvv-vector-log-ops.c
+++ b/clang/test/Sema/riscv-rvv-vector-log-ops.c
@@ -9,17 +9,17 @@
vfloat32mf2_t test_log_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_log(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_log10_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_log10(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_log2_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_log2(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
diff --git a/clang/test/Sema/riscv-rvv-vector-trig-ops.c b/clang/test/Sema/riscv-rvv-vector-trig-ops.c
index 0aed1b2a099865..077d1ba61c6e24 100644
--- a/clang/test/Sema/riscv-rvv-vector-trig-ops.c
+++ b/clang/test/Sema/riscv-rvv-vector-trig-ops.c
@@ -8,19 +8,19 @@
vfloat32mf2_t test_asin_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_asin(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_acos_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_acos(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_atan_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_atan(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_atan2_vv_i8mf8(vfloat32mf2_t v) {
@@ -32,36 +32,36 @@ vfloat32mf2_t test_atan2_vv_i8mf8(vfloat32mf2_t v) {
vfloat32mf2_t test_sin_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_sin(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_cos_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_cos(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_tan_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_tan(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_sinh_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_sinh(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_cosh_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_cosh(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
vfloat32mf2_t test_tanh_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_tanh(v);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type}}
+ // expected-error at -1 {{1st argument must be a floating point type}}
}
diff --git a/clang/test/SemaHLSL/BuiltIns/exp-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/exp-errors.hlsl
index 321fc915ec01fc..bb93e652582cf5 100644
--- a/clang/test/SemaHLSL/BuiltIns/exp-errors.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/exp-errors.hlsl
@@ -13,7 +13,7 @@ float2 test_too_many_arg(float2 p0) {
float builtin_bool_to_float_type_promotion(bool p1) {
return TEST_FUNC(p1);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was 'bool')}}
+ // expected-error at -1 {{1st argument must be a floating point type (was 'bool')}}
}
float builtin_exp_int_to_float_promotion(int p1) {
diff --git a/clang/test/SemaHLSL/BuiltIns/reversebits-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/reversebits-errors.hlsl
index 49cd895d98c52d..e01fb9151de159 100644
--- a/clang/test/SemaHLSL/BuiltIns/reversebits-errors.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/reversebits-errors.hlsl
@@ -3,7 +3,7 @@
double2 test_int_builtin(double2 p0) {
return __builtin_elementwise_bitreverse(p0);
- // expected-error at -1 {{1st argument must be a vector of integers (was 'double2' (aka 'vector<double, 2>'))}}
+ // expected-error at -1 {{1st argument must be an integer or vector of integers (was 'double2' (aka 'vector<double, 2>'))}}
}
int2 test_int_builtin(int2 p0) {
diff --git a/clang/test/SemaHLSL/BuiltIns/round-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/round-errors.hlsl
index bede89015298b6..52eff2204b901f 100644
--- a/clang/test/SemaHLSL/BuiltIns/round-errors.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/round-errors.hlsl
@@ -13,7 +13,7 @@ float2 test_too_many_arg(float2 p0) {
float builtin_bool_to_float_type_promotion(bool p1) {
return __builtin_elementwise_round(p1);
- // expected-error at -1 {{1st argument must be a vector, integer or floating point type (was 'bool')}}
+ // expected-error at -1 {{1st argument must be a floating point type (was 'bool')}}
}
float builtin_round_int_to_float_promotion(int p1) {
More information about the cfe-commits
mailing list