Skip to content

Commit fcd1949

Browse files
committed
Address comments
1 parent af0c150 commit fcd1949

File tree

7 files changed

+12
-22
lines changed

7 files changed

+12
-22
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19109,20 +19109,19 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
1910919109
ArrayRef<Value *>{Op0, Op1}, nullptr, "hlsl.step");
1911019110
}
1911119111
case Builtin::BI__builtin_hlsl_wave_active_any_true: {
19112-
IntegerType *Int1Ty =
19113-
llvm::Type::getInt1Ty(CGM.getTypes().getLLVMContext());
1911419112
Value *Op = EmitScalarExpr(E->getArg(0));
19115-
assert(Op->getType() == Int1Ty &&
19116-
"wave_active_any_true operand must be a bool");
19113+
llvm::Type *Ty = Op->getType();
19114+
assert(Ty->isIntegerTy(1) && "wave_active_any_true operand must be a bool");
1911719115

1911819116
llvm::FunctionType *FT =
19119-
llvm::FunctionType::get(Int1Ty, {Int1Ty}, /*isVarArg=*/false);
19117+
llvm::FunctionType::get(Ty, {Ty}, /*isVarArg=*/false);
1912019118
llvm::StringRef Name = Intrinsic::getName(
1912119119
CGM.getHLSLRuntime().getWaveActiveAnyTrueIntrinsic());
1912219120
return EmitRuntimeCall(CGM.CreateRuntimeFunction(FT, Name, {},
1912319121
/*Local=*/false,
1912419122
/*AssumeConvergent=*/true),
1912519123
{Op}, "hlsl.wave.activeanytrue");
19124+
}
1912619125
case Builtin::BI__builtin_hlsl_wave_active_count_bits: {
1912719126
Value *OpExpr = EmitScalarExpr(E->getArg(0));
1912819127
Intrinsic::ID ID = CGM.getHLSLRuntime().getWaveActiveCountBitsIntrinsic();

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,12 +2091,6 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
20912091
return true;
20922092
break;
20932093
}
2094-
case Builtin::BI__builtin_hlsl_wave_active_any_true: {
2095-
if (SemaRef.checkArgCount(TheCall, 1))
2096-
return true;
2097-
2098-
break;
2099-
}
21002094
case Builtin::BI__builtin_hlsl_wave_read_lane_at: {
21012095
if (SemaRef.checkArgCount(TheCall, 2))
21022096
return true;

clang/test/CodeGenHLSL/builtins/WaveActiveAnyTrue.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -fnative-half-type -triple \
1+
// RUN: %clang_cc1 -finclude-default-header -fnative-half-type -triple \
22
// RUN: dxil-pc-shadermodel6.3-compute %s -emit-llvm -disable-llvm-passes -o - | \
33
// RUN: FileCheck %s --check-prefixes=CHECK,CHECK-DXIL
4-
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -fnative-half-type -triple \
4+
// RUN: %clang_cc1 -finclude-default-header -fnative-half-type -triple \
55
// RUN: spirv-pc-vulkan-compute %s -emit-llvm -disable-llvm-passes -o - | \
66
// RUN: FileCheck %s --check-prefixes=CHECK,CHECK-SPIRV
77

llvm/lib/Target/DirectX/DXIL.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ defset list<DXILOpClass> OpClasses = {
202202
def unpack4x8 : DXILOpClass;
203203
def viewID : DXILOpClass;
204204
def waveActiveAllEqual : DXILOpClass;
205-
def waveActiveAnyTrue : DXILOpClass;
206205
def waveActiveBallot : DXILOpClass;
207206
def waveActiveBit : DXILOpClass;
208207
def waveActiveOp : DXILOpClass;
@@ -854,7 +853,7 @@ def CreateHandleFromBinding : DXILOp<217, createHandleFromBinding> {
854853
let stages = [Stages<DXIL1_6, [all_stages]>];
855854
}
856855

857-
def WaveActiveAnyTrue : DXILOp<113, waveActiveAnyTrue> {
856+
def WaveActiveAnyTrue : DXILOp<113, waveAnyTrue> {
858857
let Doc = "returns true if the expression is true in any of the active lanes in the current wave";
859858
let LLVMIntrinsic = int_dx_wave_activeanytrue;
860859
let arguments = [Int1Ty];

llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,15 +1929,13 @@ bool SPIRVInstructionSelector::selectWaveActiveAnyTrue(Register ResVReg,
19291929
assert(I.getNumOperands() == 3);
19301930
assert(I.getOperand(2).isReg());
19311931

1932-
// IntTy is used to define the execution scope, set to 3 to denote a
1933-
// cross-lane interaction equivalent to a SPIR-V subgroup.
19341932
MachineBasicBlock &BB = *I.getParent();
19351933
SPIRVType *IntTy = GR.getOrCreateSPIRVIntegerType(32, I, TII);
19361934

19371935
return BuildMI(BB, I, I.getDebugLoc(), TII.get(SPIRV::OpGroupNonUniformAny))
19381936
.addDef(ResVReg)
19391937
.addUse(GR.getSPIRVTypeID(ResType))
1940-
.addUse(GR.getOrCreateConstInt(3, I, IntTy, TII))
1938+
.addUse(GR.getOrCreateConstInt(SPIRV::Scope::Subgroup, I, IntTy, TII))
19411939
.addUse(I.getOperand(2).getReg());
19421940
}
19431941

@@ -1987,7 +1985,7 @@ bool SPIRVInstructionSelector::selectWaveReadLaneAt(Register ResVReg,
19871985
TII.get(SPIRV::OpGroupNonUniformShuffle))
19881986
.addDef(ResVReg)
19891987
.addUse(GR.getSPIRVTypeID(ResType))
1990-
.addUse(GR.getOrCreateConstInt(3, I, IntTy, TII))
1988+
.addUse(GR.getOrCreateConstInt(SPIRV::Scope::Subgroup, I, IntTy, TII))
19911989
.addUse(I.getOperand(2).getReg())
19921990
.addUse(I.getOperand(3).getReg());
19931991
}

llvm/test/CodeGen/DirectX/WaveActiveAnyTrue.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
define noundef i1 @wave_aat_simple(i1 noundef %p1) {
44
entry:
5-
; CHECK: call i1 @dx.op.waveActiveAnyTrue(i32 113, i1 %p1)
5+
; CHECK: call i1 @dx.op.waveAnyTrue(i32 113, i1 %p1)
66
%ret = call i1 @llvm.dx.wave.activeanytrue(i1 %p1)
77
ret i1 %ret
88
}

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

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

44
; CHECK: %[[#bool:]] = OpTypeBool
55
; CHECK: %[[#uint:]] = OpTypeInt 32 0

0 commit comments

Comments
 (0)