Skip to content

Commit 0fab59a

Browse files
committed
Addressed some feedback from the old PR
1 parent 9a1ad54 commit 0fab59a

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
@@ -9288,8 +9288,7 @@ def err_typecheck_expect_scalar_or_vector : Error<
92889288
def err_typecheck_expect_any_scalar_or_vector : Error<
92899289
"invalid operand of type %0 where a scalar or vector is required">;
92909290
def err_typecheck_expect_scalar_or_vector_not_type : Error<
9291-
"invalid operand of type %0 where %1 or "
9292-
"a vector of such type is not allowed">;
9291+
"invalid operand of type %0">;
92939292
def err_typecheck_expect_flt_or_vector : Error<
92949293
"invalid operand of type %0 where floating, complex or "
92959294
"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
@@ -2364,98 +2364,98 @@ __attribute__((convergent)) double4 WaveReadLaneAt(double4, int32_t);
23642364

23652365
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.0)
23662366
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2367-
__attribute((convergent)) half WaveActiveSum(half);
2367+
__attribute__((convergent)) half WaveActiveSum(half);
23682368
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.0)
23692369
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2370-
__attribute((convergent)) half2 WaveActiveSum(half2);
2370+
__attribute__((convergent)) half2 WaveActiveSum(half2);
23712371
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.0)
23722372
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2373-
__attribute((convergent)) half3 WaveActiveSum(half3);
2373+
__attribute__((convergent)) half3 WaveActiveSum(half3);
23742374
_HLSL_16BIT_AVAILABILITY(shadermodel, 6.0)
23752375
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2376-
__attribute((convergent)) half4 WaveActiveSum(half4);
2376+
__attribute__((convergent)) half4 WaveActiveSum(half4);
23772377

23782378
#ifdef __HLSL_ENABLE_16_BIT
23792379
_HLSL_AVAILABILITY(shadermodel, 6.0)
23802380
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2381-
__attribute((convergent)) int16_t WaveActiveSum(int16_t);
2381+
__attribute__((convergent)) int16_t WaveActiveSum(int16_t);
23822382
_HLSL_AVAILABILITY(shadermodel, 6.0)
23832383
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2384-
__attribute((convergent)) int16_t2 WaveActiveSum(int16_t2);
2384+
__attribute__((convergent)) int16_t2 WaveActiveSum(int16_t2);
23852385
_HLSL_AVAILABILITY(shadermodel, 6.0)
23862386
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2387-
__attribute((convergent)) int16_t3 WaveActiveSum(int16_t3);
2387+
__attribute__((convergent)) int16_t3 WaveActiveSum(int16_t3);
23882388
_HLSL_AVAILABILITY(shadermodel, 6.0)
23892389
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2390-
__attribute((convergent)) int16_t4 WaveActiveSum(int16_t4);
2390+
__attribute__((convergent)) int16_t4 WaveActiveSum(int16_t4);
23912391

23922392
_HLSL_AVAILABILITY(shadermodel, 6.0)
23932393
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2394-
__attribute((convergent)) uint16_t WaveActiveSum(uint16_t);
2394+
__attribute__((convergent)) uint16_t WaveActiveSum(uint16_t);
23952395
_HLSL_AVAILABILITY(shadermodel, 6.0)
23962396
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2397-
__attribute((convergent)) uint16_t2 WaveActiveSum(uint16_t2);
2397+
__attribute__((convergent)) uint16_t2 WaveActiveSum(uint16_t2);
23982398
_HLSL_AVAILABILITY(shadermodel, 6.0)
23992399
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2400-
__attribute((convergent)) uint16_t3 WaveActiveSum(uint16_t3);
2400+
__attribute__((convergent)) uint16_t3 WaveActiveSum(uint16_t3);
24012401
_HLSL_AVAILABILITY(shadermodel, 6.0)
24022402
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2403-
__attribute((convergent)) uint16_t4 WaveActiveSum(uint16_t4);
2403+
__attribute__((convergent)) uint16_t4 WaveActiveSum(uint16_t4);
24042404
#endif
24052405

24062406
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2407-
__attribute((convergent)) int WaveActiveSum(int);
2407+
__attribute__((convergent)) int WaveActiveSum(int);
24082408
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2409-
__attribute((convergent)) int2 WaveActiveSum(int2);
2409+
__attribute__((convergent)) int2 WaveActiveSum(int2);
24102410
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2411-
__attribute((convergent)) int3 WaveActiveSum(int3);
2411+
__attribute__((convergent)) int3 WaveActiveSum(int3);
24122412
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2413-
__attribute((convergent)) int4 WaveActiveSum(int4);
2413+
__attribute__((convergent)) int4 WaveActiveSum(int4);
24142414

24152415
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2416-
__attribute((convergent)) uint WaveActiveSum(uint);
2416+
__attribute__((convergent)) uint WaveActiveSum(uint);
24172417
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2418-
__attribute((convergent)) uint2 WaveActiveSum(uint2);
2418+
__attribute__((convergent)) uint2 WaveActiveSum(uint2);
24192419
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2420-
__attribute((convergent)) uint3 WaveActiveSum(uint3);
2420+
__attribute__((convergent)) uint3 WaveActiveSum(uint3);
24212421
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2422-
__attribute((convergent)) uint4 WaveActiveSum(uint4);
2422+
__attribute__((convergent)) uint4 WaveActiveSum(uint4);
24232423

24242424
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2425-
__attribute((convergent)) int64_t WaveActiveSum(int64_t);
2425+
__attribute__((convergent)) int64_t WaveActiveSum(int64_t);
24262426
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2427-
__attribute((convergent)) int64_t2 WaveActiveSum(int64_t2);
2427+
__attribute__((convergent)) int64_t2 WaveActiveSum(int64_t2);
24282428
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2429-
__attribute((convergent)) int64_t3 WaveActiveSum(int64_t3);
2429+
__attribute__((convergent)) int64_t3 WaveActiveSum(int64_t3);
24302430
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2431-
__attribute((convergent)) int64_t4 WaveActiveSum(int64_t4);
2431+
__attribute__((convergent)) int64_t4 WaveActiveSum(int64_t4);
24322432

24332433
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2434-
__attribute((convergent)) uint64_t WaveActiveSum(uint64_t);
2434+
__attribute__((convergent)) uint64_t WaveActiveSum(uint64_t);
24352435
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2436-
__attribute((convergent)) uint64_t2 WaveActiveSum(uint64_t2);
2436+
__attribute__((convergent)) uint64_t2 WaveActiveSum(uint64_t2);
24372437
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2438-
__attribute((convergent)) uint64_t3 WaveActiveSum(uint64_t3);
2438+
__attribute__((convergent)) uint64_t3 WaveActiveSum(uint64_t3);
24392439
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2440-
__attribute((convergent)) uint64_t4 WaveActiveSum(uint64_t4);
2440+
__attribute__((convergent)) uint64_t4 WaveActiveSum(uint64_t4);
24412441

24422442
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2443-
__attribute((convergent)) float WaveActiveSum(float);
2443+
__attribute__((convergent)) float WaveActiveSum(float);
24442444
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2445-
__attribute((convergent)) float2 WaveActiveSum(float2);
2445+
__attribute__((convergent)) float2 WaveActiveSum(float2);
24462446
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2447-
__attribute((convergent)) float3 WaveActiveSum(float3);
2447+
__attribute__((convergent)) float3 WaveActiveSum(float3);
24482448
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2449-
__attribute((convergent)) float4 WaveActiveSum(float4);
2449+
__attribute__((convergent)) float4 WaveActiveSum(float4);
24502450

24512451
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2452-
__attribute((convergent)) double WaveActiveSum(double);
2452+
__attribute__((convergent)) double WaveActiveSum(double);
24532453
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2454-
__attribute((convergent)) double2 WaveActiveSum(double2);
2454+
__attribute__((convergent)) double2 WaveActiveSum(double2);
24552455
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2456-
__attribute((convergent)) double3 WaveActiveSum(double3);
2456+
__attribute__((convergent)) double3 WaveActiveSum(double3);
24572457
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_sum)
2458-
__attribute((convergent)) double4 WaveActiveSum(double4);
2458+
__attribute__((convergent)) double4 WaveActiveSum(double4);
24592459

24602460
//===----------------------------------------------------------------------===//
24612461
// sign builtins

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,18 +1853,18 @@ static bool CheckAnyScalarOrVector(Sema *S, CallExpr *TheCall,
18531853
return false;
18541854
}
18551855

1856-
static bool CheckNotScalarType(Sema *S, CallExpr *TheCall, QualType Scalar,
1857-
unsigned ArgIndex) {
1856+
static bool CheckNotBoolType(Sema *S, CallExpr *TheCall, unsigned ArgIndex) {
1857+
QualType BoolType = S->getASTContext().BoolTy;
18581858
assert(TheCall->getNumArgs() >= ArgIndex);
18591859
QualType ArgType = TheCall->getArg(ArgIndex)->getType();
18601860
auto *VTy = ArgType->getAs<VectorType>();
1861-
// is the scalar or vector<scalar>
1862-
if (S->Context.hasSameUnqualifiedType(ArgType, Scalar) ||
1861+
// is the bool or vector<bool>
1862+
if (S->Context.hasSameUnqualifiedType(ArgType, BoolType) ||
18631863
(VTy &&
1864-
S->Context.hasSameUnqualifiedType(VTy->getElementType(), Scalar))) {
1864+
S->Context.hasSameUnqualifiedType(VTy->getElementType(), BoolType))) {
18651865
S->Diag(TheCall->getArg(0)->getBeginLoc(),
18661866
diag::err_typecheck_expect_scalar_or_vector_not_type)
1867-
<< ArgType << Scalar;
1867+
<< ArgType << BoolType;
18681868
return true;
18691869
}
18701870
return false;
@@ -2185,7 +2185,7 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
21852185
// Ensure input expr type is a scalar/vector and the same as the return type
21862186
if (CheckAnyScalarOrVector(&SemaRef, TheCall, 0))
21872187
return true;
2188-
if (CheckNotScalarType(&SemaRef, TheCall, getASTContext().BoolTy, 0))
2188+
if (CheckNotBoolType(&SemaRef, TheCall, 0))
21892189
return true;
21902190
ExprResult Expr = TheCall->getArg(0);
21912191
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)