Skip to content

Commit ea6e1b3

Browse files
committed
Changed naming convention and fixed formatting
1 parent 6fb6bd7 commit ea6e1b3

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

llvm/include/llvm/IR/IntrinsicsDirectX.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@ def int_dx_sign : DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i32
8989
def int_dx_step : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty, LLVMMatchType<0>], [IntrNoMem]>;
9090
def int_dx_radians : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
9191

92-
def int_dx_groupMemoryBarrierWithGroupSync : DefaultAttrsIntrinsic<[], [], []>;
92+
def int_dx_group_memory_barrier_with_group_sync : DefaultAttrsIntrinsic<[], [], []>;
9393
}

llvm/lib/Target/DirectX/DXILOpLowering.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -210,19 +210,14 @@ class OpLowerer {
210210
});
211211
}
212212

213-
[[nodiscard]] bool lowerBarrier(Function& F, Intrinsic::ID IntrId) {
213+
[[nodiscard]] bool lowerBarrier(Function &F, Intrinsic::ID IntrId,
214+
ArrayRef<dxil::BarrierMode> BarrierModes) {
215+
unsigned BarrierMode = 0;
216+
for (const dxil::BarrierMode B : BarrierModes) {
217+
BarrierMode |= (unsigned)B;
218+
}
214219
IRBuilder<> &IRB = OpBuilder.getIRB();
215220
return replaceFunction(F, [&](CallInst *CI) -> Error {
216-
unsigned BarrierMode = 0;
217-
switch (IntrId) {
218-
default:
219-
report_fatal_error("Unhandled barrier operation type.");
220-
break;
221-
case Intrinsic::dx_groupMemoryBarrierWithGroupSync:
222-
BarrierMode = (unsigned)dxil::BarrierMode::TGSMFence | (unsigned)dxil::BarrierMode::SyncThreadGroup;
223-
break;
224-
}
225-
226221
std::array<Value *, 1> Args{IRB.getInt32(BarrierMode)};
227222

228223
IRB.SetInsertPoint(CI);
@@ -505,8 +500,10 @@ class OpLowerer {
505500
HasErrors |= replaceFunctionWithOp(F, OpCode); \
506501
break;
507502
#include "DXILOperation.inc"
508-
case Intrinsic::dx_groupMemoryBarrierWithGroupSync:
509-
HasErrors |= lowerBarrier(F, ID);
503+
case Intrinsic::dx_group_memory_barrier_with_group_sync:
504+
HasErrors |= lowerBarrier(
505+
F, ID,
506+
{dxil::BarrierMode::TGSMFence, dxil::BarrierMode::SyncThreadGroup});
510507
break;
511508
case Intrinsic::dx_handle_fromBinding:
512509
HasErrors |= lowerHandleFromBinding(F);

llvm/test/CodeGen/DirectX/GroupMemoryBarrierWithGroupSync.ll renamed to llvm/test/CodeGen/DirectX/group_memory_barrier_with_group_sync.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
define void @test_group_memory_barrier_with_group_sync() {
44
entry:
55
; CHECK: call void @dx.op.barrier(i32 80, i32 9)
6-
call void @llvm.dx.groupMemoryBarrierWithGroupSync()
6+
call void @llvm.dx.group.memory.barrier.with.group.sync()
77
ret void
88
}

0 commit comments

Comments
 (0)