Skip to content

Commit 7782046

Browse files
committed
Changed naming convention and fixed formatting
1 parent 9ccd907 commit 7782046

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
@@ -93,5 +93,5 @@ def int_dx_splitdouble : DefaultAttrsIntrinsic<[llvm_anyint_ty, LLVMMatchType<0>
9393
[LLVMScalarOrSameVectorWidth<0, llvm_double_ty>], [IntrNoMem]>;
9494
def int_dx_radians : DefaultAttrsIntrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
9595

96-
def int_dx_groupMemoryBarrierWithGroupSync : DefaultAttrsIntrinsic<[], [], []>;
96+
def int_dx_group_memory_barrier_with_group_sync : DefaultAttrsIntrinsic<[], [], []>;
9797
}

llvm/lib/Target/DirectX/DXILOpLowering.cpp

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

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

227222
IRB.SetInsertPoint(CI);
@@ -504,8 +499,10 @@ class OpLowerer {
504499
HasErrors |= replaceFunctionWithOp(F, OpCode); \
505500
break;
506501
#include "DXILOperation.inc"
507-
case Intrinsic::dx_groupMemoryBarrierWithGroupSync:
508-
HasErrors |= lowerBarrier(F, ID);
502+
case Intrinsic::dx_group_memory_barrier_with_group_sync:
503+
HasErrors |= lowerBarrier(
504+
F, ID,
505+
{dxil::BarrierMode::TGSMFence, dxil::BarrierMode::SyncThreadGroup});
509506
break;
510507
case Intrinsic::dx_handle_fromBinding:
511508
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)