Skip to content

Commit 651f799

Browse files
committed
Addressed some feedback from the old PR
1 parent 9498523 commit 651f799

File tree

4 files changed

+46
-47
lines changed

4 files changed

+46
-47
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9300,8 +9300,7 @@ def err_typecheck_expect_scalar_or_vector : Error<
93009300
def err_typecheck_expect_any_scalar_or_vector : Error<
93019301
"invalid operand of type %0 where a scalar or vector is required">;
93029302
def err_typecheck_expect_scalar_or_vector_not_type : Error<
9303-
"invalid operand of type %0 where %1 or "
9304-
"a vector of such type is not allowed">;
9303+
"invalid operand of type %0">;
93059304
def err_typecheck_expect_flt_or_vector : Error<
93069305
"invalid operand of type %0 where floating, complex or "
93079306
"a vector of such types is required">;

clang/lib/Headers/hlsl/hlsl_intrinsics.h

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,98 +2402,98 @@ __attribute__((convergent)) double4 WaveReadLaneAt(double4, int32_t);
24022402

24032403
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.0)
24042404
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2405-
__attribute((convergent)) half WaveActiveSum(half);
2405+
__attribute__((convergent)) half WaveActiveSum(half);
24062406
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.0)
24072407
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2408-
__attribute((convergent)) half2 WaveActiveSum(half2);
2408+
__attribute__((convergent)) half2 WaveActiveSum(half2);
24092409
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.0)
24102410
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2411-
__attribute((convergent)) half3 WaveActiveSum(half3);
2411+
__attribute__((convergent)) half3 WaveActiveSum(half3);
24122412
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.0)
24132413
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2414-
__attribute((convergent)) half4 WaveActiveSum(half4);
2414+
__attribute__((convergent)) half4 WaveActiveSum(half4);
24152415

24162416
#ifdef __HLSL_ENABLE_16_BIT
24172417
_HLSL_AVAILABILITY(shadermodel, 6.0)
24182418
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2419-
__attribute((convergent)) int16_t WaveActiveSum(int16_t);
2419+
__attribute__((convergent)) int16_t WaveActiveSum(int16_t);
24202420
_HLSL_AVAILABILITY(shadermodel, 6.0)
24212421
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2422-
__attribute((convergent)) int16_t2 WaveActiveSum(int16_t2);
2422+
__attribute__((convergent)) int16_t2 WaveActiveSum(int16_t2);
24232423
_HLSL_AVAILABILITY(shadermodel, 6.0)
24242424
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2425-
__attribute((convergent)) int16_t3 WaveActiveSum(int16_t3);
2425+
__attribute__((convergent)) int16_t3 WaveActiveSum(int16_t3);
24262426
_HLSL_AVAILABILITY(shadermodel, 6.0)
24272427
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2428-
__attribute((convergent)) int16_t4 WaveActiveSum(int16_t4);
2428+
__attribute__((convergent)) int16_t4 WaveActiveSum(int16_t4);
24292429

24302430
_HLSL_AVAILABILITY(shadermodel, 6.0)
24312431
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2432-
__attribute((convergent)) uint16_t WaveActiveSum(uint16_t);
2432+
__attribute__((convergent)) uint16_t WaveActiveSum(uint16_t);
24332433
_HLSL_AVAILABILITY(shadermodel, 6.0)
24342434
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2435-
__attribute((convergent)) uint16_t2 WaveActiveSum(uint16_t2);
2435+
__attribute__((convergent)) uint16_t2 WaveActiveSum(uint16_t2);
24362436
_HLSL_AVAILABILITY(shadermodel, 6.0)
24372437
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2438-
__attribute((convergent)) uint16_t3 WaveActiveSum(uint16_t3);
2438+
__attribute__((convergent)) uint16_t3 WaveActiveSum(uint16_t3);
24392439
_HLSL_AVAILABILITY(shadermodel, 6.0)
24402440
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2441-
__attribute((convergent)) uint16_t4 WaveActiveSum(uint16_t4);
2441+
__attribute__((convergent)) uint16_t4 WaveActiveSum(uint16_t4);
24422442
#endif
24432443

24442444
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2445-
__attribute((convergent)) int WaveActiveSum(int);
2445+
__attribute__((convergent)) int WaveActiveSum(int);
24462446
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2447-
__attribute((convergent)) int2 WaveActiveSum(int2);
2447+
__attribute__((convergent)) int2 WaveActiveSum(int2);
24482448
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2449-
__attribute((convergent)) int3 WaveActiveSum(int3);
2449+
__attribute__((convergent)) int3 WaveActiveSum(int3);
24502450
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2451-
__attribute((convergent)) int4 WaveActiveSum(int4);
2451+
__attribute__((convergent)) int4 WaveActiveSum(int4);
24522452

24532453
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2454-
__attribute((convergent)) uint WaveActiveSum(uint);
2454+
__attribute__((convergent)) uint WaveActiveSum(uint);
24552455
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2456-
__attribute((convergent)) uint2 WaveActiveSum(uint2);
2456+
__attribute__((convergent)) uint2 WaveActiveSum(uint2);
24572457
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2458-
__attribute((convergent)) uint3 WaveActiveSum(uint3);
2458+
__attribute__((convergent)) uint3 WaveActiveSum(uint3);
24592459
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2460-
__attribute((convergent)) uint4 WaveActiveSum(uint4);
2460+
__attribute__((convergent)) uint4 WaveActiveSum(uint4);
24612461

24622462
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2463-
__attribute((convergent)) int64_t WaveActiveSum(int64_t);
2463+
__attribute__((convergent)) int64_t WaveActiveSum(int64_t);
24642464
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2465-
__attribute((convergent)) int64_t2 WaveActiveSum(int64_t2);
2465+
__attribute__((convergent)) int64_t2 WaveActiveSum(int64_t2);
24662466
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2467-
__attribute((convergent)) int64_t3 WaveActiveSum(int64_t3);
2467+
__attribute__((convergent)) int64_t3 WaveActiveSum(int64_t3);
24682468
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2469-
__attribute((convergent)) int64_t4 WaveActiveSum(int64_t4);
2469+
__attribute__((convergent)) int64_t4 WaveActiveSum(int64_t4);
24702470

24712471
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2472-
__attribute((convergent)) uint64_t WaveActiveSum(uint64_t);
2472+
__attribute__((convergent)) uint64_t WaveActiveSum(uint64_t);
24732473
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2474-
__attribute((convergent)) uint64_t2 WaveActiveSum(uint64_t2);
2474+
__attribute__((convergent)) uint64_t2 WaveActiveSum(uint64_t2);
24752475
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2476-
__attribute((convergent)) uint64_t3 WaveActiveSum(uint64_t3);
2476+
__attribute__((convergent)) uint64_t3 WaveActiveSum(uint64_t3);
24772477
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2478-
__attribute((convergent)) uint64_t4 WaveActiveSum(uint64_t4);
2478+
__attribute__((convergent)) uint64_t4 WaveActiveSum(uint64_t4);
24792479

24802480
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2481-
__attribute((convergent)) float WaveActiveSum(float);
2481+
__attribute__((convergent)) float WaveActiveSum(float);
24822482
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2483-
__attribute((convergent)) float2 WaveActiveSum(float2);
2483+
__attribute__((convergent)) float2 WaveActiveSum(float2);
24842484
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2485-
__attribute((convergent)) float3 WaveActiveSum(float3);
2485+
__attribute__((convergent)) float3 WaveActiveSum(float3);
24862486
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2487-
__attribute((convergent)) float4 WaveActiveSum(float4);
2487+
__attribute__((convergent)) float4 WaveActiveSum(float4);
24882488

24892489
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2490-
__attribute((convergent)) double WaveActiveSum(double);
2490+
__attribute__((convergent)) double WaveActiveSum(double);
24912491
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2492-
__attribute((convergent)) double2 WaveActiveSum(double2);
2492+
__attribute__((convergent)) double2 WaveActiveSum(double2);
24932493
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2494-
__attribute((convergent)) double3 WaveActiveSum(double3);
2494+
__attribute__((convergent)) double3 WaveActiveSum(double3);
24952495
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2496-
__attribute((convergent)) double4 WaveActiveSum(double4);
2496+
__attribute__((convergent)) double4 WaveActiveSum(double4);
24972497

24982498
//===----------------------------------------------------------------------===//
24992499
// sign builtins

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,18 +1865,18 @@ static bool CheckAnyScalarOrVector(Sema *S, CallExpr *TheCall,
18651865
return false;
18661866
}
18671867

1868-
static bool CheckNotScalarType(Sema *S, CallExpr *TheCall, QualType Scalar,
1869-
unsigned ArgIndex) {
1868+
static bool CheckNotBoolType(Sema *S, CallExpr *TheCall, unsigned ArgIndex) {
1869+
QualType BoolType = S->getASTContext().BoolTy;
18701870
assert(TheCall->getNumArgs() >= ArgIndex);
18711871
QualType ArgType = TheCall->getArg(ArgIndex)->getType();
18721872
auto *VTy = ArgType->getAs<VectorType>();
1873-
// is the scalar or vector<scalar>
1874-
if (S->Context.hasSameUnqualifiedType(ArgType, Scalar) ||
1873+
// is the bool or vector<bool>
1874+
if (S->Context.hasSameUnqualifiedType(ArgType, BoolType) ||
18751875
(VTy &&
1876-
S->Context.hasSameUnqualifiedType(VTy->getElementType(), Scalar))) {
1876+
S->Context.hasSameUnqualifiedType(VTy->getElementType(), BoolType))) {
18771877
S->Diag(TheCall->getArg(0)->getBeginLoc(),
18781878
diag::err_typecheck_expect_scalar_or_vector_not_type)
1879-
<< ArgType << Scalar;
1879+
<< ArgType << BoolType;
18801880
return true;
18811881
}
18821882
return false;
@@ -2179,7 +2179,7 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
21792179
// Ensure input expr type is a scalar/vector and the same as the return type
21802180
if (CheckAnyScalarOrVector(&SemaRef, TheCall, 0))
21812181
return true;
2182-
if (CheckNotScalarType(&SemaRef, TheCall, getASTContext().BoolTy, 0))
2182+
if (CheckNotBoolType(&SemaRef, TheCall, 0))
21832183
return true;
21842184
ExprResult Expr = TheCall->getArg(0);
21852185
QualType ArgTyExpr = Expr.get()->getType();

clang/test/SemaHLSL/BuiltIns/WaveActiveSum-errors.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ float2 test_too_many_arg(float2 p0) {
1212

1313
bool test_expr_bool_type_check(bool p0) {
1414
return __builtin_hlsl_wave_active_sum(p0);
15-
// expected-error@-1 {{invalid operand of type 'bool' where 'bool' or a vector of such type is not allowed}}
15+
// expected-error@-1 {{invalid operand of type 'bool'}}
1616
}
1717

1818
bool2 test_expr_bool_vec_type_check(bool2 p0) {
1919
return __builtin_hlsl_wave_active_sum(p0);
20-
// expected-error@-1 {{invalid operand of type 'bool2' (aka 'vector<bool, 2>') where 'bool' or a vector of such type is not allowed}}
20+
// expected-error@-1 {{invalid operand of type 'bool2' (aka 'vector<bool, 2>')}}
2121
}
2222

2323
struct S { float f; };

0 commit comments

Comments
 (0)