Skip to content

Commit 744fd50

Browse files
committed
Updated according to review
1 parent 04af578 commit 744fd50

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

clang/lib/Headers/hlsl/hlsl_alias_intrinsics.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,6 +2502,9 @@ __attribute__((convergent)) double4 WaveReadLaneAt(double4, uint32_t);
25022502
// WaveActiveBitOr builtins
25032503
//===----------------------------------------------------------------------===//
25042504

2505+
// \brief Returns the value of the expression for the given lane index within
2506+
// the specified wave.
2507+
25052508
_HLSL_AVAILABILITY(shadermodel, 6.0)
25062509
_HLSL_BUILTIN_ALIAS(__builtin_hlsl_wave_active_bit_or)
25072510
__attribute__((convergent)) uint WaveActiveBitOr(uint);

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3215,22 +3215,22 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
32153215
if (SemaRef.checkArgCount(TheCall, 1))
32163216
return true;
32173217

3218-
// Ensure input expr type is a scalar/vector and the same as the return type
3219-
if (CheckAnyScalarOrVector(&SemaRef, TheCall, 0))
3220-
return true;
32213218
if (CheckWaveActive(&SemaRef, TheCall))
32223219
return true;
32233220

3224-
// Ensure expression parameter type can be interpreted as a uint
3221+
// Ensure the expr type is interpretable as a uint or vector<uint>
32253222
ExprResult Expr = TheCall->getArg(0);
32263223
QualType ArgTyExpr = Expr.get()->getType();
3227-
if (!ArgTyExpr->isIntegerType()) {
3224+
auto *VTy = ArgTyExpr->getAs<VectorType>();
3225+
if (!(ArgTyExpr->isIntegerType() ||
3226+
(VTy && VTy->getElementType()->isIntegerType()))) {
32283227
SemaRef.Diag(TheCall->getArg(0)->getBeginLoc(),
3229-
diag::err_typecheck_convert_incompatible)
3228+
diag::err_builtin_invalid_arg_type)
32303229
<< ArgTyExpr << SemaRef.Context.UnsignedIntTy << 1 << 0 << 0;
32313230
return true;
32323231
}
32333232

3233+
// Ensure input expr type is the same as the return type
32343234
TheCall->setType(ArgTyExpr);
32353235
break;
32363236
}

llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,8 +2015,7 @@ bool SPIRVInstructionSelector::selectAnyOrAll(Register ResVReg,
20152015
Register InputRegister = I.getOperand(2).getReg();
20162016
SPIRVType *InputType = GR.getSPIRVTypeForVReg(InputRegister);
20172017

2018-
if (!InputType)
2019-
report_fatal_error("Input Type could not be determined.");
2018+
assert(InputType && "VReg has no type assigned");
20202019

20212020
bool IsBoolTy = GR.isScalarOrVectorOfType(InputRegister, SPIRV::OpTypeBool);
20222021
bool IsVectorTy = InputType->getOpcode() == SPIRV::OpTypeVector;

llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveBitOr.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-vulkan-unknown %s -o - | FileCheck %s
2-
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-unknown %s -o - -filetype=obj | spirv-val %}
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val --target-env spv1.4 %}
33

44
; Test lowering to spir-v backend for various types and scalar/vector
55

@@ -27,4 +27,4 @@ entry:
2727
ret i64 %0
2828
}
2929

30-
declare i64 @llvm.spv.wave.reduce.or.i64(i64)
30+
declare i64 @llvm.spv.wave.reduce.or.i64(i64)

0 commit comments

Comments
 (0)